# Onfleet

> Run last-mile deliveries in Onfleet: create, assign, clone and track pickup and drop-off tasks, manage drivers, recipients and destinations, and read teams, hubs and driver analytics.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/onfleet

## Actions

### Clone task

Copy a task into a new, unassigned one -- for a repeat delivery -- optionally with different notes, time window, destination or recipient. New times must be in the future.

**Inputs**

- Task ID (`task_id`, text, required): The task's 24-character ID, from an earlier step or the task's page in the dashboard.
- Copy metadata (`include_metadata`, true/false): Copy the task's metadata to the clone. Default: `false`.
- Copy dependencies (`include_dependencies`, true/false): Copy the tasks it depends on to the clone. Default: `false`.
- Notes (`notes`, text): Notes for the clone, instead of the original's.
- Complete after (`complete_after`, date and time): The clone's earliest time; must be in the future.
- Complete before (`complete_before`, date and time): The clone's latest time; must be in the future.
- Destination ID (`destination_id`, text): A different existing destination for the clone.
- Recipient ID (`recipient_id`, text): A different existing recipient for the clone.

**Outputs**: A pickup or delivery task

- `appearance` (object): How the task shows on the dashboard map
- `assignmentHistory` (list): Every move between containers (only when asked for)
- `completeAfter` (number): Earliest time to complete it, in Unix ms, or null
- `completeBefore` (number): Latest time to complete it, in Unix ms, or null
- `completionDetails` (object): How the task was completed (mostly empty until it is)
- `container` (object): Where the task sits: a driver, a team, or the organization
- `creator` (text): ID of the admin or API key that created it
- `delayTime` (number): Seconds the task is running late, or null
- `dependencies` (list): IDs of tasks that must be completed first
- `destination` (object): A delivery or pickup location
- `didAutoAssign` (true/false): Whether automatic assignment found a driver (only when it was asked for)
- `estimatedArrivalTime` (number): Expected arrival, in Unix ms, or null
- `estimatedCompletionTime` (number): Expected completion, in Unix ms, or null
- `eta` (number): Seconds until the driver arrives, or null
- `executor` (text): ID of the organization that carries it out
- `feedback` (list): Ratings and comments the recipient left
- `id` (text): Task ID
- `merchant` (text): ID of the organization shown as the merchant
- `metadata` (list): Custom metadata entries set through the API
- `notes` (text): Notes for the driver
- `organization` (text): ID of the organization that owns the task
- `overrides` (object): Recipient details changed for this task only
- `pickupTask` (true/false): Whether it is a pickup rather than a drop-off
- `quantity` (number): Units to carry
- `recipients` (list): The task's recipient (zero or one)
- `serviceTime` (number): Minutes expected at the destination
- `shortId` (text): 8-character code shown in the dashboard and to recipients
- `sourceTaskId` (text): ID of the task it was cloned from (clones only)
- `state` (number): 0 unassigned, 1 assigned, 2 active, 3 completed
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `trackingURL` (text): Live tracking page for the recipient
- `trackingViewed` (true/false): Whether the recipient opened the tracking page
- `worker` (text): ID of the assigned driver, or null

**Example output**

```json
{
  "completeAfter": 1760590000000,
  "completeBefore": 1760600000000,
  "completionDetails": {
    "events": [],
    "time": null
  },
  "container": {
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
    "type": "ORGANIZATION"
  },
  "creator": "yAM*fDkztrT3gUcz9mNDgNOL",
  "dependencies": [],
  "destination": {
    "address": {
      "apartment": "",
      "city": "San Francisco",
      "country": "United States",
      "number": "2261",
      "postalCode": "94114",
      "state": "California",
      "street": "Market Street"
    },
    "id": "zrVXZi5dsXHVtgXdkYQ2SEOA",
    "location": [
      -122.4325,
      37.7644
    ],
    "metadata": [],
    "notes": "Ring the bell twice",
    "timeCreated": 1760500000000,
    "timeLastModified": 1760500000000
  },
  "executor": "yAM*fDkztrT3gUcz9mNDgNOL",
  "feedback": [],
  "id": "kc8SS1tzuZ~jqjlebKGrUmpe",
  "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
  "metadata": [],
  "notes": "Fragile: glassware",
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "overrides": {},
  "pickupTask": false,
  "quantity": 1,
  "recipients": [
    {
      "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
      "metadata": [],
      "name": "Blas Silkovich",
      "notes": "Leave with the doorman",
      "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
      "phone": "+14155550142",
      "skipSMSNotifications": false,
      "timeCreated": 1760500000000,
      "timeLastModified": 1760500000000
    }
  ],
  "serviceTime": 5,
  "shortId": "e5f0cc28",
  "sourceTaskId": "kc8SS1tzuZ~jqjlebKGrUmpe",
  "state": 0,
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000,
  "trackingURL": "https://onf.lt/e5f0cc28",
  "worker": null
}
```

### Complete task

Force-complete a task a driver has started, as successful or failed, with optional notes. Onfleet only allows this for active tasks; an unassigned or assigned one cannot be completed this way.

**Inputs**

- Task ID (`task_id`, text, required): The task's 24-character ID, from an earlier step or the task's page in the dashboard.
- Completed successfully (`success`, true/false): On to mark the task done; off to mark it failed. Default: `true`.
- Notes (`notes`, text): Completion notes.

**Outputs**

- `completed` (true/false): Always true
- `success` (true/false): Whether it was marked successful rather than failed
- `task_id` (text): The completed task's ID

**Example output**

```json
{
  "completed": true,
  "success": true,
  "task_id": "kc8SS1tzuZ~jqjlebKGrUmpe"
}
```

