{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"49338fb8-9897-5cdf-0ffe-ff7c4bb00c61","name":"First API","description":"# Making a Request\n\n**Auth tokens are different between sandbox and production environments.**\n\n#### Auth:\n\nFirst uses Basic Authentication. Your 'Authorization' header should look something like this **(the 'Bearer' prefix is optional, and won't make a difference to the request):**\n\n```\n    Authorization: Bearer YOUR_API_KEY\n\n ```\n\n#### Content Type\n\nAll API request/response bodies are JSON - the content-type header for all requests must be set to application/json.\n\n```\n    Content-Type: application/json\n\n ```\n\n#### Root URL\n\nAll requests to First's APIs should be HTTPS, and to either our sandbox or production environment, under the /api namespace.\n\n- Production: [https://api.firstdelivery.com/api/](https://)\n    \n    - Dashboard is available at [https://dispatch.firstdelivery.com](https://)\n        \n- Sandbox: [https://sandbox.firstdelivery.com/api/](https://)\n    \n    - Dashboard is available at: [https://dispatch-v3-sandbox.herokuapp.com/](https://)\n        \n\nSandbox data and authorization are ephemeral and subject to change every few months. Reach out if you need to be re-granted sandbox access!\n\n# FirstDelivery API & Webhook Best Practices\n\nFirstDelivery acts strictly as a **pipe**: we normalize and forward provider webhooks without altering semantics. We do **not** guarantee ordering, deduplication, or completeness of events.\n\nFor any **critical business logic** (e.g., order state machines, customer notifications, financial settlement), **you must combine webhook signals with polling APIs** to reconcile truth.\n\n---\n\n## 1\\. API Request Resilience\n\n- **Retry with backoff**: use **exponential backoff + jitter**. Example: 1s → 2s → 4s (up to 3 retries).\n    \n- **Respect HTTP codes**:\n    - `429` → back off, honor `Retry-After`.\n        \n    - `5xx` → retry.\n        \n    - `4xx` (client error) → do not retry.\n        \n- **Timeouts**: set sensible per-request deadlines.\n    \n- **Idempotency**: when possible, include idempotency keys to make retries safe.\n    \n- **Transient faults**: assume intermittent provider/network issues and design for recovery.\n    \n\nReferences:\n\n- [DoorDash Retry Pattern](https://developer.doordash.com/en-US/docs/drive_classic/reference/retry_pattern/)\n    \n- [MS Azure: Transient Faults](https://learn.microsoft.com/en-us/azure/architecture/best-practices/transient-faults)\n    \n\n---\n\n## 2\\. Webhook Handling\n\n### Nature of Provider Webhooks\n\n- Delivered **at-least-once**: duplicates possible.\n    \n- Can arrive **out of sequence** (e.g., `DELIVERED` before `PICKED_UP`).\n    \n- May be **delayed** or **missed entirely** during provider outages or network issues.\n    \n- Providers can retry aggressively if you don’t respond with 2xx quickly.\n    \n\n### Best Practices\n\n- **Acknowledge fast**: return 2xx immediately, enqueue for async processing.\n    \n- **Idempotency**: dedupe using event IDs (if available) or payload hashes.\n    \n- **Do not assume ordering**: always compare event timestamp/state against your current record before applying updates.\n    \n- **Expect gaps**: webhooks alone are never authoritative.\n    \n\n---\n\n## 3\\. Polling & Reconciliation (Mandatory)\n\nBecause events may be missed, delayed, or reordered:\n\n- Implement a **polling mechanism** to fetch authoritative order state.\n    \n- Use polling to **reconcile** with webhook events regularly.\n    \n- Design downstream logic to **merge webhook signals + polled truth**.\n    \n\nThis is essential for **business-critical workflows** (order fulfillment, billing, compliance).\n\n---\n\n## 4\\. Summary\n\n- Retries: exponential backoff, honor rate limits, don’t retry 4xx.\n    \n- Webhooks: at-least-once, out-of-order, delayed, possibly dropped.\n    \n- Polling: mandatory to reconcile truth.\n    \n\n**Webhook payloads are hints, not the source of truth.**\n\n# Responses and Status Codes\n\nResponses typically follow the format of the previous query, response codes follow typical HTTP best practices:\n\n| Status Code | Name | Description |\n| --- | --- | --- |\n| 200/201 | Success | Everything worked as expected 🎉 |\n| 400 | Bad request | The request didn’t work, often because a required parameter is missing or the content-type hasn’t been set e.g. an incorrect JSON request |\n| 401 | Unauthorized | Authorization token is invalid, or being used in the wrong environment |\n| 403 | Forbidden | Requesting user lacks permission to perform |\n| 404 | Not found | Resource not available on requested endpoint |\n| 429 | Too many requests | Rate limiter kicked in, scale back request frequency |\n| 5xx | Server error | Something went wrong on our end - there will be a TraceID in the response you can send us to help figure out the issue! |","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"2850328","team":65790,"collectionId":"49338fb8-9897-5cdf-0ffe-ff7c4bb00c61","publishedId":"RW87qVSS","public":true,"publicUrl":"https://docs.firstdelivery.com","privateUrl":"https://go.postman.co/documentation/2850328-49338fb8-9897-5cdf-0ffe-ff7c4bb00c61","customColor":{"top-bar":"1B273F","right-sidebar":"303030","highlight":"52AE68"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":""},{"name":"title","value":""}],"appearance":{"default":"light","themes":[{"name":"dark","logo":"https://content.pstmn.io/1034129f-eca2-47ef-86f1-0966c6f709b0/Zmlyc3QtbG9nby4wNTljYWM4Mi5wbmc=","colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":"https://content.pstmn.io/1034129f-eca2-47ef-86f1-0966c6f709b0/Zmlyc3QtbG9nby4wNTljYWM4Mi5wbmc=","colors":{"top-bar":"1B273F","right-sidebar":"303030","highlight":"52AE68"}}]}},"version":"8.10.0","publishDate":"2024-02-12T17:54:07.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"","description":""},"logos":{"logoLight":"https://content.pstmn.io/1034129f-eca2-47ef-86f1-0966c6f709b0/Zmlyc3QtbG9nby4wNTljYWM4Mi5wbmc=","logoDark":"https://content.pstmn.io/1034129f-eca2-47ef-86f1-0966c6f709b0/Zmlyc3QtbG9nby4wNTljYWM4Mi5wbmc="}},"statusCode":200},"environments":[{"name":"Sandbox","id":"d150415d-9479-4511-97a2-9e51a9907954","owner":"2850328","values":[{"key":"BASE_HABITAT_URL","value":"https://sandbox.firstdelivery.com","enabled":true,"type":"default"},{"key":"ACCESS_TOKEN_ADMIN","value":"0adf1500-8bf2-11ea-8896-01957a882901","enabled":true,"type":"default"},{"key":"$merchantId","value":"f254d581-3a2d-11ef-a2e0-35b1dbd3cd29","enabled":true,"type":"default"},{"key":"ORDER_ID","value":"b4abc590-a009-11ee-95cd-878c5a7c0cc8","enabled":true,"type":"default"},{"key":"DELIVERTHAT_ROOT","value":"https://api-test.deliverthat.com","enabled":true,"type":"default"},{"key":"DELIVERTHAT_KEY","value":"6c0d75046945451e.9mbolMtq0RwHlIPYdCKBWMYK/wPN/vr4HL6IOqISbIM=","enabled":true,"type":"default"},{"key":"lastQuoteId","value":"","enabled":true,"type":"any"},{"key":"$phoneNumber","value":"+15705261709","enabled":true,"type":"default"}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/62fc265ab3be5fffb9b3c8bc400e8f62ac0a80e81758d8310c2307e171e2fe8d","favicon":"https://firstdelivery.com/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"Sandbox","value":"2850328-d150415d-9479-4511-97a2-9e51a9907954"}],"canonicalUrl":"https://docs.firstdelivery.com/view/metadata/RW87qVSS"}