> 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/prescriptions/cancel-a-cases-prescription-only-if-the-case-was-completed-and-prescription-was-sent.md).

# Cancel a case's prescription only if the case was completed and prescription was sent

Cancels a prescription that has already been sent to the pharmacy, which is only allowed once the case is in the completed status. The prescription must belong to the case and must already be synced with the pharmacy.

```json
{"openapi":"3.1.0","info":{"title":"MD Integrations","version":"1.0.0"},"tags":[{"name":"Cases/Prescriptions"}],"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":{"CancelCasePrescriptionRequest":{"type":"object","properties":{"reason":{"type":["string","null"]}},"title":"CancelCasePrescriptionRequest"},"CasePrescriptionResource":{"type":"object","properties":{"id":{"type":"string"},"case_prescription_id":{"type":"string"},"order":{"type":["integer","null"]},"title":{"type":["string","null"]},"name":{"type":["string","null"]},"is_important":{"type":["string","null"]},"refills":{"type":["integer","null"]},"quantity":{"type":["string","null"]},"days_supply":{"type":["string","null"]},"directions":{"type":["string","null"]},"dispense_unit_id":{"type":["string","null"]},"is_additional_approval_needed":{"type":"string"},"dispense_unit_name":{"type":["string","null"]},"pharmacy_id":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"null"}]},"pharmacy_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"thank_you_note":{"type":["string","null"]},"thank_you_files":{"type":"array","items":{"$ref":"#/components/schemas/App.Http.Resources.FileResource"}},"clinical_note":{"type":["string","null"]},"dosespot_prescription_id":{"type":["integer","null"]},"status":{"type":"string"},"effective_date":{"type":["string","null"]},"status_details":{"type":["string","null"]},"upcharged":{"type":["string","null"]},"clinician_extra_fee":{"type":["string","null"]},"pharmacy_notes":{"type":["string","null"]},"no_substitutions":{"type":"boolean"},"dosespot_display_name":{"type":"string"},"offering_cost":{"type":["string","null"]},"is_insurance_check_needed":{"type":["string","null"]},"dosespot_prescription_benefits":{"type":"string"},"dosespot_prior_auth_id":{"type":"string"},"dosespot_prior_auth_status":{"type":"string"},"dosespot_prior_auth_status_details":{"type":"string"},"dosespot_prior_auth_status_at":{"type":"string"},"dosespot_prior_auth_details":{"type":"string"},"medication":{"type":["string","null"]},"partner_compound":{"type":["array","null"],"items":{}},"partner_supply":{"type":["object","null"],"properties":{"ndc":{"type":["string","null"]},"name":{"type":["string","null"]},"active":{"type":["string","null"]},"refills":{"type":["string","null"]},"metadata":{"type":["string","null"]},"quantity":{"type":["string","null"]},"directions":{"type":["string","null"]},"days_supply":{"type":["string","null"]},"pharmacy_id":{"type":["string","null"]},"clinical_note":{"type":["string","null"]},"dispense_unit":{"type":["string","null"]},"pharmacy_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"pharmacy_notes":{"type":["string","null"]},"thank_you_note":{"type":["string","null"]},"dispense_unit_id":{"type":["string","null"]},"partner_supply_id":{"type":["string","null"]},"dosespot_supply_id":{"type":["string","null"]}},"required":["ndc","name","active","refills","metadata","quantity","directions","days_supply","pharmacy_id","clinical_note","dispense_unit","pharmacy_name","pharmacy_notes","thank_you_note","dispense_unit_id","partner_supply_id","dosespot_supply_id"]},"offering":{"type":["object","null"],"properties":{"offering_id":{"type":["string","null"]},"name":{"type":["string","null"]},"title":{"type":["string","null"]}},"required":["offering_id","name","title"]},"offerable_type":{"type":["string","null"]},"offerable_id":{"type":["string","null"]},"diseases":{"type":"array","items":{"$ref":"#/components/schemas/App.Http.Resources.V1.DiseaseResource"}}},"required":["id","case_prescription_id","order","title","name","is_important","refills","quantity","days_supply","directions","dispense_unit_id","is_additional_approval_needed","dispense_unit_name","pharmacy_id","pharmacy_name","thank_you_note","thank_you_files","clinical_note","dosespot_prescription_id","status","effective_date","status_details","upcharged","clinician_extra_fee","pharmacy_notes","no_substitutions","dosespot_display_name","offering_cost","is_insurance_check_needed","dosespot_prescription_benefits","dosespot_prior_auth_id","dosespot_prior_auth_status","dosespot_prior_auth_status_details","dosespot_prior_auth_status_at","dosespot_prior_auth_details","medication","partner_compound","partner_supply","offering","offerable_type","offerable_id","diseases"],"title":"CasePrescriptionResource"},"App.Http.Resources.FileResource":{"type":"object","properties":{"id":{"type":"string","description":"Attributes;"},"name":{"type":"string"},"type":{"type":["string","null"]},"mime_type":{"type":"string"},"path":{"type":"string"},"metadata":{"type":["array","null"],"items":{}},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"deleted_at":{"type":["string","null"],"format":"date-time"},"url":{"type":"string","description":"Appended Attributes;"},"url_thumbnail":{"type":"string"},"pivot":{"type":"object","description":"Pivot Attributes (Partner);","properties":{"file_id":{"type":"string","description":"When loaded;"},"partner_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["file_id","partner_id","title","type","created_at","updated_at"]},"file_id":{"type":"string","description":"Keep compatibility;"}},"required":["id","name","type","mime_type","path","metadata","created_at","updated_at","deleted_at","url","url_thumbnail","file_id"],"title":"App.Http.Resources.FileResource"},"App.Http.Resources.V1.DiseaseResource":{"type":"object","properties":{"disease_id":{"type":"string"},"icd":{"type":"string"},"description":{"type":"string"},"is_primary":{"type":"string"}},"required":["disease_id","icd","description"],"title":"App.Http.Resources.V1.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}/prescriptions/{casePrescription}/cancel":{"patch":{"operationId":"case.cancelCasePrescription","description":"Cancels a prescription that has already been sent to the pharmacy, which is only\nallowed once the case is in the completed status. The prescription must belong to\nthe case and must already be synced with the pharmacy.","summary":"Cancel a case's prescription only if the case was completed and prescription was sent","tags":["Cases/Prescriptions"],"parameters":[{"name":"case","in":"path","required":true,"description":"The case ID","schema":{"type":"string"}},{"name":"casePrescription","in":"path","required":true,"description":"The case prescription ID","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelCasePrescriptionRequest"}}}},"responses":{"200":{"description":"Array of `CasePrescriptionResource`","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CasePrescriptionResource"}}}}},"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/prescriptions/cancel-a-cases-prescription-only-if-the-case-was-completed-and-prescription-was-sent.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.