### Create destination

Save an address as a destination tasks can use. Give it in one line for Onfleet to geocode, or in parts, optionally with exact coordinates. Returns the geocoded address and coordinates.

**Inputs**

- Address (one line) (`address`, text): The full address in one line, for Onfleet to geocode. Use this or the parts below, not both.
- House number (`number`, text): Building number (needed with the parts, unless coordinates are given).
- Street (`street`, text): Street name (needed with the parts, unless coordinates are given).
- Apartment or unit (`apartment`, text): Apartment, suite or unit. Works with either form of address.
- City (`city`, text): City (needed with the parts).
- State or region (`state`, text): State, province or region.
- Postal code (`postal_code`, text): Postal or ZIP code.
- Country (`country`, text): Country (needed with the parts).
- Latitude (`latitude`, number): Exact latitude, to skip geocoding. Give longitude too, and the address in parts (at least city and country). From -90 to 90.
- Longitude (`longitude`, number): Exact longitude, given together with latitude. From -180 to 180.
- Place name (`place_name`, text): A name for the place, such as a business name.
- Notes (`notes`, text): Notes for the driver, such as a gate code.

**Outputs**: A delivery or pickup location

- `address` (object): Street address, as Onfleet geocoded it
- `googlePlaceId` (text): Google place ID, when Onfleet has one
- `id` (text): Destination ID
- `location` (list): Where it is, as [longitude, latitude]
- `metadata` (list): Custom metadata entries set through the API
- `notes` (text): Notes for the driver, such as a gate code
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `warnings` (list): Geocoding warnings, when the address was uncertain

**Example output**

```json
{
  "address": {
    "apartment": "",
    "city": "San Francisco",
    "country": "United States",
    "number": "2261",
    "postalCode": "94114",
    "state": "California",
    "street": "Market Street"
  },
  "id": "zrVXZi5dsXHVtgXdkYQ2SEOA",
  "location": [
    -122.4325,
    37.7644
  ],
  "metadata": [],
  "notes": "Ring the bell twice",
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000
}
```

### Create driver

Add a driver to one or more teams. Onfleet immediately texts the phone number a temporary password for the Onfleet driver app. The phone number must not belong to another driver.

**Inputs**

- Full name (`name`, text, required): The driver's full name.
- Phone number (`phone`, text, required): The driver's mobile number, unique in your organization. Onfleet texts it a temporary password for the driver app straight away.
- Teams (`team_ids`, list, required): The teams the driver belongs to (at least one).
- Display name (`display_name`, text): The name recipients see, if different from the full name.
- Vehicle capacity (`capacity`, number): How many units the driver's vehicle can carry. From 0 to 100000.
- Vehicle type (`vehicle_type`, text): The driver's vehicle. Needed if any other vehicle detail is set. One of: `CAR`, `MOTORCYCLE`, `BICYCLE`, `TRUCK`.
- Vehicle description (`vehicle_description`, text): Make and model, such as Toyota Prius.
- License plate (`vehicle_license_plate`, text): The vehicle's license plate.
- Vehicle color (`vehicle_color`, text): The vehicle's color.

**Outputs**: A driver (Onfleet calls them workers)

- `accountStatus` (text): Invitation state, such as INVITED or ACCEPTED
- `activeTask` (text): ID of the task the driver is on now, or null
- `analytics` (object): Duty, distance and time figures (only when analytics were asked for)
- `capacity` (number): How many units the vehicle can carry
- `delayTime` (number): Seconds the driver is running late, or null
- `displayName` (text): Name shown to recipients, or null
- `id` (text): Worker ID
- `imageUrl` (text): Profile photo URL, or null
- `location` (list): Last reported position (missing until reported), as [longitude, latitude]
- `metadata` (list): Custom metadata entries set through the API
- `name` (text): Full name
- `onDuty` (true/false): Whether the driver is on duty
- `organization` (text): ID of the organization the driver belongs to
- `phone` (text): Phone number in E.164 form, such as +14155550123
- `tasks` (list): IDs of the driver's assigned tasks, in route order
- `teams` (list): IDs of the driver's teams
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `timeLastSeen` (number): When the driver app last reported, in Unix ms
- `userData` (object): The driver app's device
- `vehicle` (object): The driver's vehicle, or null

**Example output**

```json
{
  "accountStatus": "INVITED",
  "activeTask": null,
  "capacity": 10,
  "delayTime": null,
  "displayName": null,
  "id": "h*wSb*apKlDkUFnuLTtjPke7",
  "imageUrl": null,
  "metadata": [],
  "name": "Andoni Rivera",
  "onDuty": false,
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "phone": "+14155550123",
  "tasks": [],
  "teams": [
    "R4P7jhuzaIZ62bOS6JLlEfI1"
  ],
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000,
  "timeLastSeen": 1760500000000,
  "vehicle": {
    "color": "Blue",
    "description": "Toyota Prius",
    "id": "tN3Bb5Sx8D3cP1F4oBcDcvSz",
    "licensePlate": "7ABC123",
    "type": "CAR"
  }
}
```

### Create recipient

Save a person who receives deliveries. Their phone number is their unique key in the organization, so creating a second recipient with the same number fails; use 'Find recipient' to get the existing one.

**Inputs**

- Full name (`name`, text, required): The recipient's full name.
- Phone number (`phone`, text, required): The recipient's phone number, unique in your organization. Local numbers are read in your organization's country.
- Notes (`notes`, text): Notes about the recipient, shown to drivers.
- Don't send text messages (`skip_sms_notifications`, true/false): Turn on so Onfleet never texts this recipient about deliveries. Default: `false`.
- Skip phone validation (`skip_phone_number_validation`, true/false): Turn on to accept a number Onfleet cannot verify. It must still start with + and the country code. Default: `false`.

