{"openapi":"3.1.0","info":{"title":"Affinity API","version":"2026-10-20","contact":{"email":"support@affinityrx.com","name":"Affinity API Support"},"description":"Affinity API for platforms and practices that order from the pharmacy network. If a response or a page is wrong or unclear, send `POST /v1/feedback` with an `Idempotency-Key`, a short message and the `requestId` from the response. Do not include patient information."},"paths":{"/v1/account":{"get":{"tags":["Account"],"operationId":"account.account","parameters":[{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"AccountAccountResponse","type":"object","properties":{"id":{"type":"string","pattern":"^(plat|prac|pharm)_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]},"liveEnabled":{"type":"boolean","description":"Effective Live access. A managed practice requires both its own Live setting and its platform's Live access."},"createdAt":{"type":"string"},"mode":{"type":"string","enum":["test","live"]},"type":{"type":"string","enum":["platform","practice","pharmacy"]}},"required":["id","name","phone","address","liveEnabled","createdAt","mode","type"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"AccountAccount400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"AccountAccount401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"AccountAccount403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"AccountAccount404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"AccountAccount429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"Read the organization and Test or Live mode selected by the API key.","summary":"Read the organization and mode you act as","x-visibility":"public"}},"/v1/feedback":{"post":{"tags":["Feedback"],"operationId":"createFeedback","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":true,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[],"responses":{"202":{"description":"HTTP 202","content":{"application/json":{"schema":{"title":"CreateFeedbackResponse","type":"object","properties":{"id":{"type":"string","pattern":"^fbk_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["fbk_01j2y8m6jcc9tt24af5pw9x1bc"]}},"required":["id"],"additionalProperties":false,"examples":[{"id":"fbk_01j2y8m6jcc9tt24af5pw9x1bc"}]}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"CreateFeedback400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"CreateFeedback401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"CreateFeedback409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"415":{"description":"Unsupported media type. Send Content-Type: application/json.","content":{"application/problem+json":{"schema":{"additionalProperties":false,"properties":{"code":{"type":"string","examples":["unsupported_media_type"]},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"CreateFeedback429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","pattern":"^(?:[\\n\\r]|[^\\p{Cc}\\p{Cf}\\p{Cs}])*$","minLength":1,"maxLength":5000},"pageUrl":{"type":"string","maxLength":2000},"requestId":{"anyOf":[{"type":"string","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$","format":"uuid"},{"type":"string","pattern":"^req_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["req_01j2y8m6jcc9tt24af5pw9x1bc"]}],"description":"The `requestId` of the response, as the API returned it."}},"required":["message"],"additionalProperties":false,"examples":[{"message":"The error does not explain which field is invalid.","pageUrl":"https://docs.affinityrx.com/errors/","requestId":"6e562761-eff3-4626-a8b9-25ce7c670ccd"}]}}},"required":true,"description":"Send the JSON body with Content-Type: application/json."},"description":"Send feedback without credentials, or with an API key to include its organization and mode. Do not include patient information. Limited to 10 submissions per hour per IP address and API key. A 429 response includes Retry-After in seconds.","summary":"Send feedback","x-visibility":"public"}},"/v1/medications/{medicationId}":{"get":{"tags":["Medications"],"operationId":"medications.get","parameters":[{"name":"medicationId","in":"path","schema":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"name":"practiceId","in":"query","schema":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","description":"Quote prices and availability for this practice. A platform may select only its own child practices; a practice may select only itself. Omit to use the caller's organization.","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":false,"description":"Quote prices and availability for this practice. A platform may select only its own child practices; a practice may select only itself. Omit to use the caller's organization."},{"name":"expand","in":"query","schema":{"type":"array","items":{"anyOf":[{"type":"string","enum":["variants"]}]},"description":"Add related records to the response. `variants` adds the medication's other strengths, forms and pharmacies."},"required":false,"description":"Add related records to the response. `variants` adds the medication's other strengths, forms and pharmacies."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"MedicationsGetResponse","type":"object","properties":{"category":{"type":"string","enum":["weight_loss","hormones","sexual_health","hair","skin","wellness","peptides","pain","other","supplies"],"description":"What the medication is prescribed for. Every strength, form and pharmacy of one medication has the same category."},"coldChainRequired":{"type":"boolean"},"compoundingReasons":{"type":"array","items":{"type":"string"}},"defaultDirections":{"anyOf":[{"type":"string"},{"type":"null"}]},"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string","description":"The name with each ingredient's salt where the catalog records one, such as Enclomiphene Citrate. Equals name otherwise."},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantities":{"type":"array","items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"requirements":{"type":"array","items":{"type":"string"}},"restrictedStates":{"type":"array","items":{"type":"string"}},"shippingOptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false}},"shippingSuppliesPrice":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"The part of each shipping option's price that is this medication's per-order supplies (for example the PerfectRx injection supplies). A mixed order pays the highest one once."},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]},"variants":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["weight_loss","hormones","sexual_health","hair","skin","wellness","peptides","pain","other","supplies"],"description":"What the medication is prescribed for. Every strength, form and pharmacy of one medication has the same category."},"coldChainRequired":{"type":"boolean"},"compoundingReasons":{"type":"array","items":{"type":"string"}},"defaultDirections":{"anyOf":[{"type":"string"},{"type":"null"}]},"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string","description":"The name with each ingredient's salt where the catalog records one, such as Enclomiphene Citrate. Equals name otherwise."},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantities":{"type":"array","items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"requirements":{"type":"array","items":{"type":"string"}},"restrictedStates":{"type":"array","items":{"type":"string"}},"shippingOptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false}},"shippingSuppliesPrice":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"The part of each shipping option's price that is this medication's per-order supplies (for example the PerfectRx injection supplies). A mixed order pays the highest one once."},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["category","coldChainRequired","compoundingReasons","defaultDirections","form","fullName","id","name","pharmacy","price","quantities","quantityUnit","requirements","restrictedStates","shippingOptions","shippingSuppliesPrice","strength"],"additionalProperties":false},"description":"With expand=variants: every other available strength, form and pharmacy of the same medication, for the current organization and mode."}},"required":["category","coldChainRequired","compoundingReasons","defaultDirections","form","fullName","id","name","pharmacy","price","quantities","quantityUnit","requirements","restrictedStates","shippingOptions","shippingSuppliesPrice","strength"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"MedicationsGet400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"MedicationsGet401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"MedicationsGet403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"MedicationsGet404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"MedicationsGet429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"Read one available medication, its pricing, and pharmacy details for the current organization and mode. Pass expand=variants to include its other strengths, forms and pharmacies.","summary":"Read a medication","x-visibility":"public"}},"/v1/medications":{"get":{"tags":["Medications"],"operationId":"medications.list","parameters":[{"name":"practiceId","in":"query","schema":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","description":"Quote prices and availability for this practice. A platform may select only its own child practices; a practice may select only itself. Omit to use the caller's organization.","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":false,"description":"Quote prices and availability for this practice. A platform may select only its own child practices; a practice may select only itself. Omit to use the caller's organization."},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Maximum records per page, from 1 to 100. Defaults to 25."},"required":false,"description":"Maximum records per page, from 1 to 100. Defaults to 25."},{"name":"startingAfter","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},"required":false,"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},{"name":"category","in":"query","schema":{"type":"string","enum":["weight_loss","hormones","sexual_health","hair","skin","wellness","peptides","pain","other","supplies"],"description":"Limit results to this category. Combine with query or pharmacyId."},"required":false,"description":"Limit results to this category. Combine with query or pharmacyId."},{"name":"name","in":"query","schema":{"type":"string","maxLength":200,"description":"Match the medication name exactly, ignoring case. Use this to list its strengths, forms and pharmacies."},"required":false,"description":"Match the medication name exactly, ignoring case. Use this to list its strengths, forms and pharmacies."},{"name":"names","in":"query","schema":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"description":"Match any of up to 25 exact product names, ignoring case. Repeat the names query parameter. Page through all results for complete strengths and prices.","minItems":1,"maxItems":25},"required":false,"description":"Match any of up to 25 exact product names, ignoring case. Repeat the names query parameter. Page through all results for complete strengths and prices."},{"name":"pharmacyId","in":"query","schema":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","description":"Limit results to the pharmacy with this pharm_ ID. Combine with query, name or names.","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":false,"description":"Limit results to the pharmacy with this pharm_ ID. Combine with query, name or names."},{"name":"query","in":"query","schema":{"type":"string","maxLength":120,"description":"Search names, brands, forms, routes, strengths or pharmacy product codes, ranked by relevance. With name or names, match medication or pharmacy text instead. Restart pagination when filters change."},"required":false,"description":"Search names, brands, forms, routes, strengths or pharmacy product codes, ranked by relevance. With name or names, match medication or pharmacy text instead. Restart pagination when filters change."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"MedicationsListResponse","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["weight_loss","hormones","sexual_health","hair","skin","wellness","peptides","pain","other","supplies"],"description":"What the medication is prescribed for. Every strength, form and pharmacy of one medication has the same category."},"coldChainRequired":{"type":"boolean"},"compoundingReasons":{"type":"array","items":{"type":"string"}},"defaultDirections":{"anyOf":[{"type":"string"},{"type":"null"}]},"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string","description":"The name with each ingredient's salt where the catalog records one, such as Enclomiphene Citrate. Equals name otherwise."},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantities":{"type":"array","items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"requirements":{"type":"array","items":{"type":"string"}},"restrictedStates":{"type":"array","items":{"type":"string"}},"shippingOptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false}},"shippingSuppliesPrice":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"The part of each shipping option's price that is this medication's per-order supplies (for example the PerfectRx injection supplies). A mixed order pays the highest one once."},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["category","coldChainRequired","compoundingReasons","defaultDirections","form","fullName","id","name","pharmacy","price","quantities","quantityUnit","requirements","restrictedStates","shippingOptions","shippingSuppliesPrice","strength"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"object":{"type":"string","enum":["list"]},"url":{"type":"string"}},"required":["data","hasMore","nextCursor","object","url"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"MedicationsList400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"MedicationsList401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"MedicationsList403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"MedicationsList404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"MedicationsList429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"503":{"description":"HTTP 503","content":{"application/problem+json":{"schema":{"title":"MedicationsList503Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"Medications you can order in the current mode. Prices are in cents. `requirements` names the optional prescription fields this pharmacy requires; `compoundingReasons` and `quantities` list the accepted values when the pharmacy limits them, counted in `quantityUnit` (a quantity of 1 for a vial is 1 mL). `pharmacyId` lists only that pharmacy's medications, and `name` only those with exactly that name: one medication's strengths, forms and pharmacies.","summary":"List medications","x-pier-pagination":{"backward":false,"cursorField":"id","kind":"cursor"},"x-visibility":"public"}},"/v1/orders/{orderId}/cancel":{"post":{"tags":["Orders"],"operationId":"orders.cancel","parameters":[{"name":"orderId","in":"path","schema":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":true,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"OrdersCancelResponse","type":"object","properties":{"cancelRequestedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"externalOrderId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"mode":{"type":"string","enum":["test","live"]},"patient":{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"allergies":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["drug","food","insect","latex","mold","pet","pollen"]},"display":{"type":"string"}},"required":["category","display"],"additionalProperties":false}},"dateOfBirth":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"gender":{"type":"string","enum":["female","male","unknown"]},"lastName":{"type":"string"},"middleName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"type":"string"}},"required":["address","allergies","dateOfBirth","email","firstName","gender","lastName","middleName","phone"],"additionalProperties":false},"patientId":{"type":"string","pattern":"^pat_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pat_01j2y8m6jcc9tt24af5pw9x1bc"]},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"practice":{"anyOf":[{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"name":{"type":"string"},"phone":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address","name","phone"],"additionalProperties":false},{"type":"null"}]},"practiceId":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"prescriber":{"anyOf":[{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"npi":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]}},"required":["firstName","lastName","npi"],"additionalProperties":false},{"type":"null"}]},"prescriptions":{"type":"array","items":{"type":"object","properties":{"compoundingReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"directions":{"type":"string"},"id":{"type":"string","pattern":"^rx_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["rx_01j2y8m6jcc9tt24af5pw9x1bc"]},"medication":{"type":"object","properties":{"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["form","id","name","quantityUnit","strength"],"additionalProperties":false},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":1,"maximum":9007199254740991},"refills":{"type":"integer","minimum":0,"maximum":9007199254740991},"substitutionPermitted":{"type":"boolean"}},"required":["compoundingReason","directions","id","medication","notes","price","quantity","refills","substitutionPermitted"],"additionalProperties":false}},"shippingOption":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false},{"type":"null"}]},"shipments":{"type":"array","items":{"type":"object","properties":{"carrier":{"anyOf":[{"type":"string"},{"type":"null"}]},"trackingNumber":{"type":"string"},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["carrier","trackingNumber","trackingUrl"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"statusHistory":{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string"},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]}},"required":["createdAt","status"],"additionalProperties":false}},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"updatedAt":{"type":"string"}},"required":["cancelRequestedAt","createdAt","externalOrderId","failureReason","id","mode","patient","patientId","pharmacy","practice","practiceId","prescriber","prescriptions","shippingOption","shipments","status","trackingUrl","statusHistory","total","updatedAt"],"additionalProperties":false}}}},"202":{"description":"HTTP 202","content":{"application/json":{"schema":{"title":"OrdersCancelResponse","type":"object","properties":{"cancelRequestedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"externalOrderId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"mode":{"type":"string","enum":["test","live"]},"patient":{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"allergies":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["drug","food","insect","latex","mold","pet","pollen"]},"display":{"type":"string"}},"required":["category","display"],"additionalProperties":false}},"dateOfBirth":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"gender":{"type":"string","enum":["female","male","unknown"]},"lastName":{"type":"string"},"middleName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"type":"string"}},"required":["address","allergies","dateOfBirth","email","firstName","gender","lastName","middleName","phone"],"additionalProperties":false},"patientId":{"type":"string","pattern":"^pat_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pat_01j2y8m6jcc9tt24af5pw9x1bc"]},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"practice":{"anyOf":[{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"name":{"type":"string"},"phone":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address","name","phone"],"additionalProperties":false},{"type":"null"}]},"practiceId":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"prescriber":{"anyOf":[{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"npi":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]}},"required":["firstName","lastName","npi"],"additionalProperties":false},{"type":"null"}]},"prescriptions":{"type":"array","items":{"type":"object","properties":{"compoundingReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"directions":{"type":"string"},"id":{"type":"string","pattern":"^rx_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["rx_01j2y8m6jcc9tt24af5pw9x1bc"]},"medication":{"type":"object","properties":{"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["form","id","name","quantityUnit","strength"],"additionalProperties":false},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":1,"maximum":9007199254740991},"refills":{"type":"integer","minimum":0,"maximum":9007199254740991},"substitutionPermitted":{"type":"boolean"}},"required":["compoundingReason","directions","id","medication","notes","price","quantity","refills","substitutionPermitted"],"additionalProperties":false}},"shippingOption":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false},{"type":"null"}]},"shipments":{"type":"array","items":{"type":"object","properties":{"carrier":{"anyOf":[{"type":"string"},{"type":"null"}]},"trackingNumber":{"type":"string"},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["carrier","trackingNumber","trackingUrl"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"statusHistory":{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string"},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]}},"required":["createdAt","status"],"additionalProperties":false}},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"updatedAt":{"type":"string"}},"required":["cancelRequestedAt","createdAt","externalOrderId","failureReason","id","mode","patient","patientId","pharmacy","practice","practiceId","prescriber","prescriptions","shippingOption","shipments","status","trackingUrl","statusHistory","total","updatedAt"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"OrdersCancel400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"OrdersCancel401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"OrdersCancel403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"OrdersCancel404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"OrdersCancel409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"OrdersCancel429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"200 with status cancelled when the cancel is confirmed. 202 with cancelRequestedAt when the pharmacy has not confirmed yet; order.cancelled follows. 409 when the pharmacy refuses or the order has shipped.","summary":"Cancel an order","x-visibility":"public"}},"/v1/orders":{"post":{"tags":["Orders"],"operationId":"orders.create","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":false,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"OrdersCreateResponse","type":"object","properties":{"cancelRequestedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"externalOrderId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"mode":{"type":"string","enum":["test","live"]},"patient":{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"allergies":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["drug","food","insect","latex","mold","pet","pollen"]},"display":{"type":"string"}},"required":["category","display"],"additionalProperties":false}},"dateOfBirth":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"gender":{"type":"string","enum":["female","male","unknown"]},"lastName":{"type":"string"},"middleName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"type":"string"}},"required":["address","allergies","dateOfBirth","email","firstName","gender","lastName","middleName","phone"],"additionalProperties":false},"patientId":{"type":"string","pattern":"^pat_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pat_01j2y8m6jcc9tt24af5pw9x1bc"]},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"practice":{"anyOf":[{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"name":{"type":"string"},"phone":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address","name","phone"],"additionalProperties":false},{"type":"null"}]},"practiceId":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"prescriber":{"anyOf":[{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"npi":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]}},"required":["firstName","lastName","npi"],"additionalProperties":false},{"type":"null"}]},"prescriptions":{"type":"array","items":{"type":"object","properties":{"compoundingReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"directions":{"type":"string"},"id":{"type":"string","pattern":"^rx_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["rx_01j2y8m6jcc9tt24af5pw9x1bc"]},"medication":{"type":"object","properties":{"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["form","id","name","quantityUnit","strength"],"additionalProperties":false},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":1,"maximum":9007199254740991},"refills":{"type":"integer","minimum":0,"maximum":9007199254740991},"substitutionPermitted":{"type":"boolean"}},"required":["compoundingReason","directions","id","medication","notes","price","quantity","refills","substitutionPermitted"],"additionalProperties":false}},"shippingOption":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false},{"type":"null"}]},"shipments":{"type":"array","items":{"type":"object","properties":{"carrier":{"anyOf":[{"type":"string"},{"type":"null"}]},"trackingNumber":{"type":"string"},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["carrier","trackingNumber","trackingUrl"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"statusHistory":{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string"},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]}},"required":["createdAt","status"],"additionalProperties":false}},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"updatedAt":{"type":"string"}},"required":["cancelRequestedAt","createdAt","externalOrderId","failureReason","id","mode","patient","patientId","pharmacy","practice","practiceId","prescriber","prescriptions","shippingOption","shipments","status","trackingUrl","statusHistory","total","updatedAt"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"OrdersCreate400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"OrdersCreate401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"OrdersCreate403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"OrdersCreate404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"OrdersCreate409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"415":{"description":"Unsupported media type. Send Content-Type: application/json.","content":{"application/problem+json":{"schema":{"additionalProperties":false,"properties":{"code":{"type":"string","examples":["unsupported_media_type"]},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"422":{"description":"HTTP 422","content":{"application/problem+json":{"schema":{"title":"OrdersCreate422Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"OrdersCreate429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"503":{"description":"HTTP 503","content":{"application/problem+json":{"schema":{"title":"OrdersCreate503Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"externalOrderId":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":128,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},{"type":"null"}]},"patient":{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"line2":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200},{"type":"null"}]},"city":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":100,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"state":{"type":"string","pattern":"^(?:AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|AS|GU|MP|PR|VI|AA|AE|AP)$"},"postalCode":{"type":"string","pattern":"^\\d{5}(-\\d{4})?$"}},"required":["line1","city","state","postalCode"],"additionalProperties":false},"allergies":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["drug","food","insect","latex","mold","pet","pollen"]},"display":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."},{"pattern":"^(?![\\s\\p{Cc}\\p{Cs}])[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]+$"}],"minLength":1}},"required":["category","display"],"additionalProperties":false},"maxItems":50},"dateOfBirth":{"type":"string","allOf":[{"format":"date","pattern":"^(19|20)\\d\\d-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$","description":"A real calendar date in YYYY-MM-DD format, with a year from 1900 through 2099, today or earlier in UTC."}]},"email":{"type":"string","maxLength":254,"pattern":"^[^\\s@\\p{Cc}\\p{Cs}]+@[^\\s@\\p{Cc}\\p{Cs}]+\\.[^\\s@\\p{Cc}\\p{Cs}]+$"},"firstName":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":60,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"gender":{"type":"string","enum":["female","male","unknown"]},"lastName":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":60,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"middleName":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":60,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},{"type":"null"}]},"phone":{"type":"string","pattern":"^\\+1\\d{10}$"},"externalId":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":128,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},{"type":"null"}]}},"required":["address","allergies","dateOfBirth","email","firstName","gender","lastName","phone"],"additionalProperties":false},"practiceId":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","description":"Required with a platform API key. Send a child practice ID. Independent practice keys can omit this field to use their own practice.","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"prescriber":{"type":"object","properties":{"phone":{"type":"string","pattern":"^\\+1\\d{10}$"},"address":{"type":"object","properties":{"line1":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"line2":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200},{"type":"null"}]},"city":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":100,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"state":{"type":"string","pattern":"^(?:AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|AS|GU|MP|PR|VI|AA|AE|AP)$"},"postalCode":{"type":"string","pattern":"^\\d{5}(-\\d{4})?$"}},"required":["line1","city","state","postalCode"],"additionalProperties":false},"firstName":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":60,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"lastName":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":60,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"npi":{"type":"string","pattern":"^\\d{10}$"}},"required":["firstName","lastName","npi"],"additionalProperties":false,"description":"Required with an API key. Send the prescribing clinician's NPI, firstName and lastName. Session callers can omit this field to sign with their own profile."},"prescriptions":{"type":"array","items":{"type":"object","properties":{"compoundingReason":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},{"type":"null"}]},"directions":{"type":"string","pattern":"^(?:[\\n\\r]|[^\\p{Cc}\\p{Cf}\\p{Cs}])*$","maxLength":2000,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"medicationId":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"notes":{"anyOf":[{"type":"string","pattern":"^(?:[\\n\\r]|[^\\p{Cc}\\p{Cf}\\p{Cs}])*$","maxLength":1000,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},{"type":"null"}]},"quantity":{"type":"integer","minimum":1,"maximum":10000},"refills":{"type":"integer","minimum":0,"maximum":99},"substitutionPermitted":{"type":"boolean"}},"required":["directions","medicationId","quantity","refills"],"additionalProperties":false},"minItems":1,"maxItems":20},"shippingOptionId":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"signatureAttestation":{"type":"boolean","enum":[true]}},"required":["patient","prescriptions","shippingOptionId","signatureAttestation"],"additionalProperties":false}}},"required":true,"description":"Send the JSON body with Content-Type: application/json."},"description":"One request creates the order, signs it and sends it to the pharmacy. Platforms must send practiceId; practice callers can omit it to use their own practice. With an API key, name the prescriber and send signatureAttestation. Optional prescriber phone and address each default to the practice; no account is looked up by NPI. In the app, the signed-in member signs with the NPI in their settings, or names the prescriber with the same attestation. The patient is found by patient.externalId and updated from the order. Live orders require Live access on the practice and its platform. No payment method is required.","summary":"Create, sign and submit an order","x-visibility":"public"},"get":{"tags":["Orders"],"operationId":"orders.list","parameters":[{"name":"endingBefore","in":"query","schema":{"type":"string","maxLength":2048,"description":"Page backward before this opaque cursor. Keep the same filters, sort, organization and mode. Send either startingAfter or endingBefore."},"required":false,"description":"Page backward before this opaque cursor. Keep the same filters, sort, organization and mode. Send either startingAfter or endingBefore."},{"name":"limit","in":"query","schema":{"type":"string","description":"Maximum records per page, from 1 to 100. Defaults to 25."},"required":false,"description":"Maximum records per page, from 1 to 100. Defaults to 25."},{"name":"startingAfter","in":"query","schema":{"type":"string","maxLength":2048,"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},"required":false,"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},{"name":"externalOrderId","in":"query","schema":{"type":"string","minLength":1,"maxLength":128,"description":"Match the external order ID exactly, including case. Combine with practiceId when your platform reuses IDs across practices."},"required":false,"description":"Match the external order ID exactly, including case. Combine with practiceId when your platform reuses IDs across practices."},{"name":"updatedAfter","in":"query","schema":{"type":"string","format":"date-time","description":"Return orders whose updatedAt is strictly later than this ISO 8601 timestamp. Sorting stays by creation time and ID unless sort is supplied. Keep this cutoff unchanged while paging."},"required":false,"description":"Return orders whose updatedAt is strictly later than this ISO 8601 timestamp. Sorting stays by creation time and ID unless sort is supplied. Keep this cutoff unchanged while paging."},{"name":"patientId","in":"query","schema":{"type":"string","pattern":"^pat_[0-7][0-9a-hjkmnp-tv-z]{25}$","description":"Limit results to the patient with this pat_ ID.","examples":["pat_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":false,"description":"Limit results to the patient with this pat_ ID."},{"name":"practiceId","in":"query","schema":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","description":"Limit results to the practice with this prac_ ID, within your authorized practices.","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":false,"description":"Limit results to the practice with this prac_ ID, within your authorized practices."},{"name":"query","in":"query","schema":{"type":"string","maxLength":120,"description":"Search saved order snapshots: patient names, email, phone and external ID; order external ID; prescriber name and NPI; medication names and brands; pharmacy name. Whole ord_ and pat_ IDs and six-character order numbers also match. Text matches ignore case and allow substrings, word prefixes and similar spellings for alphanumeric words of four or more characters. Every one of the first eight words containing letters or numbers must match; punctuation-only words are ignored. An empty or punctuation-only query leaves the list unfiltered. Date of birth, separate strength fields, practice names, prac_ IDs and rx_ IDs are not searched. Restart pagination when filters change."},"required":false,"description":"Search saved order snapshots: patient names, email, phone and external ID; order external ID; prescriber name and NPI; medication names and brands; pharmacy name. Whole ord_ and pat_ IDs and six-character order numbers also match. Text matches ignore case and allow substrings, word prefixes and similar spellings for alphanumeric words of four or more characters. Every one of the first eight words containing letters or numbers must match; punctuation-only words are ignored. An empty or punctuation-only query leaves the list unfiltered. Date of birth, separate strength fields, practice names, prac_ IDs and rx_ IDs are not searched. Restart pagination when filters change."},{"name":"status","in":"query","schema":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"],"description":"Return only orders with this status. Omit to include all statuses."},"required":false,"description":"Return only orders with this status. Omit to include all statuses."},{"name":"cancelRequested","in":"query","schema":{"type":"string","enum":["true","false"],"description":"true returns only submitted or processing orders with a cancel the pharmacy has not confirmed yet (cancelRequestedAt set). false leaves those orders out. Omit to include both."},"required":false,"description":"true returns only submitted or processing orders with a cancel the pharmacy has not confirmed yet (cancelRequestedAt set). false leaves those orders out. Omit to include both."},{"name":"recentlyShipped","in":"query","schema":{"type":"string","enum":["true","false"],"description":"true returns only orders that became shipped in the last 60 days, while Affinity still checks them with the pharmacy and carrier. false leaves those orders out. Omit to include both."},"required":false,"description":"true returns only orders that became shipped in the last 60 days, while Affinity still checks them with the pharmacy and carrier. false leaves those orders out. Omit to include both."},{"name":"sort","in":"query","schema":{"type":"string","enum":["patient","-patient","created","-created"],"description":"patient sorts the lowercase text firstName + space + lastName A to Z, then order ID; created sorts oldest first. A leading - reverses the order. Defaults to -created. Restart pagination after changing sort."},"required":false,"description":"patient sorts the lowercase text firstName + space + lastName A to Z, then order ID; created sorts oldest first. A leading - reverses the order. Defaults to -created. Restart pagination after changing sort."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"OrdersListResponse","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"cancelRequestedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"externalOrderId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"mode":{"type":"string","enum":["test","live"]},"patient":{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"allergies":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["drug","food","insect","latex","mold","pet","pollen"]},"display":{"type":"string"}},"required":["category","display"],"additionalProperties":false}},"dateOfBirth":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"gender":{"type":"string","enum":["female","male","unknown"]},"lastName":{"type":"string"},"middleName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"type":"string"}},"required":["address","allergies","dateOfBirth","email","firstName","gender","lastName","middleName","phone"],"additionalProperties":false},"patientId":{"type":"string","pattern":"^pat_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pat_01j2y8m6jcc9tt24af5pw9x1bc"]},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"practice":{"anyOf":[{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"name":{"type":"string"},"phone":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address","name","phone"],"additionalProperties":false},{"type":"null"}]},"practiceId":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"prescriber":{"anyOf":[{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"npi":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]}},"required":["firstName","lastName","npi"],"additionalProperties":false},{"type":"null"}]},"prescriptions":{"type":"array","items":{"type":"object","properties":{"compoundingReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"directions":{"type":"string"},"id":{"type":"string","pattern":"^rx_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["rx_01j2y8m6jcc9tt24af5pw9x1bc"]},"medication":{"type":"object","properties":{"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["form","id","name","quantityUnit","strength"],"additionalProperties":false},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":1,"maximum":9007199254740991},"refills":{"type":"integer","minimum":0,"maximum":9007199254740991},"substitutionPermitted":{"type":"boolean"}},"required":["compoundingReason","directions","id","medication","notes","price","quantity","refills","substitutionPermitted"],"additionalProperties":false}},"shippingOption":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false},{"type":"null"}]},"shipments":{"type":"array","items":{"type":"object","properties":{"carrier":{"anyOf":[{"type":"string"},{"type":"null"}]},"trackingNumber":{"type":"string"},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["carrier","trackingNumber","trackingUrl"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"statusHistory":{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string"},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]}},"required":["createdAt","status"],"additionalProperties":false}},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"updatedAt":{"type":"string"}},"required":["cancelRequestedAt","createdAt","externalOrderId","failureReason","id","mode","patient","patientId","pharmacy","practice","practiceId","prescriber","prescriptions","shippingOption","shipments","status","trackingUrl","statusHistory","total","updatedAt"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"object":{"type":"string","enum":["list"]},"url":{"type":"string"}},"required":["data","hasMore","nextCursor","object","url"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"OrdersList400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"OrdersList401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"OrdersList403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"OrdersList404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"OrdersList429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"List accessible orders in the current mode, newest first. `externalOrderId` matches exactly, including case. `updatedAfter` accepts an ISO 8601 timestamp with a timezone and returns strictly later updates. Keep filters fixed while paging. `sort` takes `patient` (lowercase firstName + space + lastName A to Z, then order ID) or `created` (oldest first); a leading `-` reverses. Creation time or patient name and the order ID determine cursor order, even when updatedAt changes.","summary":"List orders","x-pier-pagination":{"cursorField":"id","kind":"cursor"},"x-visibility":"public"}},"/v1/orders/{orderId}":{"get":{"tags":["Orders"],"operationId":"orders.get","parameters":[{"name":"orderId","in":"path","schema":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"OrdersGetResponse","type":"object","properties":{"cancelRequestedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"externalOrderId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"mode":{"type":"string","enum":["test","live"]},"patient":{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"allergies":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["drug","food","insect","latex","mold","pet","pollen"]},"display":{"type":"string"}},"required":["category","display"],"additionalProperties":false}},"dateOfBirth":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"gender":{"type":"string","enum":["female","male","unknown"]},"lastName":{"type":"string"},"middleName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"type":"string"}},"required":["address","allergies","dateOfBirth","email","firstName","gender","lastName","middleName","phone"],"additionalProperties":false},"patientId":{"type":"string","pattern":"^pat_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pat_01j2y8m6jcc9tt24af5pw9x1bc"]},"pharmacy":{"type":"object","properties":{"id":{"type":"string","pattern":"^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["pharm_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"practice":{"anyOf":[{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},"name":{"type":"string"},"phone":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address","name","phone"],"additionalProperties":false},{"type":"null"}]},"practiceId":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"prescriber":{"anyOf":[{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"npi":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]}},"required":["firstName","lastName","npi"],"additionalProperties":false},{"type":"null"}]},"prescriptions":{"type":"array","items":{"type":"object","properties":{"compoundingReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"directions":{"type":"string"},"id":{"type":"string","pattern":"^rx_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["rx_01j2y8m6jcc9tt24af5pw9x1bc"]},"medication":{"type":"object","properties":{"form":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^med_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["med_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"quantityUnit":{"anyOf":[{"type":"string"},{"type":"null"}]},"strength":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["form","id","name","quantityUnit","strength"],"additionalProperties":false},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":1,"maximum":9007199254740991},"refills":{"type":"integer","minimum":0,"maximum":9007199254740991},"substitutionPermitted":{"type":"boolean"}},"required":["compoundingReason","directions","id","medication","notes","price","quantity","refills","substitutionPermitted"],"additionalProperties":false}},"shippingOption":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["shp_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"price":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","price"],"additionalProperties":false},{"type":"null"}]},"shipments":{"type":"array","items":{"type":"object","properties":{"carrier":{"anyOf":[{"type":"string"},{"type":"null"}]},"trackingNumber":{"type":"string"},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["carrier","trackingNumber","trackingUrl"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"statusHistory":{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string"},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]}},"required":["createdAt","status"],"additionalProperties":false}},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"updatedAt":{"type":"string"}},"required":["cancelRequestedAt","createdAt","externalOrderId","failureReason","id","mode","patient","patientId","pharmacy","practice","practiceId","prescriber","prescriptions","shippingOption","shipments","status","trackingUrl","statusHistory","total","updatedAt"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"OrdersGet400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"OrdersGet401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"OrdersGet403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"OrdersGet404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"OrdersGet429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"Read one order and its prescriptions in the API key's organization and mode.","summary":"Read an order","x-visibility":"public"}},"/v1/practices":{"post":{"tags":["Practices"],"operationId":"practices.create","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":true,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"PracticesCreateResponse","type":"object","properties":{"id":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]},"liveEnabled":{"type":"boolean","description":"Effective Live access. A managed practice requires both its own Live setting and its platform's Live access."},"createdAt":{"type":"string"}},"required":["id","name","phone","address","liveEnabled","createdAt"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"PracticesCreate400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"PracticesCreate401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"PracticesCreate403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"PracticesCreate404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"PracticesCreate409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"415":{"description":"Unsupported media type. Send Content-Type: application/json.","content":{"application/problem+json":{"schema":{"additionalProperties":false,"properties":{"code":{"type":"string","examples":["unsupported_media_type"]},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"422":{"description":"HTTP 422","content":{"application/problem+json":{"schema":{"title":"PracticesCreate422Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"PracticesCreate429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"503":{"description":"HTTP 503","content":{"application/problem+json":{"schema":{"title":"PracticesCreate503Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"object","properties":{"line1":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"line2":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200},{"type":"null"}]},"city":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":100,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"state":{"type":"string","pattern":"^(?:AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|AS|GU|MP|PR|VI|AA|AE|AP)$"},"postalCode":{"type":"string","pattern":"^\\d{5}(-\\d{4})?$"}},"required":["line1","city","state","postalCode"],"additionalProperties":false},"liveEnabled":{"type":"boolean"},"name":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":120,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"phone":{"type":"string","pattern":"^\\+1\\d{10}$"}},"required":["address","name","phone"],"additionalProperties":false}}},"required":true,"description":"Send the JSON body with Content-Type: application/json."},"description":"Platforms only. Name, phone and address are required. The practice starts in Test; `liveEnabled: true` also allows new Live orders, which needs a platform with Live access and a Live caller: a Live key, or a session in Live mode. Turning Live off later preserves access to existing records.","summary":"Create a practice","x-visibility":"public"},"get":{"tags":["Practices"],"operationId":"practices.list","parameters":[{"name":"endingBefore","in":"query","schema":{"type":"string","maxLength":2048,"description":"Page backward before this opaque cursor. Keep the same filters, sort, organization and mode. Send either startingAfter or endingBefore."},"required":false,"description":"Page backward before this opaque cursor. Keep the same filters, sort, organization and mode. Send either startingAfter or endingBefore."},{"name":"limit","in":"query","schema":{"type":"string","description":"Maximum records per page, from 1 to 100. Defaults to 25."},"required":false,"description":"Maximum records per page, from 1 to 100. Defaults to 25."},{"name":"startingAfter","in":"query","schema":{"type":"string","maxLength":2048,"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},"required":false,"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},{"name":"query","in":"query","schema":{"type":"string","maxLength":120,"description":"Match practice names containing this text, ignoring case. Restart pagination after changing query."},"required":false,"description":"Match practice names containing this text, ignoring case. Restart pagination after changing query."},{"name":"sort","in":"query","schema":{"type":"string","enum":["name","-name","location","-location","mode","-mode","created","-created"],"description":"name and location sort A to Z; mode sorts Test before Live; created sorts oldest first. A leading - reverses the order. Defaults to -created. Missing locations sort last. Restart pagination after changing sort."},"required":false,"description":"name and location sort A to Z; mode sorts Test before Live; created sorts oldest first. A leading - reverses the order. Defaults to -created. Missing locations sort last. Restart pagination after changing sort."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"PracticesListResponse","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]},"liveEnabled":{"type":"boolean","description":"Effective Live access. A managed practice requires both its own Live setting and its platform's Live access."},"createdAt":{"type":"string"}},"required":["id","name","phone","address","liveEnabled","createdAt"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"object":{"type":"string","enum":["list"]},"url":{"type":"string"}},"required":["data","hasMore","nextCursor","object","url"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"PracticesList400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"PracticesList401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"PracticesList403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"PracticesList404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"PracticesList429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"List the platform's practices, newest first. Available to platforms only. `sort` takes `name` or `location` (A to Z, practices without a location last), `mode` (Test before Live) or `created` (oldest first); a leading `-` reverses.","summary":"List practices","x-pier-pagination":{"cursorField":"id","kind":"cursor"},"x-visibility":"public"}},"/v1/practices/{practiceId}":{"get":{"tags":["Practices"],"operationId":"practices.get","parameters":[{"name":"practiceId","in":"path","schema":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"PracticesGetResponse","type":"object","properties":{"id":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]},"liveEnabled":{"type":"boolean","description":"Effective Live access. A managed practice requires both its own Live setting and its platform's Live access."},"createdAt":{"type":"string"}},"required":["id","name","phone","address","liveEnabled","createdAt"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"PracticesGet400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"PracticesGet401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"PracticesGet403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"PracticesGet404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"PracticesGet429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"Read one practice accessible to the API key. A platform can read its own practices.","summary":"Read a practice","x-visibility":"public"},"patch":{"tags":["Practices"],"operationId":"practices.update","parameters":[{"name":"practiceId","in":"path","schema":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":true,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"PracticesUpdateResponse","type":"object","properties":{"id":{"type":"string","pattern":"^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["prac_01j2y8m6jcc9tt24af5pw9x1bc"]},"name":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["line1","line2","city","state","postalCode"],"additionalProperties":false},{"type":"null"}]},"liveEnabled":{"type":"boolean","description":"Effective Live access. A managed practice requires both its own Live setting and its platform's Live access."},"createdAt":{"type":"string"}},"required":["id","name","phone","address","liveEnabled","createdAt"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"415":{"description":"Unsupported media type. Send Content-Type: application/json.","content":{"application/problem+json":{"schema":{"additionalProperties":false,"properties":{"code":{"type":"string","examples":["unsupported_media_type"]},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"422":{"description":"HTTP 422","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate422Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"503":{"description":"HTTP 503","content":{"application/problem+json":{"schema":{"title":"PracticesUpdate503Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"line2":{"anyOf":[{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":200},{"type":"null"}]},"city":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":100,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"state":{"type":"string","pattern":"^(?:AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|AS|GU|MP|PR|VI|AA|AE|AP)$"},"postalCode":{"type":"string","pattern":"^\\d{5}(-\\d{4})?$"}},"additionalProperties":false},{"type":"null"}]},"liveEnabled":{"type":"boolean"},"name":{"type":"string","pattern":"^[^\\p{Cc}\\p{Cf}\\p{Cs}\\p{Zl}\\p{Zp}]*$","maxLength":120,"allOf":[{"pattern":"[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Cs}\\p{Default_Ignorable_Code_Point}\\p{M}\\u2800]","description":"Text with at least one visible character."}]},"phone":{"anyOf":[{"type":"string","pattern":"^\\+1\\d{10}$"},{"type":"null"}]}},"additionalProperties":false}}},"required":true,"description":"Send the JSON body with Content-Type: application/json."},"description":"`liveEnabled` allows or refuses new Live orders. Existing records, cancellation, webhooks and billing keep working. Only its platform changes it; enabling requires platform Live access, and either change needs a Live caller: a Live key (403 live_key_required otherwise) or a session in Live mode (403 live_mode_required otherwise). Live orders send `name`, `phone` and `address` to the pharmacy, so a practice with Live access changes them only with a Live key (403 live_mode_required otherwise).","summary":"Update a practice","x-visibility":"public"}},"/v1/webhook-endpoints":{"post":{"tags":["Webhooks"],"operationId":"webhooks.create","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":true,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"WebhooksCreateResponse","type":"object","properties":{"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"mode":{"type":"string","enum":["test","live"]},"id":{"type":"string","pattern":"^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["whe_01j2y8m6jcc9tt24af5pw9x1bc"]},"url":{"type":"string"},"secret":{"type":"string"}},"required":["createdAt","updatedAt","mode","id","url","secret"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"WebhooksCreate400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"WebhooksCreate401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"WebhooksCreate403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"WebhooksCreate404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"WebhooksCreate409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"415":{"description":"Unsupported media type. Send Content-Type: application/json.","content":{"application/problem+json":{"schema":{"additionalProperties":false,"properties":{"code":{"type":"string","examples":["unsupported_media_type"]},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"422":{"description":"HTTP 422","content":{"application/problem+json":{"schema":{"title":"WebhooksCreate422Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"WebhooksCreate429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","minLength":4,"maxLength":2048}},"required":["url"],"additionalProperties":false}}},"required":true,"description":"Send the JSON body with Content-Type: application/json."},"description":"Platforms and independent practices can register up to 16 public HTTPS endpoints per mode. An API key acts only for its own organization and mode. Every event goes to every endpoint. The signing secret is returned by creation and its idempotent replay for 24 hours.","summary":"Add a webhook endpoint","x-visibility":"public"},"get":{"tags":["Webhooks"],"operationId":"webhooks.list","parameters":[{"name":"endingBefore","in":"query","schema":{"type":"string","maxLength":2048,"description":"Page backward before this opaque cursor. Keep the same filters, sort, organization and mode. Send either startingAfter or endingBefore."},"required":false,"description":"Page backward before this opaque cursor. Keep the same filters, sort, organization and mode. Send either startingAfter or endingBefore."},{"name":"limit","in":"query","schema":{"type":"string","description":"Maximum records per page, from 1 to 100. Defaults to 25."},"required":false,"description":"Maximum records per page, from 1 to 100. Defaults to 25."},{"name":"startingAfter","in":"query","schema":{"type":"string","maxLength":2048,"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},"required":false,"description":"Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode. Use only one cursor parameter."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"WebhooksListResponse","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"mode":{"type":"string","enum":["test","live"]},"id":{"type":"string","pattern":"^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["whe_01j2y8m6jcc9tt24af5pw9x1bc"]},"url":{"type":"string"}},"required":["createdAt","updatedAt","mode","id","url"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"object":{"type":"string","enum":["list"]},"url":{"type":"string"}},"required":["data","hasMore","nextCursor","object","url"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"WebhooksList400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"WebhooksList401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"WebhooksList403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"WebhooksList404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"WebhooksList429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"List webhook endpoints owned by the API key's organization in its current mode. Signing secrets are not returned.","summary":"List webhook endpoints of the current mode","x-pier-pagination":{"cursorField":"id","kind":"cursor"},"x-visibility":"public"}},"/v1/webhook-endpoints/{webhookEndpointId}":{"delete":{"tags":["Webhooks"],"operationId":"webhooks.remove","parameters":[{"name":"webhookEndpointId","in":"path","schema":{"type":"string","pattern":"^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["whe_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"WebhooksRemoveResponse","type":"object","properties":{"deleted":{"type":"boolean","enum":[true]},"id":{"type":"string","pattern":"^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["whe_01j2y8m6jcc9tt24af5pw9x1bc"]}},"required":["deleted","id"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"WebhooksRemove400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"WebhooksRemove401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"WebhooksRemove403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"WebhooksRemove404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"WebhooksRemove429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"Events not delivered to it yet are dropped.","summary":"Delete a webhook endpoint","x-visibility":"public"},"patch":{"tags":["Webhooks"],"operationId":"webhooks.update","parameters":[{"name":"webhookEndpointId","in":"path","schema":{"type":"string","pattern":"^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["whe_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":true,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"WebhooksUpdateResponse","type":"object","properties":{"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"mode":{"type":"string","enum":["test","live"]},"id":{"type":"string","pattern":"^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["whe_01j2y8m6jcc9tt24af5pw9x1bc"]},"url":{"type":"string"}},"required":["createdAt","updatedAt","mode","id","url"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"WebhooksUpdate400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"WebhooksUpdate401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"WebhooksUpdate403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"WebhooksUpdate404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"WebhooksUpdate409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"415":{"description":"Unsupported media type. Send Content-Type: application/json.","content":{"application/problem+json":{"schema":{"additionalProperties":false,"properties":{"code":{"type":"string","examples":["unsupported_media_type"]},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"422":{"description":"HTTP 422","content":{"application/problem+json":{"schema":{"title":"WebhooksUpdate422Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"WebhooksUpdate429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","minLength":4,"maxLength":2048}},"required":["url"],"additionalProperties":false}}},"required":true,"description":"Send the JSON body with Content-Type: application/json."},"description":"The signing secret stays the same.","summary":"Change a webhook endpoint's URL","x-visibility":"public"}},"/v1/webhook-endpoints/{webhookEndpointId}/resend-failed":{"post":{"tags":["Webhooks"],"operationId":"webhooks.resendFailed","parameters":[{"name":"webhookEndpointId","in":"path","schema":{"type":"string","pattern":"^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["whe_01j2y8m6jcc9tt24af5pw9x1bc"]},"required":true},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[\\x21-\\x7e]{1,255}$","description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},"required":true,"description":"A unique key per operation, 1 to 255 printable ASCII characters without spaces. A retry with the same key returns the original response."},{"description":"The dated API version this request is written against.","in":"header","name":"Affinity-Version","required":true,"schema":{"default":"2026-10-20","enum":["2026-10-20"],"type":"string"}}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"HTTP 200","content":{"application/json":{"schema":{"title":"WebhooksResendFailedResponse","type":"object","properties":{"queued":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"The number of failed deliveries queued for retry."}},"required":["queued"],"additionalProperties":false}}}},"400":{"description":"HTTP 400","content":{"application/problem+json":{"schema":{"title":"WebhooksResendFailed400Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"401":{"description":"HTTP 401","content":{"application/problem+json":{"schema":{"title":"WebhooksResendFailed401Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"403":{"description":"HTTP 403","content":{"application/problem+json":{"schema":{"title":"WebhooksResendFailed403Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"404":{"description":"HTTP 404","content":{"application/problem+json":{"schema":{"title":"WebhooksResendFailed404Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"409":{"description":"HTTP 409","content":{"application/problem+json":{"schema":{"title":"WebhooksResendFailed409Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}},"429":{"description":"HTTP 429","content":{"application/problem+json":{"schema":{"title":"WebhooksResendFailed429Response","additionalProperties":false,"properties":{"code":{"type":"string"},"detail":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"data":{"type":"object"},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"field":{"type":"string"},"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]}}},"required":["code","field","message","path"],"additionalProperties":false}},"instance":{"type":"string"},"requestId":{"type":"string"},"status":{"type":"integer"},"traceId":{"type":"string"}},"required":["code","detail","instance","requestId","status","title","type"],"type":"object"}}}}},"description":"Queue failed order event deliveries from the last 30 days for this endpoint. Only the current organization and mode apply. The worker retries each delivery up to 12 times with the same event ID and payload. Delivered, pending, and test events stay unchanged. Send a unique Idempotency-Key for each request. Reuse that key after an uncertain response to return the original count. A new request queues only deliveries that are still failed.","summary":"Resend failed webhook deliveries","x-visibility":"public"}}},"components":{"schemas":{},"securitySchemes":{"apiKey":{"bearerFormat":"sk_test_… or sk_live_…","description":"Send Authorization: Bearer <key> with an active API key from the Affinity dashboard. Test and Live keys act in their mode.","scheme":"bearer","type":"http"}}},"security":[],"tags":[{"name":"api"}],"webhooks":{"orderEvent":{"post":{"summary":"Receive an Affinity event","requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^evt_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["evt_01j2y8m6jcc9tt24af5pw9x1bc"]},"type":{"type":"string","enum":["order.cancelled","order.delivered","order.failed","order.processing","order.shipped","order.submitted","order.updated"]},"createdAt":{"type":"string"},"data":{"type":"object","properties":{"order":{"type":"object","properties":{"cancelRequestedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalOrderId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"type":"string","pattern":"^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["ord_01j2y8m6jcc9tt24af5pw9x1bc"]},"shipments":{"type":"array","items":{"type":"object","properties":{"carrier":{"anyOf":[{"type":"string"},{"type":"null"}]},"trackingNumber":{"type":"string"},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["carrier","trackingNumber","trackingUrl"],"additionalProperties":true}},"status":{"type":"string","enum":["submitted","processing","shipped","delivered","cancelled","failed"]},"trackingUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"type":"string"}},"required":["cancelRequestedAt","externalOrderId","failureReason","id","shipments","status","trackingUrl","updatedAt"],"additionalProperties":true}},"required":["order"],"additionalProperties":true}},"required":["id","type","createdAt","data"],"additionalProperties":true},{"type":"object","properties":{"id":{"type":"string","pattern":"^evt_[0-7][0-9a-hjkmnp-tv-z]{25}$","examples":["evt_01j2y8m6jcc9tt24af5pw9x1bc"]},"type":{"type":"string","enum":["webhook_endpoint.test"]},"createdAt":{"type":"string"},"data":{"not":{"type":"null"}}},"required":["id","type","createdAt","data"],"additionalProperties":true}]}}}},"responses":{"200":{"description":"Event accepted"}}}}},"servers":[{"url":"https://api.affinityrx.com"}]}