Create Task

onfleet.create_task
ActionBusiness appsconnection required

Calls the Onfleet API with the connection's credentials.

Create a delivery or pickup task, with its destination and recipient.

Connection

Required
Yes — the node will not save without one
Auth type
API key
Providers
Onfleet
Secret shape
the API key, or {"api_key": "…"}
Config it needs
base_url
Resolved by
config.connection_id, else node.connection_id

Configuration

12 fields, none required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
destination_id
The id of an existing Onfleet destination to deliver to. Use this when the address is already stored in Onfleet.
stringNo——zrVXZi5aDzOZlAghZaLfGAfA
destination
A destination object to create along with the task, instead of an id. Its 'address' takes either the parsed parts (number, street, city, country) or a single 'unparsed' string.
objectNo——{"address":{"unparsed":"543 Howard St, San Francisco, CA, USA"}}
recipient_ids
The ids of existing Onfleet recipients for this task. Onfleet accepts at most one recipient per task.
arrayNo—array of string—
recipient
A recipient to create along with the task, instead of an id. Onfleet treats the phone number as the recipient's unique identifier.
objectNo——{"name":"Blas Silkovich","phone":"+16505554481"}
notes
Notes shown to the driver on this task. Onfleet allows up to 10,000 characters.
stringNo—≤ 10000 characters—
complete_after
The earliest the task may be completed, as a Unix timestamp in milliseconds.
numberNo—≥ 01767225600000
complete_before
The latest the task should be completed, as a Unix timestamp in milliseconds.
numberNo—≥ 01767261600000
pickup_task
Whether this task is a pickup rather than a dropoff.
booleanNofalse——
quantity
How many units are dropped off here, which route optimisation uses to respect vehicle capacity.
numberNo—≥ 0—
service_time
How many minutes the driver is expected to spend at this stop, which route optimisation adds to the travel time.
numberNo—≥ 0—
container
Where the task is queued, such as {"type": "TEAM", "team": "<team id>"}. Leave blank to drop it in the organisation's default container. Cannot be combined with auto_assign.
objectNo——{"team":"fwflFNVvrK~4t0m5hKFIxBUl","type":"TEAM"}
auto_assign
Automatic assignment options for on-duty drivers, such as {"mode": "distance"}. Cannot be combined with container.
objectNo——{"mode":"distance"}
  • At least one of destination_id, destination must be set.

Example configuration

Every value below is the contract’s own example or default — nothing invented.

{
  "auto_assign": {
    "mode": "distance"
  },
  "complete_after": 1767225600000,
  "complete_before": 1767261600000,
  "container": {
    "team": "fwflFNVvrK~4t0m5hKFIxBUl",
    "type": "TEAM"
  },
  "destination": {
    "address": {
      "unparsed": "543 Howard St, San Francisco, CA, USA"
    }
  },
  "destination_id": "zrVXZi5aDzOZlAghZaLfGAfA",
  "pickup_task": false,
  "recipient": {
    "name": "Blas Silkovich",
    "phone": "+16505554481"
  }
}

Output

One shape.

result

FieldTypeExample
id
The task's Onfleet id.
string—
shortId
The short id that appears in the Onfleet dashboard.
string—
trackingURL
The public tracking link for this task's recipient.
string—
state
The task's state: 0 unassigned, 1 assigned, 2 active, 3 completed.
number—
worker
The id of the worker the task is assigned to, if any.
string—
organization
The id of the organisation the task belongs to.
string—
timeCreated
When the task was created, in Unix milliseconds.
number—
timeLastModified
When the task last changed, in Unix milliseconds.
number—
completeAfter
The earliest completion time asked for, in Unix ms.
number—
completeBefore
The latest completion time asked for, in Unix ms.
number—
pickupTask
Whether this task is a pickup rather than a dropoff.
boolean—
notes
The notes carried on the task.
string—
container.type
What the task is queued on: ORGANIZATION, TEAM or WORKER.
string—
destination.id
The id of the destination the task delivers to.
string—
destination.address.street
The destination's street name.
string—
destination.address.city
The destination's city.
string—
destination.location
The destination's [longitude, latitude] pair.
array—
recipients[].id
The id of a recipient attached to the task.
string—
recipients[].name
That recipient's name.
string—
recipients[].phone
That recipient's phone number.
string—
{
  "completeAfter": 0,
  "completeBefore": 0,
  "container": {
    "type": ""
  },
  "destination": {
    "address": {
      "city": "",
      "street": ""
    },
    "id": "",
    "location": []
  },
  "id": "",
  "notes": "",
  "organization": "",
  "pickupTask": false,
  "recipients": [
    {
      "id": "",
      "name": "",
      "phone": ""
    }
  ],
  "shortId": "",
  "state": 0,
  "timeCreated": 0,
  "timeLastModified": 0,
  "trackingURL": "",
  "worker": ""
}

Notes

  • Onfleet refuses a task that carries both 'container' and 'auto_assign' — pick one. Times are Unix milliseconds, never date strings.

See Create Task run in a workflow.

In a technical demo we add the Onfleet connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.