**Outputs**: A person who receives deliveries

- `id` (text): Recipient ID
- `metadata` (list): Custom metadata entries set through the API
- `name` (text): Full name
- `notes` (text): Notes about the recipient
- `organization` (text): ID of the organization that owns the recipient
- `phone` (text): Phone number in E.164 form, unique in the organization
- `skipSMSNotifications` (true/false): Whether Onfleet skips text messages to this recipient
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds

**Example output**

```json
{
  "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
  "metadata": [],
  "name": "Blas Silkovich",
  "notes": "Leave with the doorman",
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "phone": "+14155550142",
  "skipSMSNotifications": false,
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000
}
```

### Create task

Create a pickup or drop-off at an address (geocoded by Onfleet) or an existing destination, optionally for a recipient, with a time window, notes, quantity and service time. Leave it unassigned, give it to a team or driver, or let automatic assignment pick the nearest or least busy driver. Returns the task with its short ID and the recipient's tracking link.

**Inputs**

- Address (one line) (`address`, text): Where the task happens, in one line, for Onfleet to geocode. Use this or a destination ID.
- Destination ID (`destination_id`, text): An existing destination, from 'Create destination'. Use this or an address.
- Address notes (`destination_notes`, text): Notes on the new address for the driver, such as a gate code.
- Recipient ID (`recipient_id`, text): An existing recipient, from 'Create recipient' or 'Find recipient'. Or describe a new one below.
- New recipient's name (`recipient_name`, text): Name of a new recipient, given together with their phone.
- New recipient's phone (`recipient_phone`, text): Phone of a new recipient. It must not belong to an existing recipient; use that one's ID instead.
- Recipient notes (`recipient_notes`, text): Notes about the new recipient.
- Don't text the recipient (`skip_sms_notifications`, true/false): Turn on so Onfleet sends the recipient no text messages about this task. Default: `false`.
- Notes (`notes`, text): Notes for the driver (up to 10,000 characters).
- Complete after (`complete_after`, date and time): The earliest the task should be done.
- Complete before (`complete_before`, date and time): The latest the task should be done.
- Pickup (`pickup_task`, true/false): Turn on for a pickup; off for a drop-off. Default: `false`.
- Quantity (`quantity`, number): Units to carry, counted against the driver's vehicle capacity. From 0 to 100000.
- Service time (minutes) (`service_time`, number): Minutes the driver is expected to spend at the destination. From 0 to 1440.
- Depends on tasks (`dependencies`, text): IDs of tasks that must be completed first, separated by commas.
- Assign to (`assign_to`, text): Who gets the task. Automatic assignment picks a driver who is on duty; if none can take it, the task stays unassigned. One of: `organization` (Leave unassigned), `team` (A team), `worker` (A driver), `auto` (Automatic assignment). Default: `organization`.
- Team (`team`, text): The team to give it to. With automatic assignment, limits the choice to this team, but only if team-based assignment is turned on in your Onfleet dashboard settings; otherwise it is ignored. Only when Assign to is A team or Automatic assignment.
- Driver (`worker_id`, text): The driver to give it to. Only when Assign to is A driver.
- Pick the driver by (`auto_assign_mode`, text): How automatic assignment chooses a driver. Only when Assign to is Automatic assignment. One of: `distance` (Nearest driver), `load` (Driver with the fewest tasks). Default: `distance`.
- Map color (`triangle_color`, text): The color of the task's marker on the dashboard map. One of: `0` (Teal), `1` (Orange), `2` (Magenta).

**Outputs**: A pickup or delivery task

- `appearance` (object): How the task shows on the dashboard map
- `assignmentHistory` (list): Every move between containers (only when asked for)
- `completeAfter` (number): Earliest time to complete it, in Unix ms, or null
- `completeBefore` (number): Latest time to complete it, in Unix ms, or null
- `completionDetails` (object): How the task was completed (mostly empty until it is)
- `container` (object): Where the task sits: a driver, a team, or the organization
- `creator` (text): ID of the admin or API key that created it
- `delayTime` (number): Seconds the task is running late, or null
- `dependencies` (list): IDs of tasks that must be completed first
- `destination` (object): A delivery or pickup location
- `didAutoAssign` (true/false): Whether automatic assignment found a driver (only when it was asked for)
- `estimatedArrivalTime` (number): Expected arrival, in Unix ms, or null
- `estimatedCompletionTime` (number): Expected completion, in Unix ms, or null
- `eta` (number): Seconds until the driver arrives, or null
- `executor` (text): ID of the organization that carries it out
- `feedback` (list): Ratings and comments the recipient left
- `id` (text): Task ID
- `merchant` (text): ID of the organization shown as the merchant
- `metadata` (list): Custom metadata entries set through the API
- `notes` (text): Notes for the driver
- `organization` (text): ID of the organization that owns the task
- `overrides` (object): Recipient details changed for this task only
- `pickupTask` (true/false): Whether it is a pickup rather than a drop-off
- `quantity` (number): Units to carry
- `recipients` (list): The task's recipient (zero or one)
- `serviceTime` (number): Minutes expected at the destination
- `shortId` (text): 8-character code shown in the dashboard and to recipients
- `sourceTaskId` (text): ID of the task it was cloned from (clones only)
- `state` (number): 0 unassigned, 1 assigned, 2 active, 3 completed
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `trackingURL` (text): Live tracking page for the recipient
- `trackingViewed` (true/false): Whether the recipient opened the tracking page
- `worker` (text): ID of the assigned driver, or null

