Create Order

To create orders

Create Orders:

To create an order pair, you would need to create both pickup and dropoff pair.

The top level body fields requires pickupTask and dropoffTask as top level fields. The order pairs of tasks will automatically be directed to the courier's Onfleet dashboard for delivery assignment.

Required recipient field for each task:

NameTypeDescription
namestringOptional. The recipient’s complete name.
phonestringOptional. A unique, valid phone number as per the organization’s country if there's no leading + sign. If a phone number has a leading + sign, it will disregard the organization's country setting.

Destination is a required field, with address sub-field(s). You have to choose either the unparsed field, or spell out the address components, for example if you have address.number, you will need to supply the rest of the address component.

Required destination field for each task:

NameTypeDescription
unparsedstringOptional. The full address in a single text field. For example: 1 Warriors Way, San Francisco, CA 94158, USA
numberstringRequired. The number components of the address. For example: 1.
streetstringRequired. The street name of the address component. For example: Warriors Way.
citystringRequired. The name of the municipality or the locale of an address. For example: San Francisco
statestringRequired. The name of the wider jurisdiction, state or province or similar. For example: CA or California
postalCodestringRequired. The postal code or a zip code of the address component, if there is one. For example: 94158.
countrystringRequired. The country component of the address, the name of the country goes here. For example: USA
apartmentstringOptional, if the delivery destination is has one.

Optional Task fields for both pickupTask and dropoffTask:

NameTypeDescription
notesstringOptional. Notes for pickupTask and dropoffTask. Field length cannot exceed 10,000 characters.
completeBeforenumberOptional. A timestamp in
unix time for the latest time the order should be completed, in milliseconds precision. This value must be the same on the Pickup and Dropoff task.
completeAfternumberOptional. A timestamp in unix time for the earliest time the task should be completed, in milliseconds precision. This value must be the same on the Pickup and Dropoff task.
quantitynumberOptional. The number of units to be dropped off while completing this task, for the Courier’s route optimization purposes.

Requirements field for what to collect from the recipients when the Worker delivered their payload. This is a signified with an requirements object; more information can be found here. This is for drop off task only:

NameTypeDescription
signaturebooleanOptional. A signature must be collected to complete this task.
photobooleanOptional. A photo must be collected to complete this task.
minimumAgenumberOptional. The recipient's ID must be scanned and their age verified to be greater than or equal to the minimumAge in order to complete the task. Must be in a plan that supports ID verification.
notesbooleanOptional. Task completion notes must be submitted to complete this task.

📘

Task, Destination, and Recipient objects

In order to make an order pair, you can just use the Skeleton JSON payload and swap out the values for your orders.

Example request and Skeleton JSON:

curl -i -X POST "https://onfleet.com/api/v2/taskOrders" \
     -u 'c64f80ba83d7cfce8ae74f51e263ce93:' \
     -d '{"pickupTask": {"destination": {"address": {"unparsed": "honda center"}},"recipients": []},"dropoffTask": {"destination": {"address": {"unparsed": "dodgers stadium"}},"recipients": []},"courier": "nYrkNP6jZMSKgBwG9qG7ci3J"}'
{
    "pickupTask": {
        "destination": {
            "address": {
                "number":"2695",
                "street":"E. Katella Ave.",
                "city":"Anaheim",
                "state":"CA",
                "postalCode":"92806",
                "country":"USA",
                "apartment":""
            }
        },
        "recipients": [
          {
                "name": "Jane Doe",
                "phone": "+1415555555"
          }
        ],
        "notes":"this is a pick up test",
        "completeAfter":1710265683752,
        "completeBefore":1734025683000,
        "quantity":1,
    },
    "dropoffTask": {
        "destination": {
            "address": {
                "number":"1000",
                "street":"Vin Scully Ave.",
                "city":"Los Angeles",
                "state":"CA",
                "postalCode":"90012",
                "country":"USA",
                "apartment":""
            }
        },
        "recipients": [{
                "name": "John Smith",
                "phone": "+16265554147"
          }
        ],
        "notes":"this is a test",
        "completeAfter":1710265683752,
        "completeBefore":1734025683000,
        "quantity":1,
        "requirements":{
                "signature":false,
                "photo":false,
                "notes":false,
                "minimumAge":21
        }
    }
}
{
    "courier": "nYrkNP6jZMSKgBwG9qG7ci3J",
    "dropoffTask":
    {
        "destination":
        {
            "address":
            {
                "unparsed": "dodgers stadium"
            }
        },
        "recipients":
        []
    },
    "pickupTask":
    {
        "destination":
        {
            "address":
            {
                "unparsed": "honda center"
            }
        },
        "recipients":
        []
    }
}

Example response JSON payload:

