Clone Orders

To clone an order using ids

Clone Order: Clients can clone orders using the original order id only if no rates/services are set up for them. The Couriers cannot clone orders on behalf of the clients by using their own API key. When an order is cloned, the following fields differ from the original order:

Auto-generated fields: Each cloned order and its associated tasks receive new system-generated values for:
id, shortId, orderShortId, trackingURL, destination.id
Additionally, the dependencies array in the dropoff task is updated to reference the newly generated pickup task ID.

Timestamps:timeCreated and timeLastModified reflect the time the clone was created, not the original order.

Completion windows: completeAfter and completeBefore are not carried over.
Both fields will be null in the cloned order and must be set manually if needed.

Rates and pricing: The following fields are not inherited:
price, currency, priceBreakdown, deliveryService (will be null)
If pricing is required, it must be recalculated and applied after cloning.

Other differences: scanOnlyRequiredBarcodes is present in the original order but omitted from the cloned order response.
This is for cloning a completed or existing order. This will be a direct copy of the pickup/dropoff pair. You will need the original order id.

Example request:

curl -i -X POST "https://onfleet.com/api/v2/taskOrders/d2N*68bTBAM6Rd6txuWdH9Xj/clone" \
     -u "<your_api_key>:"

Example response:

{
    "id": "ccO53C3AjIMHYua2WnukMTPC",
    "timeCreated": 1710373740000,
    "timeLastModified": 1710373740770,
    "source": "api",
    "events": [],
    "pickupTask": {
        "id": "3ABOHAE0dcK64r3m4gUDQE~J",
        "timeCreated": 1710373740000,
        "timeLastModified": 1710373740500,
        "organization": "turZSLp9A6EaksJO3bWZYtdd",
        "shortId": "e79c02d2",
        "trackingURL": "https://onf.lt/e79c02d2",
        "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": "ZuPy7AfzJmSnioIzJ4y2h6zd",
            "timeCreated": 1710373728000,
            "timeLastModified": 1710373728380,
            "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": "nA*e2O3T3Zx16QtaBK0gNvAb",
        "timeCreated": 1710373740000,
        "timeLastModified": 1710373740690,
        "organization": "turZSLp9A6EaksJO3bWZYtdd",
        "shortId": "6dc152fa",
        "trackingURL": "https://onf.lt/6dc152fa",
        "worker": null,
        "merchant": "turZSLp9A6EaksJO3bWZYtdd",
        "executor": "nYrkNP6jZMSKgBwG9qG7ci3J",
        "creator": "jj4cMt7V~DjloxnuCql6nfTE",
        "isActive": false,
        "dependencies": [
            "3ABOHAE0dcK64r3m4gUDQE~J"
        ],
        "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": "plFaHUiEf4BgNPUlgm1q77iB",
            "timeCreated": 1710373728000,
            "timeLastModified": 1710373728780,
            "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": "e79c02d2"
}