**Example output**

```json
{
  "completeAfter": 1760590000000,
  "completeBefore": 1760600000000,
  "completionDetails": {
    "events": [],
    "time": null
  },
  "container": {
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
    "type": "ORGANIZATION"
  },
  "creator": "yAM*fDkztrT3gUcz9mNDgNOL",
  "dependencies": [],
  "destination": {
    "address": {
      "apartment": "",
      "city": "San Francisco",
      "country": "United States",
      "number": "2261",
      "postalCode": "94114",
      "state": "California",
      "street": "Market Street"
    },
    "id": "zrVXZi5dsXHVtgXdkYQ2SEOA",
    "location": [
      -122.4325,
      37.7644
    ],
    "metadata": [],
    "notes": "Ring the bell twice",
    "timeCreated": 1760500000000,
    "timeLastModified": 1760500000000
  },
  "executor": "yAM*fDkztrT3gUcz9mNDgNOL",
  "feedback": [],
  "id": "kc8SS1tzuZ~jqjlebKGrUmpe",
  "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
  "metadata": [],
  "notes": "Fragile: glassware",
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "overrides": {},
  "pickupTask": false,
  "quantity": 1,
  "recipients": [
    {
      "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
      "metadata": [],
      "name": "Blas Silkovich",
      "notes": "Leave with the doorman",
      "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
      "phone": "+14155550142",
      "skipSMSNotifications": false,
      "timeCreated": 1760500000000,
      "timeLastModified": 1760500000000
    }
  ],
  "serviceTime": 5,
  "shortId": "e5f0cc28",
  "state": 0,
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000,
  "trackingURL": "https://onf.lt/e5f0cc28",
  "worker": null
}
```

### Delete driver

Permanently remove a driver. A driver with a task in progress cannot be deleted until that task is completed.

**Inputs**

- Driver (`worker_id`, text, required): The driver to delete.

**Outputs**

- `deleted` (true/false): Always true
- `worker_id` (text): The deleted driver's ID

**Example output**

```json
{
  "deleted": true,
  "worker_id": "h*wSb*apKlDkUFnuLTtjPke7"
}
```

### Delete task

Permanently delete an unassigned or assigned task. Tasks a driver has started or completed cannot be deleted.

**Inputs**

- Task ID (`task_id`, text, required): The task's 24-character ID, from an earlier step or the task's page in the dashboard.

**Outputs**

- `deleted` (true/false): Always true
- `task_id` (text): The deleted task's ID

**Example output**

```json
{
  "deleted": true,
  "task_id": "kc8SS1tzuZ~jqjlebKGrUmpe"
}
```

### Find recipient

Look a recipient up by exact phone number, full name (any letter case) or ID. Returns found: false rather than an error when nobody matches, so a workflow can create one instead.

**Inputs**

- Find by (`find_by`, text): What to look the recipient up by. Matches are exact. One of: `phone` (Phone number), `name`, `id` (Recipient ID). Default: `phone`.
- Phone, name or ID (`value`, text, required): The phone number, the full name (any letter case) or the ID to look up.
- Recipient skipped phone validation (`skip_phone_number_validation`, true/false): Turn on to find a recipient that was created without phone validation. Default: `false`.

**Outputs**

- `found` (true/false): Whether a recipient matched
- `recipient` (object): The match, or null

**Example output**

```json
{
  "found": true,
  "recipient": {
    "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
    "metadata": [],
    "name": "Blas Silkovich",
    "notes": "Leave with the doorman",
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
    "phone": "+14155550142",
    "skipSMSNotifications": false,
    "timeCreated": 1760500000000,
    "timeLastModified": 1760500000000
  }
}
```

### Get destination

Read a destination's address, coordinates and notes.

**Inputs**

- Destination ID (`destination_id`, text, required): The destination's ID, such as a task's destination.id.

**Outputs**: A delivery or pickup location

- `address` (object): Street address, as Onfleet geocoded it
- `googlePlaceId` (text): Google place ID, when Onfleet has one
- `id` (text): Destination ID
- `location` (list): Where it is, as [longitude, latitude]
- `metadata` (list): Custom metadata entries set through the API
- `notes` (text): Notes for the driver, such as a gate code
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `warnings` (list): Geocoding warnings, when the address was uncertain

**Example output**

```json
{
  "address": {
    "apartment": "",
    "city": "San Francisco",
    "country": "United States",
    "number": "2261",
    "postalCode": "94114",
    "state": "California",
    "street": "Market Street"
  },
  "id": "zrVXZi5dsXHVtgXdkYQ2SEOA",
  "location": [
    -122.4325,
    37.7644
  ],
  "metadata": [],
  "notes": "Ring the bell twice",
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000
}
```

### Get driver

Read one driver: phone, teams, duty state, current and assigned tasks, vehicle and last location. Optionally add analytics -- on/off-duty events, distance and time driven, and tasks completed -- for the last week or a window of up to 24 hours.

**Inputs**

- Driver (`worker_id`, text, required): The driver to read.
- Include analytics (`include_analytics`, true/false): Add on/off-duty events, distance and time driven, and tasks completed. Covers the last week unless you set a window below of up to 24 hours. Default: `false`.
- Analytics from (`analytics_from`, date and time): Start of the analytics window (24 hours at most).
- Analytics to (`analytics_to`, date and time): End of the analytics window.

**Outputs**: A driver (Onfleet calls them workers)

