> For the complete documentation index, see [llms.txt](https://docs.mdintegrations.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mdintegrations.com/partner-api-reference/cases/orders/update-a-case-order.md).

# Update a case order

Updates a case order's date and payment status/date, pushing the date change to the pharmacy fulfillment API and persisting the response locally. When a clinician updates the order, it also checks that the clinician holds a license for the patient's state.

```json
{"openapi":"3.1.0","info":{"title":"MD Integrations","version":"1.0.0"},"tags":[{"name":"Cases/Orders"}],"servers":[{"url":"https://api.mdintegrations.dev/v1","description":"Development"}],"security":[{"oauth2":[]}],"components":{"securitySchemes":{"oauth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.mdintegrations.dev/v1/partner/auth/token","scopes":{"*":"Full partner account access"}}}}},"schemas":{"PatchCaseOrderRequest":{"type":"object","properties":{"date":{"type":["string","null"],"format":"date-time"},"payment_status":{"type":["string","null"]},"payment_date":{"type":["string","null"],"format":"date-time"}},"title":"PatchCaseOrderRequest"},"CaseOrderResource":{"type":"object","properties":{"id":{"type":"string","description":"Attributes;"},"case_id":{"type":"string"},"external_id":{"type":"string"},"pharmacy_id":{"type":"string"},"prescriptions_id":{"type":"array","items":{}},"status":{"type":"string"},"details":{"type":["string","null"]},"status_details":{"type":["string","null"],"description":"retrocompatibility"},"status_metadata":{"type":["string","null"]},"number":{"type":["string","null"]},"date":{"type":["string","null"]},"tracking_number":{"type":["string","null"]},"tracking_url":{"type":["string","null"]},"tracking_metadata":{"type":["string","null"]},"tracked_at":{"type":["string","null"]},"sequence_number":{"type":["integer","null"]},"sequence_total":{"type":["integer","null"]},"sequence_order_id":{"type":["string","null"]},"acknowledged_at":{"type":["string","null"]},"acknowledged_id":{"type":["string","null"]},"acknowledged_metadata":{"type":["string","null"]},"payment_date":{"type":["string","null"]},"payment_status":{"type":["string","null"]},"pharmacy_name":{"type":["string","null"],"description":"appends;"},"case":{"$ref":"#/components/schemas/CaseByStatusResource"},"offerings":{"type":"array","items":{"$ref":"#/components/schemas/CaseOfferingResource"}},"orders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"external_id":{"type":"string"},"status":{"type":"string"},"status_details":{"type":"string"},"number":{"type":"string"},"sequence_number":{"type":"string"},"sequence_total":{"type":"string"},"sequence_order_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"date":{"type":"string"}},"required":["id","external_id","status","status_details","number","sequence_number","sequence_total","sequence_order_id","created_at","updated_at","date"]}},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"deleted_at":{"type":["string","null"],"format":"date-time"}},"required":["id","case_id","external_id","pharmacy_id","prescriptions_id","status","details","status_details","status_metadata","number","date","tracking_number","tracking_url","tracking_metadata","tracked_at","sequence_number","sequence_total","sequence_order_id","acknowledged_at","acknowledged_id","acknowledged_metadata","payment_date","payment_status","pharmacy_name","case","created_at","updated_at","deleted_at"],"title":"CaseOrderResource"},"CaseByStatusResource":{"type":"object","properties":{"case_id":{"type":"string","description":"Attributes;"},"external_id":{"type":"string"},"metadata":{"type":"string"},"is_additional_approval_needed":{"type":"string"},"prioritized_at":{"type":"string"},"programs":{"type":"string"},"tier":{"type":"string"},"prioritized_reason":{"type":"string"},"prioritized":{"type":"string"},"partner_id":{"type":"string"},"reference_case_id":{"type":"string"},"patient_exam_id":{"type":"string"},"service_pdf_exported":{"type":"string"},"case_type":{"type":"string"},"is_chargeable":{"type":"string"},"is_upsell_generated":{"type":"string"},"charged_by":{"type":"string"},"is_sync":{"type":"string"},"is_video_consult_required":{"type":"string"},"case_status":{"type":"object","properties":{"name":{"type":"string"},"reason":{"type":"string"},"updated_at":{"type":"string"},"created_at":{"type":"string"}},"required":["name","reason","updated_at","created_at"]},"created_at":{"type":"string"},"patient":{"type":"object","properties":{"patient_id":{"type":"string"},"date_of_birth":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"external_id":{"type":"string"},"metadata":{"type":"string"},"gender":{"type":"string"},"gender_label":{"type":"string"},"email":{"type":"string"},"phone_number":{"type":"string"},"pregnancy":{"type":"string"},"address":{"anyOf":[{"type":"array","items":{"type":"string"},"minItems":0,"maxItems":0,"additionalItems":false},{"type":"object","properties":{"address_id":{"type":"string"},"address":{"type":"string"},"address2":{"type":"string"},"city_name":{"type":"string"},"zip_code":{"type":"string"},"state":{"type":"object","properties":{"state_id":{"type":"string"},"abbreviation":{"type":"string"},"name":{"type":"string"},"is_sync":{"type":"string"},"country":{"type":"object","properties":{"state_id":{"type":"string"},"abbreviation":{"type":"string"}},"required":["state_id","abbreviation"]}},"required":["state_id","abbreviation","name","is_sync","country"]}},"required":["address_id","address","address2","city_name","zip_code","state"]}]}},"required":["patient_id","date_of_birth","first_name","last_name","external_id","metadata","gender","gender_label","email","phone_number","pregnancy","address"]},"case_assignment":{"anyOf":[{"type":"array","items":{"type":"string"},"minItems":0,"maxItems":0,"additionalItems":false},{"type":"object","properties":{"created_at":{"type":"string"},"reason":{"type":"string"},"clinician_id":{"type":"string"},"clinician":{"anyOf":[{"type":"array","items":{"type":"string"},"minItems":0,"maxItems":0,"additionalItems":false},{"type":"object","properties":{"clinician_id":{"type":"string"},"clinician_specialty":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"full_name":{"type":"string"},"is_online":{"type":"string"},"photo":{"type":["object","null"],"properties":{"url_thumbnail":{"type":"string"}},"required":["url_thumbnail"]}},"required":["clinician_id","clinician_specialty","first_name","last_name","full_name","is_online","photo"]}]}},"required":["created_at","reason","clinician_id","clinician"]}]},"case_prescriptions":{"type":"array","items":{"type":"string"},"minItems":0,"maxItems":0,"additionalItems":false},"case_offerings":{"type":"array","items":{"type":"object","properties":{"case_offering_id":{"type":"string"},"case_prescription_id":{"type":"string"},"is_important":{"type":"string"},"order":{"type":"string"},"name":{"type":"string"},"title":{"type":"string"}},"required":["case_offering_id","case_prescription_id","is_important","order","name","title"]}},"case_services":{"type":"string"},"diseases":{"type":"string"},"tags":{"type":"string"},"orders":{"type":"string"}},"required":["case_id","external_id","metadata","is_additional_approval_needed","prioritized_at","programs","tier","prioritized_reason","prioritized","partner_id","reference_case_id","patient_exam_id","service_pdf_exported","case_type","is_chargeable","is_upsell_generated","charged_by","is_sync","case_status","created_at","patient","case_assignment","case_prescriptions","case_offerings","case_services","diseases","tags","orders"],"title":"CaseByStatusResource"},"CaseOfferingResource":{"type":"object","properties":{"id":{"type":"string","description":"Attributes;"},"case_offering_id":{"type":"string"},"title":{"type":"string"},"name":{"type":"string"},"directions":{"type":"string"},"is_additional_approval_needed":{"type":"string"},"thank_you_note":{"type":"string"},"clinical_note":{"type":"string"},"status":{"type":"string"},"status_details":{"type":"string"},"has_recommendations":{"type":"string"},"recommendation_message":{"type":["string","null"],"description":"virtual attribute from CasePrescription model"},"store_url":{"type":["string","null"],"description":"virtual attribute from Offering model"},"product_name":{"type":["string","null"],"description":"virtual attribute from Offering model"},"image_file_id":{"type":["string","null"],"description":"virtual attribute from Offering model"},"order":{"type":"string","description":"virtual attribute from Offering model"},"upcharged":{"type":"string"},"offering_cost":{"type":"string"},"clinician_extra_fee":{"type":"string"},"is_important":{"type":"string"},"offerable_type":{"type":"string"},"offerable_id":{"type":"string"},"order_status":{"type":"string"},"order_date":{"type":"string"},"order_details":{"type":"string"},"order_updated":{"type":"string"},"programs":{"type":"string"},"external_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"},"submitted_at":{"type":"string"},"product":{"type":"string"},"product_id":{"type":["string","null"]},"product_type":{"type":["string","null"]},"diseases":{"type":"array","items":{"$ref":"#/components/schemas/DiseaseResource"}}},"required":["id","case_offering_id","title","name","directions","is_additional_approval_needed","thank_you_note","clinical_note","status","status_details","has_recommendations","recommendation_message","store_url","product_name","image_file_id","order","upcharged","offering_cost","clinician_extra_fee","is_important","offerable_type","offerable_id","order_status","order_date","order_details","order_updated","programs","external_id","created_at","updated_at","deleted_at","submitted_at","product","product_id","product_type","diseases"],"title":"CaseOfferingResource"},"DiseaseResource":{"type":"object","properties":{"id":{"type":"string","description":"Attributes;"},"disease_id":{"type":"string"},"icd":{"type":"string"},"description":{"type":"string"},"dosespot_id":{"type":["integer","null"]},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"deleted_at":{"type":["string","null"],"format":"date-time"},"is_primary":{"type":"string"},"pivot":{"type":"object","description":"Pivot Attributes (Compound);","properties":{"disease_id":{"type":"string","description":"When loaded;"},"partner_compound_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["disease_id","partner_compound_id","created_at","updated_at"]}},"required":["id","disease_id","icd","description","dosespot_id","created_at","updated_at","deleted_at"],"title":"DiseaseResource"}},"responses":{"AuthorizationException":{"description":"Authorization error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Error overview."}},"required":["message"]}}}},"ModelNotFoundException":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Error overview."}},"required":["message"]}}}},"ValidationException":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Errors overview."},"errors":{"type":"object","description":"A detailed description of each field that failed validation.","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["message","errors"]}}}}}},"paths":{"/partner/cases/{case}/orders/{caseOrder}":{"patch":{"operationId":"order.patchOrder","description":"Updates a case order's date and payment status/date, pushing the date change to the pharmacy\nfulfillment API and persisting the response locally. When a clinician updates the order, it also\nchecks that the clinician holds a license for the patient's state.","summary":"Update a case order","tags":["Cases/Orders"],"parameters":[{"name":"case","in":"path","required":true,"description":"The case ID","schema":{"type":"string"}},{"name":"caseOrder","in":"path","required":true,"description":"The case order ID","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchCaseOrderRequest"}}}},"responses":{"200":{"description":"`CaseOrderResource`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOrderResource"}}}},"403":{"$ref":"#/components/responses/AuthorizationException"},"404":{"$ref":"#/components/responses/ModelNotFoundException"},"422":{"$ref":"#/components/responses/ValidationException"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mdintegrations.com/partner-api-reference/cases/orders/update-a-case-order.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