{
    "id": "MasITvWLV8FOEcvl8Pnp4cly",
    "timeCreated": 1710531703000,
    "timeLastModified": 1710531703993,
    "source": "api",
    "events": [],
    "pickupTask": {
        "id": "nMREhC9w6rlYEmYEef5Z9AXu",
        "timeCreated": 1710531703000,
        "timeLastModified": 1710531703495,
        "organization": "turZSLp9A6EaksJO3bWZYtdd",
        "shortId": "247612e8",
        "trackingURL": "https://onf.lt/247612e8",
        "worker": null,
        "merchant": "turZSLp9A6EaksJO3bWZYtdd",
        "executor": "nYrkNP6jZMSKgBwG9qG7ci3J",
        "creator": "jj4cMt7V~DjloxnuCql6nfTE",
        "isActive": false,
        "dependencies": [],
        "completeAfter": null,
        "completeBefore": null,
        "completionDetails": {
            "failureNotes": "",
            "successNotes": "",
            "failureReason": "NONE",
            "events": [],
            "actions": [],
            "time": null,
            "signatureUploadId": null,
            "photoUploadId": null,
            "photoUploadIds": null,
            "firstLocation": [],
            "lastLocation": [],
            "unavailableAttachments": []
        },
        "commConfig": {
            "doProxy": false
        },
        "pickupTask": true,
        "notes": "",
        "feedback": [],
        "overrides": {},
        "computed": {
            "arrival": {
                "location": []
            },
            "departure": {
                "location": []
            },
            "firstLocation": [],
            "lastLocation": []
        },
        "quantity": 0,
        "additionalQuantities": {
            "quantityA": 0,
            "quantityB": 0,
            "quantityC": 0
        },
        "serviceTime": 0,
        "lastModifiedBy": "jj4cMt7V~DjloxnuCql6nfTE",
        "isFulfilled": false,
        "attachments": [],
        "recipientFirstViewedTime": null,
        "recipientFeedbackTime": null,
        "startTime": null,
        "estimatedCompletionTime": null,
        "identity": {
            "failedScanCount": 0,
            "checksum": null
        },
        "completionPreference": -1,
        "optimizationId": null,
        "appearance": {
            "triangleColor": null
        },
        "assignmentHistory": [],
        "isSelfAssigned": false,
        "isSelfAssignable": false,
        "container": {
            "type": "ORGANIZATION",
            "organization": "nYrkNP6jZMSKgBwG9qG7ci3J"
        },
        "customFields": [],
        "metadata": [],
        "recipients": [],
        "delayTime": null,
        "estimatedArrivalTime": null,
        "destination": {
            "id": "lz0wHVpd~RMeZAUaRr4P7ELF",
            "timeCreated": 1710531703000,
            "timeLastModified": 1710531703377,
            "location": [
                -117.8764687,
                33.8078476
            ],
            "address": {
                "apartment": "",
                "state": "California",
                "postalCode": "92806",
                "number": "2695",
                "street": "East Katella Avenue",
                "city": "Anaheim",
                "country": "United States"
            },
            "notes": "",
            "organization": "turZSLp9A6EaksJO3bWZYtdd",
            "wasGeocoded": true,
            "createdByLocation": false,
            "googlePlaceId": null,
            "useGPS": false
        }
    },
    "dropoffTask": {
        "id": "tfyYclLB0IkQGzA9pc8elYG2",
        "timeCreated": 1710531703000,
        "timeLastModified": 1710531703880,
        "organization": "turZSLp9A6EaksJO3bWZYtdd",
        "shortId": "a2c7cb78",
        "trackingURL": "https://onf.lt/a2c7cb78",
        "worker": null,
        "merchant": "turZSLp9A6EaksJO3bWZYtdd",
        "executor": "nYrkNP6jZMSKgBwG9qG7ci3J",
        "creator": "jj4cMt7V~DjloxnuCql6nfTE",
        "isActive": false,
        "dependencies": [
            "nMREhC9w6rlYEmYEef5Z9AXu"
        ],
        "completeAfter": null,
        "completeBefore": null,
        "completionDetails": {
            "failureNotes": "",
            "successNotes": "",
            "failureReason": "NONE",
            "events": [],
            "actions": [],
            "time": null,
            "signatureUploadId": null,
            "photoUploadId": null,
            "photoUploadIds": null,
            "firstLocation": [],
            "lastLocation": [],
            "unavailableAttachments": []
        },
        "commConfig": {
            "doProxy": false
        },
        "pickupTask": false,
        "notes": "",
        "feedback": [],
        "overrides": {},
        "computed": {
            "arrival": {
                "location": []
            },
            "departure": {
                "location": []
            },
            "firstLocation": [],
            "lastLocation": []
        },
        "quantity": 0,
        "additionalQuantities": {
            "quantityA": 0,
            "quantityB": 0,
            "quantityC": 0
        },
        "serviceTime": 0,
        "lastModifiedBy": "jj4cMt7V~DjloxnuCql6nfTE",
        "isFulfilled": false,
        "attachments": [],
        "recipientFirstViewedTime": null,
        "recipientFeedbackTime": null,
        "startTime": null,
        "estimatedCompletionTime": null,
        "identity": {
            "failedScanCount": 0,
            "checksum": null
        },
        "completionPreference": -1,
        "optimizationId": null,
        "appearance": {
            "triangleColor": null
        },
        "assignmentHistory": [],
        "isSelfAssigned": false,
        "isSelfAssignable": false,
        "container": {
            "type": "ORGANIZATION",
            "organization": "nYrkNP6jZMSKgBwG9qG7ci3J"
        },
        "customFields": [],
        "metadata": [],
        "recipients": [],
        "delayTime": null,
        "estimatedArrivalTime": null,
        "destination": {
            "id": "8Xvp2s*GjyAoamOFAltZgGhQ",
            "timeCreated": 1710531703000,
            "timeLastModified": 1710531703733,
            "location": [
                -118.2399583,
                34.073851
            ],
            "address": {
                "apartment": "",
                "state": "California",
                "postalCode": "90012",
                "number": "1000",
                "street": "Vin Scully Ave",
                "city": "Los Angeles",
                "country": "United States"
            },
            "notes": "",
            "organization": "turZSLp9A6EaksJO3bWZYtdd",
            "wasGeocoded": true,
            "createdByLocation": false,
            "googlePlaceId": null,
            "useGPS": false
        }
    },
    "organization": "turZSLp9A6EaksJO3bWZYtdd",
    "shortId": "247612e8"
}

📘

Pairing

The Order creation is a One-to-One relation, as in one pickup task and one dropoff task. It will not be used for One-to-Many. If multiple dropoff task objects are provided, the last one in the payload will be considered.