- `accountStatus` (text): Invitation state, such as INVITED or ACCEPTED
- `activeTask` (text): ID of the task the driver is on now, or null
- `analytics` (object): Duty, distance and time figures (only when analytics were asked for)
- `capacity` (number): How many units the vehicle can carry
- `delayTime` (number): Seconds the driver is running late, or null
- `displayName` (text): Name shown to recipients, or null
- `id` (text): Worker ID
- `imageUrl` (text): Profile photo URL, or null
- `location` (list): Last reported position (missing until reported), as [longitude, latitude]
- `metadata` (list): Custom metadata entries set through the API
- `name` (text): Full name
- `onDuty` (true/false): Whether the driver is on duty
- `organization` (text): ID of the organization the driver belongs to
- `phone` (text): Phone number in E.164 form, such as +14155550123
- `tasks` (list): IDs of the driver's assigned tasks, in route order
- `teams` (list): IDs of the driver's teams
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `timeLastSeen` (number): When the driver app last reported, in Unix ms
- `userData` (object): The driver app's device
- `vehicle` (object): The driver's vehicle, or null

**Example output**

```json
{
  "accountStatus": "INVITED",
  "activeTask": null,
  "capacity": 10,
  "delayTime": null,
  "displayName": null,
  "id": "h*wSb*apKlDkUFnuLTtjPke7",
  "imageUrl": null,
  "metadata": [],
  "name": "Andoni Rivera",
  "onDuty": false,
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "phone": "+14155550123",
  "tasks": [],
  "teams": [
    "R4P7jhuzaIZ62bOS6JLlEfI1"
  ],
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000,
  "timeLastSeen": 1760500000000,
  "vehicle": {
    "color": "Blue",
    "description": "Toyota Prius",
    "id": "tN3Bb5Sx8D3cP1F4oBcDcvSz",
    "licensePlate": "7ABC123",
    "type": "CAR"
  }
}
```

### Get organization

Read the Onfleet organization the connection belongs to: its ID, name, contact email, time zone, country (which decides how local phone numbers are read) and connected organizations.

**Inputs**: None.

**Outputs**: The Onfleet organization the API key belongs to

- `country` (text): Two-letter country code, used to read local phone numbers
- `delegatees` (list): IDs of connected organizations this one can hand tasks to
- `email` (text): Organization contact email
- `id` (text): Organization ID
- `image` (text): Logo image ID, or null
- `name` (text): Organization name
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `timezone` (text): Time zone, such as America/Los_Angeles

**Example output**

```json
{
  "country": "US",
  "delegatees": [],
  "email": "ops@example.com",
  "id": "yAM*fDkztrT3gUcz9mNDgNOL",
  "image": null,
  "name": "Lodol Deliveries",
  "timeCreated": 1760000000000,
  "timeLastModified": 1760000000000,
  "timezone": "America/Los_Angeles"
}
```

### Get task

Read a task by its ID or its 8-character short ID: state, driver, destination, recipient, time window, ETA, tracking link and -- once completed -- completion details such as proof-of-delivery photos, signature and notes.

**Inputs**

- Look up by (`lookup_by`, text): The task's ID, or its 8-character short ID -- the code shown in the dashboard and on the recipient's tracking page. One of: `id` (Task ID), `short_id` (Short ID). Default: `id`.
- Task ID or short ID (`task_id`, text, required): The task's ID or short ID.
- Include assignment history (`include_assignment_history`, true/false): Add every move of the task between drivers and teams. Default: `false`.

**Outputs**: A pickup or delivery task

- `appearance` (object): How the task shows on the dashboard map
- `assignmentHistory` (list): Every move between containers (only when asked for)
- `completeAfter` (number): Earliest time to complete it, in Unix ms, or null
- `completeBefore` (number): Latest time to complete it, in Unix ms, or null
- `completionDetails` (object): How the task was completed (mostly empty until it is)
- `container` (object): Where the task sits: a driver, a team, or the organization
- `creator` (text): ID of the admin or API key that created it
- `delayTime` (number): Seconds the task is running late, or null
- `dependencies` (list): IDs of tasks that must be completed first
- `destination` (object): A delivery or pickup location
- `didAutoAssign` (true/false): Whether automatic assignment found a driver (only when it was asked for)
- `estimatedArrivalTime` (number): Expected arrival, in Unix ms, or null
- `estimatedCompletionTime` (number): Expected completion, in Unix ms, or null
- `eta` (number): Seconds until the driver arrives, or null
- `executor` (text): ID of the organization that carries it out
- `feedback` (list): Ratings and comments the recipient left
- `id` (text): Task ID
- `merchant` (text): ID of the organization shown as the merchant
- `metadata` (list): Custom metadata entries set through the API
- `notes` (text): Notes for the driver
- `organization` (text): ID of the organization that owns the task
- `overrides` (object): Recipient details changed for this task only
- `pickupTask` (true/false): Whether it is a pickup rather than a drop-off
- `quantity` (number): Units to carry
- `recipients` (list): The task's recipient (zero or one)
- `serviceTime` (number): Minutes expected at the destination
- `shortId` (text): 8-character code shown in the dashboard and to recipients
- `sourceTaskId` (text): ID of the task it was cloned from (clones only)
- `state` (number): 0 unassigned, 1 assigned, 2 active, 3 completed
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `trackingURL` (text): Live tracking page for the recipient
- `trackingViewed` (true/false): Whether the recipient opened the tracking page
- `worker` (text): ID of the assigned driver, or null

**Example output**

