This is strictly a POST request
A Cost Line Item shows how much an order is being charge/cost to the client by each Cost Line item; for more information please see this Support Article: https://support.onfleet.com/hc/en-us/articles/42949007217812-Managing-Cost-Adjustments
POST is used to Add or Update an Cost Line Item, the base URL is https://onfleet.com/api/v2/taskOrders/:orderId/lineItems
Any newly created Order will have a new priceBreakdown object:
| Name | Type | Description |
|---|---|---|
| id | string | The Id of the Cost line item. |
| name | string | The Name of the Cost line item. |
| ratingType | string | Type of the Cost line item; this can be distance, piece, minPrice or custom. |
| isBaseRate | boolean | This show is the Cost line item is a base rate or not. |
| cost | number | The actual cost in dollar |
Using the API to manipulate Cost Line Item, the following fields apply:
| Name | Type | Description |
|---|---|---|
| lineItem | array of objects | Top level array of the line item object. |
To add or update an Cost line item to the order, the following fields describes the lineItem object:
| Name | Type | Description |
|---|---|---|
| id | string | This is only used for updating an Cost Line item. |
| name | string | This is only used for adding an Cost Line item. When referenced together with id, this field will be ignored. |
| cost | number | The actual cost in dollar. |
The
eventsfieldThe
eventsfield of the response will keep a log of what have been updated and created for this order to create a trail of receipts. Available values includeadd,updateandremove
Updating
lineItemsfieldWhen updating the
lineItemsfield, if there is custom Cost Line Item(s), make sure every Custom Line Items are included in the array as an complete Object, otherwise any missingratingType:"custom"Cost Line Items will be removed from thelineItemsfield.
Example Requests payloads:
{
"lineItems": [
{ "name": "New Item", "cost": 15 }
]
}{
"lineItems": [
{ "id": "vR**3BhYFlnBaz16*XrbWw9*", "name": "Flat rate", "cost": 510 }
]
}{
"lineItems": [
{
"cost": 30,"name": "New Custom Price","id": "oPwH4ANIu9UMmfyZzUSAPnxi"
}
]
}Example Responses:
{
"id": "nvwLDHbA1bPMMVzUYmWIesJH",
"shortId": "83a9e6f0",
"timeCreated": 1779756849000,
"timeLastModified": 1779760071272,
"pickupTime": null,
"dropoffTime": null,
"source": "courier-dashboard",
"events": [
{
"event": "priceBreakdownOverride",
"time": 1779759838835,
"data": {
"active": true,
"adminId": "vjw*RDMKDljKVDve1Vtcplgu",
"action": "update",
"itemId": "vR**3BhYFlnBaz16*XrbWw9*",
"prop": "cost",
"oldValue": 420,
"newValue": 510
}
},
{
"event": "priceBreakdownOverride",
"time": 1779760071271,
"data": {
"active": true,
"adminId": "vjw*RDMKDljKVDve1Vtcplgu",
"action": "add",
"itemId": "oPwH4ANIu9UMmfyZzUSAPnxi",
"name": "New Item",
"cost": 15
}
}
],
"notes": {},
"organization": "turZSLp9A6EaksJO3bWZYtdd",
"deliveryService": "AV8tKfGdlMIhA7oTdqaQzEdQ",
"orchestrationDetails": null,
"price": 174,
"priceBreakdown": [
{
"name": "Flat rate",
"ratingType": "flat",
"isBaseRate": true,
"cost": 510,
"id": "vR**3BhYFlnBaz16*XrbWw9*"
},
{
"name": "Max. price discount",
"ratingType": "maxPrice",
"isBaseRate": false,
"cost": -351,
"id": "XPEAMC6~dUc69Rve5Nv~w6xH"
},
{
"name": "New Item",
"ratingType": "custom",
"isBaseRate": false,
"cost": 15,
"id": "oPwH4ANIu9UMmfyZzUSAPnxi"
}
],
"currency": "USD",
"deliveryServiceInvoice": null,
"status": "unassigned"
}{
"id": "nvwLDHbA1bPMMVzUYmWIesJH",
"shortId": "83a9e6f0",
"timeCreated": 1779756849000,
"timeLastModified": 1779760071272,
"pickupTime": null,
"dropoffTime": null,
"source": "courier-dashboard",
"events": [
{
"event": "priceBreakdownOverride",
"time": 1779759838835,
"data": {
"active": true,
"adminId": "vjw*RDMKDljKVDve1Vtcplgu",
"action": "update",
"itemId": "vR**3BhYFlnBaz16*XrbWw9*",
"prop": "cost",
"oldValue": 420,
"newValue": 510
}
}
],
"notes": {},
"organization": "turZSLp9A6EaksJO3bWZYtdd",
"deliveryService": "AV8tKfGdlMIhA7oTdqaQzEdQ",
"orchestrationDetails": null,
"price": 174,
"priceBreakdown": [
{
"name": "Flat rate",
"ratingType": "flat",
"isBaseRate": true,
"cost": 510,
"id": "vR**3BhYFlnBaz16*XrbWw9*"
},
{
"name": "Max. price discount",
"ratingType": "maxPrice",
"isBaseRate": false,
"cost": -351,
"id": "XPEAMC6~dUc69Rve5Nv~w6xH"
}
],
"currency": "USD",
"deliveryServiceInvoice": null,
"status": "unassigned"
}{
"id": "nvwLDHbA1bPMMVzUYmWIesJH",
"shortId": "83a9e6f0",
"timeCreated": 1779756849000,
"timeLastModified": 1779843263745,
"pickupTime": null,
"dropoffTime": null,
"source": "courier-dashboard",
"events": [
{
"event": "priceBreakdownOverride",
"time": 1779759838835,
"data": {
"active": true,
"adminId": "vjw*RDMKDljKVDve1Vtcplgu",
"action": "update",
"itemId": "vR**3BhYFlnBaz16*XrbWw9*",
"prop": "cost",
"oldValue": 420,
"newValue": 510
}
},
{
"event": "priceBreakdownOverride",
"time": 1779842563909,
"data": {
"active": true,
"adminId": "vjw*RDMKDljKVDve1Vtcplgu",
"action": "update",
"itemId": "vR**3BhYFlnBaz16*XrbWw9*",
"prop": "cost",
"oldValue": 510,
"newValue": 120
}
},
{
"event": "priceBreakdownOverride",
"time": 1779843246843,
"data": {
"active": true,
"adminId": "vjw*RDMKDljKVDve1Vtcplgu",
"action": "add",
"itemId": "oPwH4ANIu9UMmfyZzUSAPnxi",
"name": "New Custom Price",
"cost": 15
}
},
{
"event": "priceBreakdownOverride",
"time": 1779843263744,
"data": {
"active": true,
"adminId": "vjw*RDMKDljKVDve1Vtcplgu",
"action": "update",
"itemId": "oPwH4ANIu9UMmfyZzUSAPnxi",
"prop": "cost",
"oldValue": 15,
"newValue": 30
}
}
],
"notes": {},
"organization": "turZSLp9A6EaksJO3bWZYtdd",
"deliveryService": "AV8tKfGdlMIhA7oTdqaQzEdQ",
"orchestrationDetails": null,
"price": -201,
"priceBreakdown": [
{
"name": "Flat rate",
"ratingType": "flat",
"isBaseRate": true,
"cost": 120,
"id": "vR**3BhYFlnBaz16*XrbWw9*"
},
{
"name": "Max. price discount",
"ratingType": "maxPrice",
"isBaseRate": false,
"cost": -351,
"id": "XPEAMC6~dUc69Rve5Nv~w6xH"
},
{
"name": "New Custom Price",
"ratingType": "custom",
"isBaseRate": false,
"cost": 30,
"id": "NS5LICIkUf~xTwliGn3qQ0tp"
}
],
"currency": "USD",
"deliveryServiceInvoice": null,
"status": "unassigned"
}