---
agentTools:
  projectIndex: https://cannaflow.readme.io/llms.txt
---

# Submit a prescription

Submit a new prescription order

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Cannaflow API",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api-pharmacy.cannaflow.de/api/v1",
      "description": "production"
    },
    {
      "url": "https://api-pharmacy.sandbox.cannaflow.de/api/v1",
      "description": "sandbox"
    },
    {
      "url": "https://api-pharmacy.cannaflow-staging.de/api/v1",
      "description": "staging"
    }
  ],
  "externalDocs": {
    "url": "https://api-pharmacy.sandbox.cannaflow.de/document/v1"
  },
  "paths": {
    "/prescriptions": {
      "post": {
        "operationId": "prescriptions-create",
        "summary": "Submit a prescription",
        "description": "Submit a new prescription order",
        "tags": [
          "Prescriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "referenceId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "An ID used to identify the prescription. This id should be unique in your system (e.g. internal ID of your treatment/prescription)."
                  },
                  "referencePatientId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "description": "Optional patient identifier from your system"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "referencePharmacyId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "description": "Optional pharmacy identifier from your system"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "signedDocument": {
                    "description": "DEPRECATED: Use signedDocuments instead. Single base64 encoded signed prescription document without MIME-type prefix. If not provided, the signed document must be submitted later via POST /prescriptions/{id}/document before the pharmacy can process the order.",
                    "type": "string"
                  },
                  "signedDocuments": {
                    "description": "Array of base64 encoded signed prescription documents without MIME-type prefix. Can be 0-n documents. If not provided, the signed document must be submitted later via POST /prescriptions/{id}/document before the pharmacy can process the order.",
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "Base64 encoded signed prescription document without MIME-type prefix"
                    }
                  },
                  "requireSignedDocumentBeforeCheckout": {
                    "description": "Send checkout url to the patient after signed document is submitted or always after the prescription is created. Default sends the email directly.",
                    "type": "boolean"
                  },
                  "designatedPharmacyId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Cannaflow pharmacy ID. If provided, the patient can only choose this pharmacy for their order. If the pharmacy is out of stock, the prescription cannot be created and an error is thrown."
                  },
                  "patient": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Patient's legal first name"
                      },
                      "lastName": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Patient's legal last name"
                      },
                      "birthDate": {
                        "type": "string",
                        "description": "Patient birth date in YYYY-MM-DD format"
                      },
                      "email": {
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                        "description": "Patient's email address for communications"
                      },
                      "phone": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Patient's contact phone number"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "street": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Street name"
                          },
                          "houseNumber": {
                            "type": "string",
                            "minLength": 1,
                            "description": "House or building number"
                          },
                          "addressLine2": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "postalCode": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Postal/ZIP code"
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "description": "City name"
                          },
                          "country": {
                            "description": "ISO 3166-1 alpha-2 country code",
                            "default": "DE",
                            "type": "string",
                            "minLength": 1
                          },
                          "latitude": {
                            "type": "number",
                            "description": "Latitude"
                          },
                          "longitude": {
                            "type": "number",
                            "description": "Longitude"
                          }
                        },
                        "required": [
                          "street",
                          "houseNumber",
                          "postalCode",
                          "city"
                        ],
                        "description": "Patient's residential address"
                      },
                      "deliveryAddress": {
                        "type": "object",
                        "properties": {
                          "street": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Street name"
                          },
                          "houseNumber": {
                            "type": "string",
                            "minLength": 1,
                            "description": "House or building number"
                          },
                          "addressLine2": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "postalCode": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Postal/ZIP code"
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "description": "City name"
                          },
                          "country": {
                            "description": "ISO 3166-1 alpha-2 country code",
                            "default": "DE",
                            "type": "string",
                            "minLength": 1
                          },
                          "latitude": {
                            "type": "number",
                            "description": "Latitude"
                          },
                          "longitude": {
                            "type": "number",
                            "description": "Longitude"
                          }
                        },
                        "required": [
                          "street",
                          "houseNumber",
                          "postalCode",
                          "city"
                        ],
                        "description": "Delivery address if different from address"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "birthDate",
                      "email",
                      "phone",
                      "address"
                    ],
                    "description": "Patient information"
                  },
                  "doctor": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Doctor's full name"
                      },
                      "phone": {
                        "description": "Doctor's contact phone number",
                        "type": "string"
                      },
                      "email": {
                        "description": "Doctor's email address",
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "description": "Prescribing doctor's information. Can be also provided by submitting the prescription."
                  },
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Product identifier"
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 1,
                          "description": "Prescribed quantity of the product"
                        }
                      },
                      "required": [
                        "id",
                        "quantity"
                      ]
                    },
                    "description": "Prescription-required cannabis products (Cannaflow registry item IDs). These are Rx-only items that must be prescribed by a doctor."
                  },
                  "nonPrescriptionProducts": {
                    "description": "BETA: Optional array of non-prescription products (standard, addon) that do not require a prescription but should be included in the order. Products will be preselected in checkout page.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Product ID (Cannaflow product ID)"
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 1,
                          "description": "Quantity of the product"
                        }
                      },
                      "required": [
                        "id",
                        "quantity"
                      ]
                    }
                  },
                  "prescriptionDate": {
                    "description": "Prescription date in YYYY-MM-DD format. Current date will be used if not provided",
                    "type": "string"
                  },
                  "notifications": {
                    "description": "Notification settings. Support for SMS notifications is coming soon.",
                    "default": {},
                    "type": "object",
                    "properties": {
                      "useSystemEmails": {
                        "description": "Flag to indicate if system emails should be used for communications with the patient. If false, no emails will be sent to the patient.",
                        "default": true,
                        "type": "boolean"
                      },
                      "notificationFilter": {
                        "description": "Filter for which email notifications are sent. When null/omitted, all emails are sent (no filter). When specified, only emails with value=true pass through. Supported types: orderCompleted, orderCanceled.",
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "orderCompleted": {
                                "type": "boolean"
                              },
                              "orderCanceled": {
                                "type": "boolean"
                              },
                              "orderShipped": {
                                "type": "boolean"
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    }
                  },
                  "cannaflowLeadReference": {
                    "type": "string",
                    "description": "Optional reference to a cannaflow lead"
                  },
                  "discountCode": {
                    "type": "string",
                    "description": "Discount code"
                  },
                  "metadata": {
                    "description": "Optional dynamic data attached to the prescription. Structure varies based on source."
                  }
                },
                "required": [
                  "referenceId",
                  "designatedPharmacyId",
                  "patient",
                  "doctor",
                  "products"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "referenceId": "treatment_123456",
                    "referencePatientId": "patient_789",
                    "prescriptionDate": "2024-03-20",
                    "designatedPharmacyId": "pharmacy_123",
                    "patient": {
                      "firstName": "Max",
                      "lastName": "Mustermann",
                      "birthDate": "1990-01-01",
                      "email": "max@example.com",
                      "phone": "+49176123456789",
                      "address": {
                        "street": "Hauptstraße",
                        "houseNumber": "42",
                        "addressLine2": null,
                        "postalCode": "10115",
                        "city": "Berlin",
                        "country": "DE"
                      }
                    },
                    "doctor": {
                      "name": "Dr. Jane Smith",
                      "phone": "+49301234567",
                      "email": "jane@example.com"
                    },
                    "products": [
                      {
                        "id": "CF0007",
                        "quantity": 10
                      }
                    ],
                    "notifications": {
                      "useSystemEmails": true
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "checkoutSessionUrl": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "URL to the checkout session, or null if the prescription was accepted as a draft (acceptAllPrescriptions enabled and product validation failed)."
                    },
                    "prescriptionId": {
                      "type": "string",
                      "description": "ID of the prescription. Use this to submit the signed prescription document."
                    }
                  },
                  "required": [
                    "checkoutSessionUrl",
                    "prescriptionId"
                  ],
                  "additionalProperties": false,
                  "example": {
                    "prescriptionId": "cs_123456789",
                    "checkoutSessionUrl": "https://marketplace.cannaflow.de/checkout/cs_123456789"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error.BAD_REQUEST"
                }
              }
            }
          },
          "401": {
            "description": "Authorization not provided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error.UNAUTHORIZED"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error.FORBIDDEN"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "error.UNAUTHORIZED": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The error message",
            "example": "Authorization not provided"
          },
          "code": {
            "type": "string",
            "description": "The error code",
            "example": "UNAUTHORIZED"
          },
          "issues": {
            "description": "An array of issues that were responsible for the error",
            "example": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "message",
          "code"
        ],
        "additionalProperties": false,
        "title": "Authorization not provided error (401)",
        "description": "The error information",
        "example": {
          "code": "UNAUTHORIZED",
          "message": "Authorization not provided",
          "issues": []
        }
      },
      "error.FORBIDDEN": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The error message",
            "example": "Insufficient access"
          },
          "code": {
            "type": "string",
            "description": "The error code",
            "example": "FORBIDDEN"
          },
          "issues": {
            "description": "An array of issues that were responsible for the error",
            "example": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "message",
          "code"
        ],
        "additionalProperties": false,
        "title": "Insufficient access error (403)",
        "description": "The error information",
        "example": {
          "code": "FORBIDDEN",
          "message": "Insufficient access",
          "issues": []
        }
      },
      "error.INTERNAL_SERVER_ERROR": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The error message",
            "example": "Internal server error"
          },
          "code": {
            "type": "string",
            "description": "The error code",
            "example": "INTERNAL_SERVER_ERROR"
          },
          "issues": {
            "description": "An array of issues that were responsible for the error",
            "example": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "message",
          "code"
        ],
        "additionalProperties": false,
        "title": "Internal server error error (500)",
        "description": "The error information",
        "example": {
          "code": "INTERNAL_SERVER_ERROR",
          "message": "Internal server error",
          "issues": []
        }
      },
      "error.BAD_REQUEST": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The error message",
            "example": "Invalid input data"
          },
          "code": {
            "type": "string",
            "description": "The error code",
            "example": "BAD_REQUEST"
          },
          "issues": {
            "description": "An array of issues that were responsible for the error",
            "example": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "message",
          "code"
        ],
        "additionalProperties": false,
        "title": "Invalid input data error (400)",
        "description": "The error information",
        "example": {
          "code": "BAD_REQUEST",
          "message": "Invalid input data",
          "issues": []
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "description": "Access token for the API",
        "name": "x-cannaflow-api-key",
        "in": "header"
      }
    }
  },
  "webhooks": {
    "prescription.checkout_completed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription checkout completed event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_checkout_completed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.payment_confirmed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription payment confirmed event. Sent when a payment is captured after checkout, e.g. a bank transfer confirmed by the pharmacy or a self-pickup order paid at the pharmacy (POS terminal or cash). Not sent for payments completed during checkout itself. Every order emits exactly one payment signal: prescription_checkout_completed if it was paid during checkout, or prescription_payment_confirmed if the payment was captured afterwards.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_payment_confirmed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.authorized": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription authorized event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_authorized"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "invoiceId": {
                    "type": "string",
                    "description": "Invoice ID"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "invoiceId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.packaged": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription packaged event. Opt-in replacement for `prescription.authorized`, enabled per telemedicine provider — you receive one or the other, never both.  `prescription.authorized` can only be sent when an invoice is created, so orders that are never invoiced at packaging (patient invoicing disabled, or payment collected later such as pay on delivery and pay at pickup) produce no event at all. This event is sent for every packaged order instead, with `invoiceId` null when no invoice exists yet.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_packaged"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "invoiceId": {
                    "type": "string",
                    "nullable": true,
                    "description": "Invoice ID, or null when the order has no invoice at packaging"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "invoiceId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.cancelled": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription cancelled event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_cancelled"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "description": "Cancellation reason"
                  },
                  "cancelledBy": {
                    "type": "string",
                    "enum": [
                      "telemedicineProvider",
                      "pharmacy"
                    ]
                  },
                  "refundedAmountCent": {
                    "type": "number",
                    "description": "Refunded amount in cents. If payment method supports it this amount was refunded to the patient."
                  },
                  "patientEmailSuppressed": {
                    "type": "boolean",
                    "description": "Only present when cancelledBy is \"pharmacy\". Indicates that the pharmacy suppressed the cancellation email to the patient. This is only relevant if you have disabled Cannaflow's transactional email notifications and handle patient communication yourself."
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "reason",
                  "cancelledBy",
                  "refundedAmountCent"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.completed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription completed event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_completed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.ready_for_pickup": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription ready for pickup event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_ready_for_pickup"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "readyForPickupAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Timestamp when the prescription became ready for pickup"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "readyForPickupAt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.announced": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription announced event.The package was registered by the pharmacy to the fulfillment provider.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_announced"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "tracking": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "trackingNumber": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking number"
                      },
                      "trackingUrl": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking URL"
                      }
                    }
                  },
                  "shippingOption": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Option ID"
                      },
                      "type": {
                        "type": "string",
                        "description": "Option type"
                      }
                    },
                    "required": [
                      "id",
                      "type"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "shippingOption"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.checkout_payment_failed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "deprecated": true,
        "summary": "Payment failed (deprecated)",
        "description": "This webhook is no longer in use and should be ignored. Please contact our support team for assistance with payment failure handling.",
        "requestBody": {
          "description": "Payment failed event (deprecated)",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_checkout_payment_failed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "nullable": true,
                        "description": "Prescription ID. Null for draft/TP-initiated checkouts."
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.shipped": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription shipped event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_shipped"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "tracking": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "trackingNumber": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking number"
                      },
                      "trackingUrl": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking URL"
                      },
                      "currentLocationDriver": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                          "lat": {
                            "type": "number",
                            "nullable": true,
                            "description": "Driver lat"
                          },
                          "long": {
                            "type": "number",
                            "nullable": true,
                            "description": "Driver long"
                          }
                        }
                      }
                    }
                  },
                  "shippingOption": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Option ID"
                      },
                      "type": {
                        "type": "string",
                        "description": "Option type"
                      }
                    },
                    "required": [
                      "id",
                      "type"
                    ]
                  },
                  "estimatedDelivery": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "Estimated delivery"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "shippingOption"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.billing_address_updated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription billing address updated event. Sent when the pharmacy updates the billing address on an order.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_billing_address_updated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "previousBillingAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  },
                  "billingAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "previousBillingAddress",
                  "billingAddress"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "affiliation.activated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Affiliation activated event. Sent when a pharmacy switches a telemedicine provider on (the onboarding trigger). Carries a fixed snapshot of the pharmacy onboarding data so the provider can complete onboarding without a separate API round-trip. Opt-in per provider and only sent when a webhook URL is configured.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "affiliation_activated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "affiliation": {
                    "type": "object",
                    "properties": {
                      "pharmacyId": {
                        "type": "string",
                        "description": "Cannaflow's canonical pharmacy ID. Always present."
                      },
                      "telemedicineProviderId": {
                        "type": "string",
                        "description": "Telemedicine provider ID."
                      },
                      "externalPharmacyId": {
                        "type": "string",
                        "nullable": true,
                        "description": "The TP's own pharmacy ID. On affiliation_activated this is typically null for TPs that assign it during onboarding — its absence is not an error."
                      }
                    },
                    "required": [
                      "pharmacyId",
                      "telemedicineProviderId",
                      "externalPharmacyId"
                    ]
                  },
                  "pharmacy": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "officialName": {
                        "type": "string"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "contactEmail": {
                        "type": "string"
                      },
                      "contactPhone": {
                        "type": "string",
                        "nullable": true
                      },
                      "website": {
                        "type": "string",
                        "nullable": true
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "street": {
                            "type": "string"
                          },
                          "houseNumber": {
                            "type": "string"
                          },
                          "postalCode": {
                            "type": "string"
                          },
                          "city": {
                            "type": "string"
                          },
                          "country": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "street",
                          "houseNumber",
                          "postalCode",
                          "city",
                          "country"
                        ],
                        "description": "Operating address (where the pharmacy is / ships from)."
                      },
                      "billing": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "ownerName": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "taxNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "vatNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "address": {
                            "type": "object",
                            "properties": {
                              "street": {
                                "type": "string"
                              },
                              "houseNumber": {
                                "type": "string"
                              },
                              "postalCode": {
                                "type": "string"
                              },
                              "city": {
                                "type": "string"
                              },
                              "country": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "street",
                              "houseNumber",
                              "postalCode",
                              "city",
                              "country"
                            ],
                            "description": "Billing address (where invoices go)."
                          }
                        },
                        "required": [
                          "name",
                          "ownerName",
                          "email",
                          "address"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "officialName",
                      "slug",
                      "contactEmail",
                      "address",
                      "billing"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "affiliation",
                  "pharmacy"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "affiliation.deactivated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Affiliation deactivated event. Sent when a pharmacy switches a telemedicine provider off. Carries only the affiliation identifier (no pharmacy data block). Opt-in per provider and only sent when a webhook URL is configured.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "affiliation_deactivated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "affiliation": {
                    "type": "object",
                    "properties": {
                      "pharmacyId": {
                        "type": "string",
                        "description": "Cannaflow's canonical pharmacy ID. Always present."
                      },
                      "telemedicineProviderId": {
                        "type": "string",
                        "description": "Telemedicine provider ID."
                      },
                      "externalPharmacyId": {
                        "type": "string",
                        "nullable": true,
                        "description": "The TP's own pharmacy ID. On affiliation_activated this is typically null for TPs that assign it during onboarding — its absence is not an error."
                      }
                    },
                    "required": [
                      "pharmacyId",
                      "telemedicineProviderId",
                      "externalPharmacyId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "affiliation"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.delivery_address_updated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription delivery address updated event. Sent when the pharmacy updates the delivery address on an order.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_delivery_address_updated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "previousDeliveryAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  },
                  "deliveryAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "previousDeliveryAddress",
                  "deliveryAddress"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 103,
      "1": 44,
      "2": 25,
      "3": 148,
      "4": 73,
      "5": 233,
      "6": 9,
      "7": 0,
      "8": 61,
      "9": 87,
      "10": 29,
      "11": 226
    }
  }
}
```