```json
{
  "completeAfter": 1760590000000,
  "completeBefore": 1760600000000,
  "completionDetails": {
    "events": [],
    "time": null
  },
  "container": {
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
    "type": "ORGANIZATION"
  },
  "creator": "yAM*fDkztrT3gUcz9mNDgNOL",
  "dependencies": [],
  "destination": {
    "address": {
      "apartment": "",
      "city": "San Francisco",
      "country": "United States",
      "number": "2261",
      "postalCode": "94114",
      "state": "California",
      "street": "Market Street"
    },
    "id": "zrVXZi5dsXHVtgXdkYQ2SEOA",
    "location": [
      -122.4325,
      37.7644
    ],
    "metadata": [],
    "notes": "Ring the bell twice",
    "timeCreated": 1760500000000,
    "timeLastModified": 1760500000000
  },
  "executor": "yAM*fDkztrT3gUcz9mNDgNOL",
  "feedback": [],
  "id": "kc8SS1tzuZ~jqjlebKGrUmpe",
  "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
  "metadata": [],
  "notes": "Fragile: glassware",
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "overrides": {},
  "pickupTask": false,
  "quantity": 1,
  "recipients": [
    {
      "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
      "metadata": [],
      "name": "Blas Silkovich",
      "notes": "Leave with the doorman",
      "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
      "phone": "+14155550142",
      "skipSMSNotifications": false,
      "timeCreated": 1760500000000,
      "timeLastModified": 1760500000000
    }
  ],
  "serviceTime": 5,
  "shortId": "e5f0cc28",
  "state": 0,
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000,
  "trackingURL": "https://onf.lt/e5f0cc28",
  "worker": null
}
```

### List drivers

List the organization's drivers, optionally only those in certain teams, duty states or with certain phone numbers. Each comes with their phone, teams, duty state, current task, assigned tasks in route order, vehicle and last location.

**Inputs**

- Teams (`team_ids`, list): Only drivers in any of these teams. Leave empty for all.
- Duty states (`states`, list): Only drivers in any of these states. Leave empty for all. One or more of: `0` (Off duty), `1` (Idle (on duty, no task in progress)), `2` (Active (on duty, on a task)).
- Phone numbers (`phones`, text): Only drivers with these phone numbers, separated by commas. Local numbers are read in your organization's country.

**Outputs**

- `count` (number): How many workers were returned
- `workers` (list): Matching drivers

**Example output**

```json
{
  "count": 1,
  "workers": [
    {
      "accountStatus": "INVITED",
      "activeTask": null,
      "capacity": 10,
      "delayTime": null,
      "displayName": null,
      "id": "h*wSb*apKlDkUFnuLTtjPke7",
      "imageUrl": null,
      "metadata": [],
      "name": "Andoni Rivera",
      "onDuty": false,
      "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
      "phone": "+14155550123",
      "tasks": [],
      "teams": [
        "R4P7jhuzaIZ62bOS6JLlEfI1"
      ],
      "timeCreated": 1760500000000,
      "timeLastModified": 1760500000000,
      "timeLastSeen": 1760500000000,
      "vehicle": {
        "color": "Blue",
        "description": "Toyota Prius",
        "id": "tN3Bb5Sx8D3cP1F4oBcDcvSz",
        "licensePlate": "7ABC123",
        "type": "CAR"
      }
    }
  ]
}
```

### List hubs

List the organization's hubs (depots), with each one's address, coordinates and the teams that use it.

**Inputs**: None.

**Outputs**

- `count` (number): How many hubs were returned
- `hubs` (list): Every hub

**Example output**

```json
{
  "count": 1,
  "hubs": [
    {
      "address": {
        "city": "San Francisco",
        "country": "United States",
        "number": "3150",
        "postalCode": "94110",
        "state": "California",
        "street": "18th Street"
      },
      "id": "tKxSfU7psqDQEBVn5e2VQ~*O",
      "location": [
        -122.4194,
        37.7599
      ],
      "name": "Mission Depot",
      "teams": [
        "R4P7jhuzaIZ62bOS6JLlEfI1"
      ]
    }
  ]
}
```

### List tasks

List tasks in a time range -- by completion time for completed tasks, creation time for the rest -- optionally only certain states, one driver's, or within a delivery window. Pages through the results up to the maximum you set.

**Inputs**

- From (`from_time`, date and time): Start of the time range. Completed tasks match on when they were completed, others on when they were created. Defaults to 7 days ago.
- To (`to_time`, date and time): End of the time range. Defaults to now.
- States (`states`, list): Only tasks in any of these states. Leave empty for all. One or more of: `0` (Unassigned), `1` (Assigned), `2` (Active), `3` (Completed).
- Driver (`worker_id`, text): Only tasks this driver has now or has completed.
- Earliest 'complete after' (`complete_after_after`, date and time): Only tasks whose 'complete after' time is later than this.
- Latest 'complete before' (`complete_before_before`, date and time): Only tasks whose 'complete before' time is earlier than this.
- Include assignment history (`include_assignment_history`, true/false): Add every move of each task between drivers and teams. Default: `false`.
- Maximum tasks (`max_results`, number): Stop after this many tasks, 1-2000. Defaults to 100. From 1 to 2000. Default: `100`.

**Outputs**

- `count` (number): Tasks returned
- `has_more` (true/false): Whether more tasks matched than were returned
- `last_id` (text): Where Onfleet would continue, or null at the end
- `tasks` (list): Matching tasks

**Example output**

