{"openapi":"3.1.0","info":{"title":"TrackParcel API","version":"1.0.0","description":"The Business API (/shipments and /webhooks: organisation keys, and tracking API keys linked to a workspace) and the tracking API (/track, tracking API keys). Send your key in the x-api-key header. Every answer is private to the key (Cache-Control: private, no-store). Times are ISO 8601 in IST (+05:30); tracking numbers are always given in full. No Business API call looks a courier up live: TrackParcel checks shipments on its own schedule."},"servers":[{"url":"https://www.trackparcel.in/api/v1"}],"security":[{"apiKey":[]}],"tags":[{"name":"Shipments","description":"The Business API, for automatic tracking: an organisation key from the workspace's Developers page, or a tracking API key TrackParcel has linked to the workspace (every scope; a paid key's calls are the same monthly allowance as its lookups)."},{"name":"Webhooks","description":"Webhook endpoints, with an organisation key that has webhooks:manage or a tracking API key linked to the workspace. Endpoints are turned off, never deleted. Customer contact fields are changed in the app only."},{"name":"Tracking","description":"One-off tracking lookups with a tracking API key."}],"paths":{"/shipments":{"get":{"operationId":"listShipments","summary":"List shipments","description":"Most recently updated first (updated_at desc, id desc). Pass next_cursor back as cursor for the next page.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:read","parameters":[{"name":"status","in":"query","description":"Comma-separated statuses.","schema":{"type":"string"},"example":"in_transit,out_for_delivery"},{"name":"courier","in":"query","schema":{"type":"string"}},{"name":"tag","in":"query","schema":{"type":"string","maxLength":32}},{"name":"exception","in":"query","description":"Comma-separated exception types, or any.","schema":{"type":"string"}},{"name":"archived","in":"query","schema":{"type":"string","enum":["false","true","all"],"default":"false"}},{"name":"updated_since","in":"query","description":"An ISO 8601 time; one without its zone is read in IST, and a date alone from 00:00 IST.","schema":{"type":"string","format":"date-time"}},{"name":"search","in":"query","description":"Tracking number, order id, label, customer name or mobile.","schema":{"type":"string","maxLength":100}},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of shipments.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/Shipment"}},"next_cursor":{"type":["string","null"]}},"required":["success","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}},"post":{"operationId":"addShipments","summary":"Add shipments","description":"1–100 items. Each comes back created (perhaps waiting for room: tracking_state waiting), existing, restored or invalid. Each shipment created or restored uses one API call, and a request uses at least one; one already there, or invalid, costs nothing more. When the calls run out partway through, the items past them aren't added and come back invalid with quota_exceeded, in the 200. The daily add cap and the waiting backlog are invalid items with daily_add_limit or plan_backlog_full. With an Idempotency-Key, the same key and body within 24 hours answers the same results again (Idempotent-Replayed: true, not counted again); another body, or the first request still running, is 409 idempotency_conflict. A replay is refused with 429 quota_exceeded once the period's API calls are used up. The body may be at most 512 KB.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:write","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"shipments":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/NewShipment"}}},"required":["shipments"]}}}},"responses":{"200":{"description":"What each item became, in the order sent.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"},"Idempotent-Replayed":{"description":"true on a replayed answer.","schema":{"type":"string","const":"true"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/AddResult"}}},"required":["success","results"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}},"delete":{"operationId":"deleteShipments","summary":"Not allowed: shipments are archived, never deleted","description":"Always 405 archive_only, for any key and any id, without looking anything up. Use POST /shipments/{id}/archive.","tags":["Shipments"],"x-required-scope":null,"responses":{"405":{"description":"Shipments can be archived, not deleted.","headers":{"Allow":{"schema":{"type":"string","const":"GET, POST"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"success":false,"error":{"code":"archive_only","message":"Shipments can be archived, not deleted"}}}}}}}},"/shipments/{id}":{"get":{"operationId":"getShipment","summary":"Get a shipment","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:read","parameters":[{"$ref":"#/components/parameters/ShipmentId"}],"responses":{"200":{"description":"The shipment.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"$ref":"#/components/schemas/Shipment"}},"required":["success","data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}},"patch":{"operationId":"updateShipment","summary":"Update a shipment","description":"label, order_id, tags, customer (fields given replace the stored ones; null clears) and courier (rechecked on the new courier). The tracking number can't be changed.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:write","parameters":[{"$ref":"#/components/parameters/ShipmentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShipmentPatch"}}}},"responses":{"200":{"description":"The updated shipment.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"$ref":"#/components/schemas/Shipment"}},"required":["success","data"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}},"delete":{"operationId":"deleteShipment","summary":"Not allowed: shipments are archived, never deleted","description":"Always 405 archive_only, for any key and any id, without looking anything up. Use POST /shipments/{id}/archive.","tags":["Shipments"],"x-required-scope":null,"parameters":[{"$ref":"#/components/parameters/ShipmentId"}],"responses":{"405":{"description":"Shipments can be archived, not deleted.","headers":{"Allow":{"schema":{"type":"string","const":"GET, PATCH"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"success":false,"error":{"code":"archive_only","message":"Shipments can be archived, not deleted"}}}}}}}},"/shipments/{id}/archive":{"post":{"operationId":"archiveShipment","summary":"Archive a shipment","description":"It stops being checked and leaves the active count. Nothing is deleted.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:write","parameters":[{"$ref":"#/components/parameters/ShipmentId"}],"responses":{"200":{"description":"The archived shipment.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"$ref":"#/components/schemas/Shipment"}},"required":["success","data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/shipments/{id}/unarchive":{"post":{"operationId":"unarchiveShipment","summary":"Restore an archived shipment","description":"Checked again when the plan has room; otherwise it waits and starts by itself, oldest first. While the plan's waiting backlog is full it stays archived: 422 plan_backlog_full. One moved to another workspace stays archived here: 409 conflict.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:write","parameters":[{"$ref":"#/components/parameters/ShipmentId"}],"responses":{"200":{"description":"The restored shipment.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"$ref":"#/components/schemas/Shipment"}},"required":["success","data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/shipments/{id}/events":{"get":{"operationId":"listShipmentEvents","summary":"A shipment's courier events","description":"Newest first. next_cursor names the page's last event, so courier scans that arrive while you page never repeat or skip one; a cursor that isn't ours, or is another shipment's, is 400 validation_error. A sample shipment returns its sample timeline.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:read","parameters":[{"$ref":"#/components/parameters/ShipmentId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of events.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"next_cursor":{"type":["string","null"]}},"required":["success","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/shipments/{id}/refresh":{"post":{"operationId":"refreshShipment","summary":"Ask for a shipment to be checked again","description":"Queues a check; it never looks the courier up in the request. Uses one of the workspace's manual refreshes for the IST day (429 quota_exceeded when used up, with retry_after_seconds and Retry-After to midnight IST, when they come back); one request per shipment per 10 minutes (429 rate_limited with retry_after_seconds). While the courier can't be read, or TrackParcel has paused its checks, a shipment being checked is queued, not charged, and courier_unavailable is true; while its checks are paused, asking again within the 10 minutes isn't rate_limited either. A shipment whose tracking has finished (delivered, returned or cancelled) is 409 conflict, not charged. A shipment waiting for room in the plan (tracking_state waiting) is 403 plan_limit_reached; one archived, or on a courier TrackParcel has switched off (tracking_state carrier_paused: saved, started from waiting or moved there while it is off), is 409 conflict; neither is charged. A sample number is 422 invalid_tracking_number.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:write","parameters":[{"$ref":"#/components/parameters/ShipmentId"}],"responses":{"202":{"description":"Queued.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"queued":{"const":true},"next_check_at":{"type":"string","format":"date-time"},"courier_unavailable":{"type":"boolean"}},"required":["success","queued","next_check_at"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/shipments/lookup":{"get":{"operationId":"lookupShipments","summary":"Find shipments by tracking number","description":"The workspace's shipments of one tracking number (normalised first), newest first, archived ones included. 404 not_found when it has none; when it has the number only from before the plan's history window, the message says so.","tags":["Shipments"],"security":[{"apiKey":[]}],"x-required-scope":"shipments:read","parameters":[{"name":"tracking_number","in":"query","required":true,"schema":{"type":"string"}},{"name":"courier","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"The matching shipments.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/Shipment"}}},"required":["success","data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhook endpoints","description":"The workspace's endpoints, oldest first. Secrets are never listed.","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","responses":{"200":{"description":"The endpoints.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["success","data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}},"post":{"operationId":"createWebhook","summary":"Add a webhook endpoint","description":"The URL must be https, on port 443 or 8443, and resolve to a public address (422 invalid_url names the rule). The plan's endpoint count and shipment.event_added (Growth and above) are 403 plan_limit_reached; include_contact_fields true is 403 contact_fields_app_only (turn them on in the app). The secret is in this answer, the only API response that carries it; Reveal secret in the app (Developers → Webhooks) shows it again. The workspace's Owners get a notice in the app naming the key.","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreate"}}}},"responses":{"201":{"description":"The new endpoint and its signing secret (Reveal secret in the app shows it again).","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"$ref":"#/components/schemas/Webhook"},"secret":{"$ref":"#/components/schemas/WebhookSecret"}},"required":["success","data","secret"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/webhooks/{id}":{"get":{"operationId":"getWebhook","summary":"Get a webhook endpoint","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","parameters":[{"$ref":"#/components/parameters/WebhookId"}],"responses":{"200":{"description":"The endpoint.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"$ref":"#/components/schemas/Webhook"}},"required":["success","data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}},"patch":{"operationId":"updateWebhook","summary":"Update a webhook endpoint","description":"url (checked as on create; the Owners get a notice in the app), description, events and status (active or disabled_user). Turning back on an endpoint TrackParcel or a workspace closure turned off is 403 endpoint_admin_disabled; turning one on beyond the plan's count is 403 plan_limit_reached. include_contact_fields is 403 contact_fields_app_only.","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","parameters":[{"$ref":"#/components/parameters/WebhookId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPatch"}}}},"responses":{"200":{"description":"The updated endpoint.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"$ref":"#/components/schemas/Webhook"}},"required":["success","data"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/webhooks/{id}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","summary":"Rotate a webhook endpoint's signing secret","description":"A new secret, in this answer; Reveal secret in the app (Developers → Webhooks) shows it again. The previous one keeps working until prev_valid_until (24 hours), and each webhook carries a v1 signature for both until then. Another rotation inside those 24 hours is 409 rotation_in_progress.","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","parameters":[{"$ref":"#/components/parameters/WebhookId"}],"responses":{"200":{"description":"The new secret.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"secret":{"$ref":"#/components/schemas/WebhookSecret"},"prev_valid_until":{"type":"string","format":"date-time"}},"required":["success","secret","prev_valid_until"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/webhooks/{id}/test":{"post":{"operationId":"testWebhook","summary":"Send a test event","description":"Sends a webhook.test event to the endpoint now, once, and answers with what happened. 10 an hour per endpoint (429 rate_limited); an endpoint that is off is 409 endpoint_disabled.","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","parameters":[{"$ref":"#/components/parameters/WebhookId"}],"responses":{"200":{"description":"The test's result.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"result":{"$ref":"#/components/schemas/WebhookTestResult"}},"required":["success","result"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/webhooks/{id}/deliveries":{"get":{"operationId":"listWebhookDeliveries","summary":"A webhook endpoint's deliveries","description":"Newest first, each with every attempt. Pass next_cursor back as cursor for the next page.","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","parameters":[{"$ref":"#/components/parameters/WebhookId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of deliveries.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"next_cursor":{"type":["string","null"]}},"required":["success","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/webhooks/{id}/deliveries/{deliveryId}/replay":{"post":{"operationId":"replayWebhookDelivery","summary":"Replay a delivery","description":"Queues the delivery's stored payload again, byte for byte, as a new delivery. An endpoint that is off is 409 endpoint_disabled; a test delivery is never replayed (409 conflict).","tags":["Webhooks"],"security":[{"apiKey":[]}],"x-required-scope":"webhooks:manage","parameters":[{"$ref":"#/components/parameters/WebhookId"},{"$ref":"#/components/parameters/DeliveryId"}],"responses":{"202":{"description":"Queued.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"const":true},"delivery_id":{"type":"string","pattern":"^dlv_[0-9A-HJKMNP-TV-Z]{26}$"}},"required":["success","delivery_id"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/usage":{"get":{"operationId":"getUsage","summary":"Your key's usage","description":"Any key; never counted, 30 requests a minute per key, and for an organisation key 30 a minute per workspace too. For an organisation key the top-level plan, rateLimitPerMinute, monthlyCallQuota, used, remaining and resetsAt are its workspace's Business API: the plan, the per-minute limit the key meets, and the usage period's calls. One the Business API would take (not paused, expired or archived, of a workspace that isn't suspended or closed) also gets its workspace's usage in business. Errors before the key is known keep the older shape; an organisation key's 429 and 503 are the Business API's.","tags":["Shipments","Tracking"],"security":[{"apiKey":[]}],"x-required-scope":null,"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"401":{"$ref":"#/components/responses/LegacyError"},"429":{"$ref":"#/components/responses/UsageError"},"503":{"$ref":"#/components/responses/UsageError"}}}},"/track":{"get":{"operationId":"track","summary":"Look a tracking number up now (tracking API keys)","description":"Looks the number up with the carrier now: every call reads the carrier, never a cached answer or an earlier status, so fromCache is false, cachedAt null and cacheExpiresIn 0; when the carrier can't be read the answer is its 503 CARRIER_UNAVAILABLE, 504 TIMEOUT or 429 UPSTREAM_RATE_LIMITED, not charged. data.tracking_details lists the scans newest first; one marked retained: true is an earlier scan the carrier no longer lists, read on an earlier lookup of the number, after the ones it does list. carrier is optional: left out, or carrier=auto, the carrier is named from the number's format, the answer carries autoDetected: true, and its 404 NOT_FOUND is not charged; a number whose format names no single carrier is 400 CARRIER_REQUIRED with candidates [{courier, carrier, confidence}], and a shopping app's order number is 400 NOT_A_TRACKING_NUMBER, neither charged. A 404 NOT_FOUND for a number that doesn't fit the carrier's format, refused without asking the carrier, is not charged either. An organisation key gets 403 SCOPE_MISSING. Errors use the older shape {success:false, error:CODE, message}.","tags":["Tracking"],"security":[{"apiKey":[]}],"x-required-scope":null,"parameters":[{"name":"awb","in":"query","required":true,"schema":{"type":"string","maxLength":50}},{"name":"carrier","in":"query","required":false,"description":"A supported carrier's name or id; left out, or auto, to have it named from the number's format.","schema":{"type":"string"}}],"responses":{"200":{"description":"The tracking result.","headers":{"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XTrackQuotaReset"}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/LegacyError"},"401":{"$ref":"#/components/responses/LegacyError"},"403":{"$ref":"#/components/responses/LegacyError"},"404":{"$ref":"#/components/responses/LegacyError"},"422":{"$ref":"#/components/responses/LegacyError"},"429":{"$ref":"#/components/responses/LegacyError"},"500":{"$ref":"#/components/responses/LegacyError"},"503":{"$ref":"#/components/responses/LegacyError"},"504":{"$ref":"#/components/responses/LegacyError"}}}}},"webhooks":{"shipmentEvent":{"post":{"operationId":"receiveWebhook","summary":"A webhook TrackParcel sends to your endpoint","description":"A POST of the event as JSON. Check TrackParcel-Signature before trusting it: t is the Unix time, and each v1 is hex(HMAC-SHA256(secret, t + \".\" + raw body)) keyed with your whole secret (whsec_…); two v1 values follow a rotation for 24 hours. Reject a t more than 300 seconds from your clock. Answer any 2xx within 10 seconds; otherwise it is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours (8 attempts). Redirects are not followed. TrackParcel-Event-Id stays the same on every attempt and replay: use it to skip repeats.","tags":["Webhooks"],"parameters":[{"name":"TrackParcel-Event-Id","in":"header","required":true,"schema":{"type":"string","pattern":"^evt_[0-9A-HJKMNP-TV-Z]{26}$"}},{"name":"TrackParcel-Delivery-Id","in":"header","required":true,"schema":{"type":"string","pattern":"^dlv_[0-9A-HJKMNP-TV-Z]{26}$"}},{"name":"TrackParcel-Timestamp","in":"header","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"name":"TrackParcel-Signature","in":"header","required":true,"schema":{"type":"string"},"example":"t=1760245933,v1=5257a869e7ec…"},{"name":"User-Agent","in":"header","schema":{"type":"string","const":"TrackParcel-Webhooks/1.0"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds marks the delivery done."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"parameters":{"ShipmentId":{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"WebhookId":{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"DeliveryId":{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string","pattern":"^dlv_[0-9A-HJKMNP-TV-Z]{26}$"}},"Limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},"Cursor":{"name":"cursor","in":"query","description":"next_cursor from the previous page.","schema":{"type":"string"}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","description":"Recommended. 1–255 printable ASCII characters, remembered for 24 hours per key.","schema":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[\\x20-\\x7e]+$"}}},"headers":{"XQuotaLimit":{"description":"API calls this usage period, or unlimited.","schema":{"type":"string"}},"XQuotaUsed":{"description":"API calls used this period.","schema":{"type":"string"}},"XQuotaReset":{"description":"When the calls reset (ISO 8601, IST): the period's end, or a linked tracking API key's monthly anniversary when the workspace's calls are that key's (GET /usage's callsFromApiKey).","schema":{"type":"string"}},"XTrackQuotaReset":{"description":"Seconds until this key's monthly calls reset, on its creation-date anniversary (/track).","schema":{"type":"string","pattern":"^[0-9]+$"}},"RetryAfter":{"description":"Seconds to wait before retrying.","schema":{"type":"string"}}},"responses":{"BadRequest":{"description":"invalid_json or validation_error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"missing_api_key or invalid_api_key (unknown or archived).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"scope_missing (a tracking API key not linked to a workspace, or a missing scope), api_key_paused, api_key_expired, plan_limit_reached (Free, beyond the plan, or a refresh of a shipment waiting for room in it), workspace_unavailable, contact_fields_app_only or endpoint_admin_disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"not_found, including another workspace's ids. A read (the list aside) of a shipment added before the plan's history window is not_found too, its message saying so.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"idempotency_conflict, conflict, rotation_in_progress or endpoint_disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unprocessable":{"description":"invalid_tracking_number, courier_required, unknown_courier, validation_error or invalid_url (the message names the rule).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"rate_limited (per workspace per minute, its keys together: Starter 30, Growth 60, Pro 120 by the plan, more where a paid tracking API key linked to the workspace allows more, or the number TrackParcel has set for the workspace or for one key, where 0 refuses every call; GET /usage's rateLimitPerMinute is the one your key meets; and a key refused more than 60 times in a minute (for its scope, its workspace or its plan, or for a limit of 0) is answered rate_limited until that minute is up) or quota_exceeded (API calls per usage period, raised or set the same way, or a linked paid tracking API key's month, which its lookups spend too; GET /usage's monthlyCallQuota; on POST /shipments/{id}/refresh, the workspace's manual refreshes for the IST day, which come back at midnight IST).","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"},"X-Quota-Limit":{"$ref":"#/components/headers/XQuotaLimit"},"X-Quota-Used":{"$ref":"#/components/headers/XQuotaUsed"},"X-Quota-Reset":{"$ref":"#/components/headers/XQuotaReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"internal_error: something unexpected went wrong on our side. Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unavailable":{"description":"unavailable: retry after Retry-After.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"LegacyError":{"description":"The /track and /usage error shape.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"UsageError":{"description":"The older shape for a tracking API key; the Business API's for an organisation key (rate_limited, unavailable).","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/LegacyError"},{"$ref":"#/components/schemas/Error"}]}}}}},"schemas":{"LegacyError":{"type":"object","properties":{"success":{"const":false},"error":{"type":"string"},"message":{"type":"string"}},"required":["success","error"]},"Error":{"type":"object","properties":{"success":{"const":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_json","validation_error","missing_api_key","invalid_api_key","api_key_paused","api_key_expired","scope_missing","role_forbidden","plan_limit_reached","workspace_unavailable","not_found","archive_only","idempotency_conflict","conflict","invalid_tracking_number","courier_required","unknown_courier","daily_add_limit","plan_backlog_full","rate_limited","quota_exceeded","unavailable","internal_error","contact_fields_app_only","invalid_url","endpoint_disabled","endpoint_admin_disabled","rotation_in_progress"]},"message":{"type":"string"},"retry_after_seconds":{"type":"integer","minimum":1},"field":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"Customer":{"type":"object","properties":{"name":{"type":["string","null"],"maxLength":80},"phone":{"type":["string","null"],"description":"Indian mobile: +91 and 10 digits starting 6–9; stored as E.164."},"email":{"type":["string","null"],"format":"email"},"address":{"type":["string","null"],"maxLength":200},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"pincode":{"type":["string","null"],"pattern":"^[1-9][0-9]{5}$"}}},"Shipment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tracking_number":{"type":"string","description":"Normalised, always in full."},"tracking_number_raw":{"type":"string","description":"As it was sent."},"courier":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"status":{"type":"string","enum":["new","pending_pickup","in_transit","out_for_delivery","failed_attempt","delivered","rto_in_transit","returned","exception","cancelled","not_found","unknown"]},"status_label":{"type":"string"},"status_text":{"type":["string","null"],"description":"The courier's own words."},"tracking_state":{"type":"string","enum":["active","waiting","carrier_paused","stopped"],"description":"The shipment's place in your plan: active (it has one), waiting (for room in the plan), carrier_paused (TrackParcel has paused its courier) or stopped (its courier isn't offered on your plan). Whether TrackParcel still checks its tracking number is stop_reason."},"provisional":{"type":"boolean","description":"True while a final status is still being confirmed."},"stop_reason":{"type":["string","null"],"enum":["delivered","returned","cancelled","not_found","not_picked_up_30d","no_updates_45d","exception_30d","sample",null],"description":"Why TrackParcel stopped checking the shipment's tracking number: delivered, returned or cancelled (its journey ended), not_found, not_picked_up_30d (not picked up for 30 days), no_updates_45d (no update for 45 days), exception_30d (a problem reported for 30 days) or sample. Null unless the number was stopped; a shipment whose tracking_state isn't active, or that is archived, isn't checked either."},"is_sample":{"type":"boolean"},"exceptions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["stuck","failed_attempt","rto","ofd_overdue","late","not_found","delayed_updates"]},"since":{"type":["string","null"],"format":"date-time"}}}},"last_event":{"type":["object","null"],"properties":{"at":{"type":["string","null"],"format":"date-time"},"date_only":{"type":["string","null"],"format":"date","description":"The courier's date when it gave this update a date and no time of day: at is then 00:00 of that date in the courier's time zone, there to sort by, not a time the courier gave. Null when it gave a time."},"location":{"type":["string","null"]},"activity":{"type":["string","null"]}}},"eta":{"type":["object","null"],"properties":{"date":{"type":"string","format":"date"},"source":{"type":["string","null"],"enum":["courier","estimate",null]}}},"delivered_at":{"type":["string","null"],"format":"date-time","description":"When the courier says it was delivered. A delivery the courier dated without a time of day takes the time of its delivery scan that day; with none, it is 00:00 of that date in the courier's time zone, not a time the courier gave."},"order_id":{"type":["string","null"]},"label":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"customer":{"oneOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}]},"archived":{"type":"boolean"},"last_checked_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":["string","null"],"format":"date-time"}},"required":["id","tracking_number","courier","status","tracking_state","provisional","stop_reason","archived"]},"NewShipment":{"type":"object","additionalProperties":false,"properties":{"tracking_number":{"type":"string"},"courier":{"type":"string","description":"Optional: detected from the number when left out."},"order_id":{"type":"string","maxLength":64},"label":{"type":"string","maxLength":80},"tags":{"type":"array","maxItems":10,"items":{"type":"string","maxLength":32}},"customer":{"type":"object","additionalProperties":false,"properties":{"name":{"type":["string","null"],"maxLength":80},"phone":{"type":["string","null"],"description":"Indian mobile: +91 and 10 digits starting 6–9; stored as E.164."},"email":{"type":["string","null"],"format":"email"},"address":{"type":["string","null"],"maxLength":200},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"pincode":{"type":["string","null"],"pattern":"^[1-9][0-9]{5}$"}}}},"required":["tracking_number"]},"ShipmentPatch":{"type":"object","additionalProperties":false,"properties":{"label":{"type":["string","null"],"maxLength":80},"order_id":{"type":["string","null"],"maxLength":64},"tags":{"type":"array","items":{"type":"string"}},"customer":{"type":["object","null"],"additionalProperties":false,"properties":{"name":{"type":["string","null"],"maxLength":80},"phone":{"type":["string","null"],"description":"Indian mobile: +91 and 10 digits starting 6–9; stored as E.164."},"email":{"type":["string","null"],"format":"email"},"address":{"type":["string","null"],"maxLength":200},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"pincode":{"type":["string","null"],"pattern":"^[1-9][0-9]{5}$"}}},"courier":{"type":"string"}}},"AddResult":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"status":{"type":"string","enum":["created","existing","restored","invalid"]},"shipment":{"$ref":"#/components/schemas/Shipment"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_json","validation_error","missing_api_key","invalid_api_key","api_key_paused","api_key_expired","scope_missing","role_forbidden","plan_limit_reached","workspace_unavailable","not_found","archive_only","idempotency_conflict","conflict","invalid_tracking_number","courier_required","unknown_courier","daily_add_limit","plan_backlog_full","rate_limited","quota_exceeded","unavailable","internal_error","contact_fields_app_only","invalid_url","endpoint_disabled","endpoint_admin_disabled","rotation_in_progress"]},"message":{"type":"string"},"field":{"type":"string"}},"required":["code","message"]}},"required":["index","status"]},"Event":{"type":"object","properties":{"at":{"type":["string","null"],"format":"date-time"},"date_only":{"type":["string","null"],"format":"date","description":"The courier's date when it gave this update a date and no time of day: at is then 00:00 of that date in the courier's time zone, there to sort by, not a time the courier gave. Null when it gave a time."},"location":{"type":["string","null"]},"activity":{"type":"string"},"remarks":{"type":["string","null"]},"state":{"type":["string","null"],"enum":["new","pending_pickup","in_transit","out_for_delivery","failed_attempt","delivered","rto_in_transit","returned","exception","cancelled","not_found","unknown",null]}},"required":["activity"]},"Usage":{"type":"object","description":"A tracking API key's own figures; for an organisation key, its workspace's Business API.","properties":{"success":{"const":true},"plan":{"type":"string","description":"An organisation key: its workspace's plan."},"paused":{"type":"boolean"},"expired":{"type":"boolean"},"expiresAt":{"type":["string","null"],"format":"date-time"},"rateLimitPerMinute":{"type":"integer","description":"An organisation key: the requests a minute it may make: its workspace's, which all its keys share, unless TrackParcel has set this key a limit of its own."},"monthlyCallQuota":{"type":["integer","null"],"description":"An organisation key: the workspace's API calls per usage period (null: unlimited), or its linked tracking API key's month with its extra calls (callsFromApiKey)."},"extraCalls":{"type":"integer","description":"Always 0 for an organisation key."},"used":{"type":"integer","description":"An organisation key: the workspace's API calls this usage period, or this month of its linked tracking API key's, the key's lookups included."},"remaining":{"type":["integer","null"]},"resetsAt":{"type":"string","format":"date-time","description":"An organisation key: when the usage period ends, or the key's monthly anniversary when the calls are a linked tracking API key's."},"callsFromApiKey":{"type":"integer","description":"An organisation key whose workspace's API calls are a paid tracking API key's: the id of the tracking API key whose month they are. Its lookups on /track and the workspace's Business API requests and the shipments it adds spend the same calls. Absent otherwise."},"totalRequests":{"type":"integer"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"business":{"type":"object","description":"Organisation keys only.","properties":{"period":{"type":"object","properties":{"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"}}},"active_shipments":{"$ref":"#/components/schemas/UsedLimit"},"waiting":{"type":"integer"},"waiting_cap":{"type":["integer","null"]},"adds_today":{"$ref":"#/components/schemas/UsedLimit"},"manual_refreshes_today":{"$ref":"#/components/schemas/UsedLimit"},"api_calls":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":["integer","null"]},"resets_at":{"type":"string","format":"date-time","description":"Present when the calls are a linked tracking API key's month: its anniversary (IST)."},"from_api_key":{"type":"integer","description":"Present when the calls are a linked tracking API key's month: that key's id."}},"required":["used","limit"]}}}}},"UsedLimit":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":["integer","null"]}},"required":["used","limit"]},"WebhookSecret":{"type":"string","pattern":"^whsec_[A-Za-z0-9_-]{43}$","description":"The signing secret. Use the whole string, whsec_ included, as the HMAC key."},"Webhook":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"],"maxLength":200},"events":{"type":"array","items":{"type":"string","enum":["shipment.created","shipment.status_changed","shipment.out_for_delivery","shipment.delivered","shipment.confirmed","shipment.failed_attempt","shipment.exception","shipment.event_added","shipment.archived","shipment.unarchived"]}},"status":{"type":"string","enum":["active","disabled_user","disabled_failures","disabled_admin"]},"disabled_reason":{"type":["string","null"],"enum":["user","failures_100","failures_72h","http_410","admin","org_closed","plan_limit",null],"description":"Why the endpoint is off; null while it is on. user: turned off by you. failures_100, failures_72h, http_410: turned off for failures (PATCH status active turns it back on). plan_limit: beyond the plan's endpoints (it can be turned back on when the plan has room). admin, org_closed: turned off by TrackParcel or a workspace closure (403 endpoint_admin_disabled)."},"include_contact_fields":{"type":"boolean","description":"Whether customers' names, phone numbers, email and address are sent (changed in the app only); otherwise customer is {city}."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"last_success_at":{"type":["string","null"],"format":"date-time"},"last_failure_at":{"type":["string","null"],"format":"date-time"},"consecutive_failures":{"type":"integer","minimum":0},"secret_rotated_at":{"type":["string","null"],"format":"date-time"},"prev_valid_until":{"type":["string","null"],"format":"date-time","description":"Until when the secret before the last rotation was accepted."},"paused_events":{"type":"array","items":{"type":"string","enum":["shipment.created","shipment.status_changed","shipment.out_for_delivery","shipment.delivered","shipment.confirmed","shipment.failed_attempt","shipment.exception","shipment.event_added","shipment.archived","shipment.unarchived"]},"description":"The events in events that the workspace's plan doesn't send: shipment.event_added (every new courier scan) below the Growth plan. The endpoint keeps them, and they are sent again after an upgrade."}},"required":["id","url","events","status","disabled_reason","include_contact_fields","created_at"]},"WebhookCreate":{"type":"object","additionalProperties":false,"properties":{"url":{"type":"string","maxLength":2048,"description":"https, port 443 or 8443, a public address."},"description":{"type":["string","null"],"maxLength":200},"events":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"string","enum":["shipment.created","shipment.status_changed","shipment.out_for_delivery","shipment.delivered","shipment.confirmed","shipment.failed_attempt","shipment.exception","shipment.event_added","shipment.archived","shipment.unarchived"]}},"include_contact_fields":{"type":"boolean","const":false,"description":"Only false: contact fields are turned on in the app."}},"required":["url","events"]},"WebhookPatch":{"type":"object","additionalProperties":false,"properties":{"url":{"type":"string","maxLength":2048},"description":{"type":["string","null"],"maxLength":200},"events":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"string","enum":["shipment.created","shipment.status_changed","shipment.out_for_delivery","shipment.delivered","shipment.confirmed","shipment.failed_attempt","shipment.exception","shipment.event_added","shipment.archived","shipment.unarchived"]}},"status":{"type":"string","enum":["active","disabled_user"]}}},"WebhookTestResult":{"type":"object","properties":{"ok":{"type":"boolean","description":"A 2xx came back."},"status":{"type":["integer","null"]},"ms":{"type":["integer","null"]},"error":{"type":["string","null"]}},"required":["ok","status","ms","error"]},"WebhookAttempt":{"type":"object","properties":{"attempt":{"type":"integer","minimum":1,"maximum":8},"started_at":{"type":["string","null"],"format":"date-time"},"url":{"type":"string"},"response_status":{"type":["integer","null"]},"response_ms":{"type":["integer","null"]},"response_snippet":{"type":["string","null"],"description":"The first 1 KB of the answer, extended to the end of a word so a tracking number is never cut."},"error":{"type":["string","null"]}},"required":["attempt"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","pattern":"^dlv_[0-9A-HJKMNP-TV-Z]{26}$"},"event_id":{"type":"string","pattern":"^evt_[0-9A-HJKMNP-TV-Z]{26}$"},"event_type":{"type":["string","null"],"enum":["shipment.created","shipment.status_changed","shipment.out_for_delivery","shipment.delivered","shipment.confirmed","shipment.failed_attempt","shipment.exception","shipment.event_added","shipment.archived","shipment.unarchived","webhook.test",null]},"status":{"type":"string","enum":["pending","succeeded","failed","abandoned"]},"attempt":{"type":"integer","minimum":0,"maximum":8},"created_at":{"type":["string","null"],"format":"date-time"},"delivered_at":{"type":["string","null"],"format":"date-time"},"response_status":{"type":["integer","null"]},"response_ms":{"type":["integer","null"]},"error":{"type":["string","null"]},"attempts":{"type":"array","items":{"$ref":"#/components/schemas/WebhookAttempt"}}},"required":["id","event_id","status","attempt","attempts"]},"WebhookEvent":{"type":"object","description":"The JSON body of a webhook. It is built once when first sent and every attempt and replay sends the same bytes.","properties":{"id":{"type":"string","pattern":"^evt_[0-9A-HJKMNP-TV-Z]{26}$"},"type":{"type":"string","enum":["shipment.created","shipment.status_changed","shipment.out_for_delivery","shipment.delivered","shipment.confirmed","shipment.failed_attempt","shipment.exception","shipment.event_added","shipment.archived","shipment.unarchived","webhook.test"]},"created_at":{"type":"string","format":"date-time"},"org_id":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"shipment":{"oneOf":[{"$ref":"#/components/schemas/Shipment"},{"type":"null"}],"description":"The shipment as the API shows it when the event happened (null for webhook.test). Without contact fields, customer is {city} only."},"sequence":{"type":["integer","null"],"description":"Rises with each status change of the shipment: use it with created_at to put events back in order."},"provisional":{"type":"boolean","description":"True while a final status (delivered, returned) is still being confirmed; shipment.confirmed follows."},"previous_status":{"type":"string","enum":["new","pending_pickup","in_transit","out_for_delivery","failed_attempt","delivered","rto_in_transit","returned","exception","cancelled","not_found","unknown"],"description":"status_changed, out_for_delivery and delivered."},"status":{"type":"string","enum":["new","pending_pickup","in_transit","out_for_delivery","failed_attempt","delivered","rto_in_transit","returned","exception","cancelled","not_found","unknown"]},"event":{"type":["object","null"],"description":"The courier scan behind the event (status_changed, out_for_delivery, delivered, failed_attempt, event_added). Never the courier's remarks.","properties":{"at":{"type":["string","null"],"format":"date-time"},"date_only":{"type":["string","null"],"format":"date","description":"The courier's date when it gave this update a date and no time of day: at is then 00:00 of that date in the courier's time zone, there to sort by, not a time the courier gave. Null when it gave a time."},"location":{"type":["string","null"]},"activity":{"type":["string","null"]}}},"exception":{"type":"object","description":"shipment.exception: which exception started, and when.","properties":{"type":{"type":"string","enum":["stuck","failed_attempt","rto","ofd_overdue","late","not_found","delayed_updates"]},"since":{"type":["string","null"],"format":"date-time"}}},"attempts":{"type":"integer","description":"shipment.failed_attempt: delivery attempts so far."},"archive_reason":{"type":["string","null"],"description":"shipment.archived."},"source":{"type":"string","description":"shipment.created: how it was added (api, file, paste, single, …)."},"test":{"const":true,"description":"webhook.test only."},"endpoint_id":{"type":"string","format":"uuid","description":"webhook.test only."},"message":{"type":"string","description":"webhook.test only."}}}},"required":["id","type","created_at","org_id","data"]}}}}