Skip to navigation

Track service requests

Find the service request items that Deel IT services create, such as a delivery or a collection, and follow their status and courier tracking until the service ends. In the Deel app, the IT Logistics Tracker shows the same items as cards on a kanban board.

The service request item endpoints are in Beta and require the X-Beta: true header. See API versioning.

Prerequisites

Treat the token like a password. Store it in an environment variable or a secrets manager, never in source code.

Track service requests

1

Find the service request items that are in progress

Filter the list by statuses, and repeat the key once per value. See GET /it/service-request-items for every field.

curl --request GET 'https://api.letsdeel.com/rest/it/service-request-items?statuses=REQUESTED&statuses=PROCESSING&statuses=COURIER_BOOKED&statuses=WITH_COURIER&statuses=UNDER_INSPECTION' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'X-Beta: true'

When has_more is true, pass the next_cursor value as the cursor query parameter on the next request. Read every page before you group the items.

Items with the same type and grouping_key belong to one service request, which the IT Logistics Tracker shows as one card.

To find the items of a service you created, filter by the ID you already have:

  • For a service for an asset, add asset_id. This is the asset_id in the path of the call that created the service, such as POST /it/assets/{asset_id}/deliver. Each item returns it as asset.id.
  • For an order, add grouping_key with the id of the order from POST /it/orders, and types=ORDER: ?grouping_key=9c2c387f-6c90-499a-85fb-0216fa7bb7a4&types=ORDER. The list returns an order’s items once they are approved, and the asset of an order item is null until the ordered device is scanned.

Take the type and grouping_key of the service request you want to follow. You need them in the next step.

2

List the items of one service request

Filter the list by grouping_key and types together.

curl --request GET 'https://api.letsdeel.com/rest/it/service-request-items?grouping_key=f2d65f28-4d70-47cc-a3ce-a36b6d385ba8&types=DELIVERY' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'X-Beta: true'

Save the id of each item. You need it in the next step. The id stays the same for the life of the item, while its grouping_key and type can change, for example when a shipment is booked.

3

Check an item's status and courier tracking

Replace {service_request_item_id} with the id of an item from the previous response. See GET /it/service-request-items/{service_request_item_id} for every field.

curl --request GET 'https://api.letsdeel.com/rest/it/service-request-items/{service_request_item_id}' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'X-Beta: true'

The service has ended when status is COMPLETED, DECLINED, or CANCELED. Every other status means it is still in progress.

shipment is null until a shipment exists for the item. Its tracking_link and courier_reference are null until the courier provides them.

Deel sends the it-asset.location-updated webhook when the location of an asset changes, for example when the courier picks it up and when it arrives. Match the event to the item by asset.id, then retrieve the item. For an order, Deel sends the it-order.updated webhook when the order is updated. Match the event to the order’s items by the order id, which is their grouping_key. See Webhooks for how to register an endpoint and verify signatures.

For a service that isn’t an order, these changes send no event: a booked courier, a new tracking link, a cancellation, and the end of an inspection. Retrieve the item when you need its current state.

Verify the result

Retrieve the item after the delivery arrives. An item that Deel collects can be UNDER_INSPECTION after it arrives, and is COMPLETED when the inspection ends.

curl --request GET 'https://api.letsdeel.com/rest/it/service-request-items/{service_request_item_id}' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'X-Beta: true'

status is COMPLETED and shipment.status is DELIVERED.

Handle errors

StatusCauseFix
400 Bad RequestThe request is missing the X-Beta: true header.Add the header. See API versioning.
400 Bad Requestasset_id, grouping_key, or service_request_item_id isn’t a UUID, or a types or statuses value isn’t one the endpoint accepts.Send a UUID, and use the values listed in GET /it/service-request-items.
403 ForbiddenThe token is missing the it-service-requests:read scope.Create a token with that scope. See Authentication.
404 Not FoundNo service request item in your organization has that id.Find the id with GET /it/service-request-items.

Next steps