```json
{
  "count": 1,
  "has_more": false,
  "last_id": null,
  "tasks": [
    {
      "completeAfter": 1760590000000,
      "completeBefore": 1760600000000,
      "completionDetails": {
        "events": [],
        "time": null
      },
      "container": {
        "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
        "type": "ORGANIZATION"
      },
      "creator": "yAM*fDkztrT3gUcz9mNDgNOL",
      "dependencies": [],
      "destination": {
        "address": {
          "apartment": "",
          "city": "San Francisco",
          "country": "United States",
          "number": "2261",
          "postalCode": "94114",
          "state": "California",
          "street": "Market Street"
        },
        "id": "zrVXZi5dsXHVtgXdkYQ2SEOA",
        "location": [
          -122.4325,
          37.7644
        ],
        "metadata": [],
        "notes": "Ring the bell twice",
        "timeCreated": 1760500000000,
        "timeLastModified": 1760500000000
      },
      "executor": "yAM*fDkztrT3gUcz9mNDgNOL",
      "feedback": [],
      "id": "kc8SS1tzuZ~jqjlebKGrUmpe",
      "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
      "metadata": [],
      "notes": "Fragile: glassware",
      "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
      "overrides": {},
      "pickupTask": false,
      "quantity": 1,
      "recipients": [
        {
          "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
          "metadata": [],
          "name": "Blas Silkovich",
          "notes": "Leave with the doorman",
          "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
          "phone": "+14155550142",
          "skipSMSNotifications": false,
          "timeCreated": 1760500000000,
          "timeLastModified": 1760500000000
        }
      ],
      "serviceTime": 5,
      "shortId": "e5f0cc28",
      "state": 0,
      "timeCreated": 1760500000000,
      "timeLastModified": 1760500000000,
      "trackingURL": "https://onf.lt/e5f0cc28",
      "worker": null
    }
  ]
}
```

### List teams

List every team of drivers in the organization, with each team's drivers, dispatchers, hub and unassigned tasks.

**Inputs**: None.

**Outputs**

- `count` (number): How many teams were returned
- `teams` (list): Every team

**Example output**

```json
{
  "count": 1,
  "teams": [
    {
      "hub": "tKxSfU7psqDQEBVn5e2VQ~*O",
      "id": "R4P7jhuzaIZ62bOS6JLlEfI1",
      "managers": [],
      "name": "Downtown Couriers",
      "tasks": [],
      "timeCreated": 1760500000000,
      "timeLastModified": 1760500000000,
      "workers": [
        "h*wSb*apKlDkUFnuLTtjPke7"
      ]
    }
  ]
}
```

### Update driver

Change a driver's name, display name, teams or vehicle capacity. Teams are replaced, not added to. A driver's phone number cannot be changed through the API.

**Inputs**

- Driver (`worker_id`, text, required): The driver to change.
- Full name (`name`, text): A new full name. Leave empty to keep it.
- Display name (`display_name`, text): The name recipients see, if different from the full name.
- Teams (`team_ids`, list): Replaces the driver's teams with exactly these. Leave empty to keep them.
- Vehicle capacity (`capacity`, number): How many units the driver's vehicle can carry. From 0 to 100000.

**Outputs**: A driver (Onfleet calls them workers)

- `accountStatus` (text): Invitation state, such as INVITED or ACCEPTED
- `activeTask` (text): ID of the task the driver is on now, or null
- `analytics` (object): Duty, distance and time figures (only when analytics were asked for)
- `capacity` (number): How many units the vehicle can carry
- `delayTime` (number): Seconds the driver is running late, or null
- `displayName` (text): Name shown to recipients, or null
- `id` (text): Worker ID
- `imageUrl` (text): Profile photo URL, or null
- `location` (list): Last reported position (missing until reported), as [longitude, latitude]
- `metadata` (list): Custom metadata entries set through the API
- `name` (text): Full name
- `onDuty` (true/false): Whether the driver is on duty
- `organization` (text): ID of the organization the driver belongs to
- `phone` (text): Phone number in E.164 form, such as +14155550123
- `tasks` (list): IDs of the driver's assigned tasks, in route order
- `teams` (list): IDs of the driver's teams
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `timeLastSeen` (number): When the driver app last reported, in Unix ms
- `userData` (object): The driver app's device
- `vehicle` (object): The driver's vehicle, or null

**Example output**

```json
{
  "accountStatus": "INVITED",
  "activeTask": null,
  "capacity": 10,
  "delayTime": null,
  "displayName": null,
  "id": "h*wSb*apKlDkUFnuLTtjPke7",
  "imageUrl": null,
  "metadata": [],
  "name": "Andoni Rivera",
  "onDuty": false,
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "phone": "+14155550123",
  "tasks": [],
  "teams": [
    "R4P7jhuzaIZ62bOS6JLlEfI1"
  ],
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000,
  "timeLastSeen": 1760500000000,
  "vehicle": {
    "color": "Blue",
    "description": "Toyota Prius",
    "id": "tN3Bb5Sx8D3cP1F4oBcDcvSz",
    "licensePlate": "7ABC123",
    "type": "CAR"
  }
}
```

### Update recipient

Change a recipient's name, notes or whether Onfleet texts them. The phone number cannot be changed.

**Inputs**

- Recipient ID (`recipient_id`, text, required): The recipient to change.
- Full name (`name`, text): A new name. Leave empty to keep it. The phone number cannot change.
- Notes (`notes`, text): New notes. Leave empty to keep them.
- Text messages (`sms_notifications`, text): Whether Onfleet texts this recipient about deliveries. One of: `keep` (Leave as is), `send` (Send text messages), `skip` (Don't send text messages). Default: `keep`.

**Outputs**: A person who receives deliveries

- `id` (text): Recipient ID
- `metadata` (list): Custom metadata entries set through the API
- `name` (text): Full name
- `notes` (text): Notes about the recipient
- `organization` (text): ID of the organization that owns the recipient
- `phone` (text): Phone number in E.164 form, unique in the organization
- `skipSMSNotifications` (true/false): Whether Onfleet skips text messages to this recipient
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds

**Example output**

```json
{
  "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
  "metadata": [],
  "name": "Blas Silkovich",
  "notes": "Leave with the doorman",
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "phone": "+14155550142",
  "skipSMSNotifications": false,
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000
}
```

### Update task

Change a task that has not started: notes, time window, destination, recipient, pickup or drop-off, quantity, service time, or who it is assigned to. Once a driver starts it only the notes can change, and a completed task cannot change.

**Inputs**

- Task ID (`task_id`, text, required): The task's 24-character ID, from an earlier step or the task's page in the dashboard.
- Notes (`notes`, text): New notes for the driver. The only field a started task accepts.
- Complete after (`complete_after`, date and time): The earliest the task should be done.
- Complete before (`complete_before`, date and time): The latest the task should be done.
- Destination ID (`destination_id`, text): Move the task to this existing destination.
- Recipient ID (`recipient_id`, text): Give the task to this existing recipient.
- Pickup or drop-off (`task_kind`, text): Change whether the task is a pickup or a drop-off. One of: `keep` (Leave as is), `dropoff` (Drop-off), `pickup`. Default: `keep`.
- Quantity (`quantity`, number): Units to carry, counted against the driver's vehicle capacity. From 0 to 100000.
- Service time (minutes) (`service_time`, number): Minutes the driver is expected to spend at the destination. From 0 to 1440.
- Assign to (`assign_to`, text): Move the task to a team or driver, or back to unassigned. One of: `keep` (Leave as is), `organization` (Unassign), `team` (A team), `worker` (A driver). Default: `keep`.
- Team (`team`, text): The team to move it to. Only when Assign to is A team.
- Driver (`worker_id`, text): The driver to move it to. Only when Assign to is A driver.

**Outputs**: A pickup or delivery task

- `appearance` (object): How the task shows on the dashboard map
- `assignmentHistory` (list): Every move between containers (only when asked for)
- `completeAfter` (number): Earliest time to complete it, in Unix ms, or null
- `completeBefore` (number): Latest time to complete it, in Unix ms, or null
- `completionDetails` (object): How the task was completed (mostly empty until it is)
- `container` (object): Where the task sits: a driver, a team, or the organization
- `creator` (text): ID of the admin or API key that created it
- `delayTime` (number): Seconds the task is running late, or null
- `dependencies` (list): IDs of tasks that must be completed first
- `destination` (object): A delivery or pickup location
- `didAutoAssign` (true/false): Whether automatic assignment found a driver (only when it was asked for)
- `estimatedArrivalTime` (number): Expected arrival, in Unix ms, or null
- `estimatedCompletionTime` (number): Expected completion, in Unix ms, or null
- `eta` (number): Seconds until the driver arrives, or null
- `executor` (text): ID of the organization that carries it out
- `feedback` (list): Ratings and comments the recipient left
- `id` (text): Task ID
- `merchant` (text): ID of the organization shown as the merchant
- `metadata` (list): Custom metadata entries set through the API
- `notes` (text): Notes for the driver
- `organization` (text): ID of the organization that owns the task
- `overrides` (object): Recipient details changed for this task only
- `pickupTask` (true/false): Whether it is a pickup rather than a drop-off
- `quantity` (number): Units to carry
- `recipients` (list): The task's recipient (zero or one)
- `serviceTime` (number): Minutes expected at the destination
- `shortId` (text): 8-character code shown in the dashboard and to recipients
- `sourceTaskId` (text): ID of the task it was cloned from (clones only)
- `state` (number): 0 unassigned, 1 assigned, 2 active, 3 completed
- `timeCreated` (number): When it was created, in Unix milliseconds
- `timeLastModified` (number): When it last changed, in Unix milliseconds
- `trackingURL` (text): Live tracking page for the recipient
- `trackingViewed` (true/false): Whether the recipient opened the tracking page
- `worker` (text): ID of the assigned driver, or null

**Example output**

```json
{
  "completeAfter": 1760590000000,
  "completeBefore": 1760600000000,
  "completionDetails": {
    "events": [],
    "time": null
  },
  "container": {
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
    "type": "ORGANIZATION"
  },
  "creator": "yAM*fDkztrT3gUcz9mNDgNOL",
  "dependencies": [],
  "destination": {
    "address": {
      "apartment": "",
      "city": "San Francisco",
      "country": "United States",
      "number": "2261",
      "postalCode": "94114",
      "state": "California",
      "street": "Market Street"
    },
    "id": "zrVXZi5dsXHVtgXdkYQ2SEOA",
    "location": [
      -122.4325,
      37.7644
    ],
    "metadata": [],
    "notes": "Ring the bell twice",
    "timeCreated": 1760500000000,
    "timeLastModified": 1760500000000
  },
  "executor": "yAM*fDkztrT3gUcz9mNDgNOL",
  "feedback": [],
  "id": "kc8SS1tzuZ~jqjlebKGrUmpe",
  "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
  "metadata": [],
  "notes": "Fragile: glassware",
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "overrides": {},
  "pickupTask": false,
  "quantity": 1,
  "recipients": [
    {
      "id": "VVLx5OdKvw0dRSjT2rGWFSjE",
      "metadata": [],
      "name": "Blas Silkovich",
      "notes": "Leave with the doorman",
      "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
      "phone": "+14155550142",
      "skipSMSNotifications": false,
      "timeCreated": 1760500000000,
      "timeLastModified": 1760500000000
    }
  ],
  "serviceTime": 5,
  "shortId": "e5f0cc28",
  "state": 0,
  "timeCreated": 1760500000000,
  "timeLastModified": 1760500000000,
  "trackingURL": "https://onf.lt/e5f0cc28",
  "worker": null
}
```
