> ## Documentation Index
> Fetch the complete documentation index at: https://developers.gojoe.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Simulate a GO JOE event

> **Sandbox only.** Simulates one event that the doctor, the courier or
the patient triggers in production.

| `action` | Simulates | Event you receive |
|---|---|---|
| `sign_prescription` | The doctor signs. A signed MUSTER PDF replaces the Vorab-Rezept. | `order.prescription_signed` |
| `replace_prescription` | A new Vorab-Rezept replaces the current one, as after a failed signature. | `order.prescription_replaced` |
| `update_address` | The patient changes the delivery address. | `order.updated` |
| `courier_picked_up` | Express orders: the courier collects the order. | `order.status_changed` (`out_for_delivery`) |
| `courier_delivered` | Express orders: the courier delivers the order. | `order.status_changed` (`completed`) |
| `courier_returning` | Express orders: the delivery fails and the courier returns the package. | `order.status_changed` (`returning`) |
| `cancel` | The patient cancels the order. | `order.cancelled` |

If an action does not apply to the order, the API returns `409`.




## OpenAPI

````yaml /openapi.yaml post /sandbox/orders/{id}/advance
openapi: 3.1.0
info:
  title: GO JOE Pharmacy API
  version: 1.0.0-prototype
  summary: >-
    Receive GO JOE orders in your ERP, report their status, and send stock and
    prices to GO JOE.
  description: |
    With the GO JOE Pharmacy API, a pharmacy or the ERP of a pharmacy group
    receives paid, doctor-approved GO JOE orders and reports their status.

    **Order flow**

    1. GO JOE sends a signed **webhook** (`order.created`) to your endpoint.
    2. Your ERP fetches the order with `GET /orders/{id}` and downloads the
       prescription with `GET /orders/{id}/prescription`.
    3. Your ERP accepts the order with its own order number
       (`POST /orders/{id}/accept`).
    4. Your ERP reports the status: `packed`, `ready_for_pickup`,
       `out_for_delivery` or `completed` (`POST /orders/{id}/status`).

    The **event feed** (`GET /events`) contains every event for 30 days. Use it
    to process events whose webhook you did not receive.

    Send **stock and prices** with `PUT /pharmacies/{pharmacy_id}/inventory`
    (several articles) or `PATCH …/inventory/{pharmacy_sku}` (one article).

    **Prescription stages**

    An order is available as soon as the *Vorab-Rezept* exists
    (`prescription.stage` is `vorab`). This is the prescription before the
    doctor has applied the qualified electronic signature (QES). When the
    doctor has signed, you receive `order.prescription_signed`. Download the
    document again and replace the Vorab-Rezept with the signed version.

    **Conventions**

    - Requests and responses are JSON in UTF-8.
    - Timestamps are ISO 8601 in UTC.
    - Amounts are integers in euro cents, including VAT.
    - Quantities are in grams (flower) or millilitres (extracts).
    - GO JOE can add response fields and event types without a new API
      version. Ignore fields and types that your ERP does not know.
    - Errors are `application/problem+json` with a `code` that does not change.
      The [error reference](https://developers.gojoe.de/guides/errors) lists
      all codes.
  contact:
    name: GO JOE Integrations
    email: support@gojoe.de
servers:
  - url: https://gojoe.de/api/pharm/v1
    description: Production (live keys, gj_live_…).
  - url: https://sandbox-api.gojoe.de/api/pharm/v1
    description: >-
      Sandbox (test keys, gj_test_…). Contains test orders and MUSTER
      prescriptions only.
security:
  - apiKey: []
tags:
  - name: Account
  - name: Orders
  - name: Events
  - name: Inventory
  - name: Webhooks
    description: The request that GO JOE sends to your webhook URL.
  - name: Sandbox
    description: >-
      Simulator endpoints. They exist in the sandbox only. In production they
      return 404.
paths:
  /sandbox/orders/{id}/advance:
    parameters:
      - $ref: '#/components/parameters/OrderId'
      - $ref: '#/components/parameters/IdempotencyKey'
    post:
      tags:
        - Sandbox
      summary: Simulate a GO JOE event
      description: >
        **Sandbox only.** Simulates one event that the doctor, the courier or

        the patient triggers in production.


        | `action` | Simulates | Event you receive |

        |---|---|---|

        | `sign_prescription` | The doctor signs. A signed MUSTER PDF replaces
        the Vorab-Rezept. | `order.prescription_signed` |

        | `replace_prescription` | A new Vorab-Rezept replaces the current one,
        as after a failed signature. | `order.prescription_replaced` |

        | `update_address` | The patient changes the delivery address. |
        `order.updated` |

        | `courier_picked_up` | Express orders: the courier collects the order.
        | `order.status_changed` (`out_for_delivery`) |

        | `courier_delivered` | Express orders: the courier delivers the order.
        | `order.status_changed` (`completed`) |

        | `courier_returning` | Express orders: the delivery fails and the
        courier returns the package. | `order.status_changed` (`returning`) |

        | `cancel` | The patient cancels the order. | `order.cancelled` |


        If an action does not apply to the order, the API returns `409`.
      operationId: advanceSandboxOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action
              properties:
                action:
                  type: string
                  enum:
                    - sign_prescription
                    - replace_prescription
                    - update_address
                    - courier_picked_up
                    - courier_delivered
                    - courier_returning
                    - cancel
            example:
              action: sign_prescription
      responses:
        '200':
          description: The order after the simulated event
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/Invalid'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    OrderId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: |
        A unique string that identifies this request. Use a new value for
        each new request, and the same value when you retry a request.

        - Within 24 hours, a retry with the same key returns the stored
          response with the header `Idempotent-Replayed: true`. GO JOE does
          not process the request again.
        - If the first request is still being processed, the retry returns
          `409 idempotency_in_progress`. Retry after `Retry-After` seconds.
        - GO JOE does not store failed requests (`4xx`, `5xx`). A retry is
          processed again.
        - The same key with a different body returns
          `422 idempotency_key_reused`.
      schema:
        type: string
        maxLength: 255
  schemas:
    Order:
      type: object
      required:
        - id
        - order_number
        - pharmacy_id
        - status
        - created_at
        - updated_at
        - fulfilment
        - patient
        - items
        - totals
        - prescription
      properties:
        id:
          type: string
          format: uuid
        order_number:
          type: string
          example: GO-XCAFTF
        pharmacy_id:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/OrderStatus'
        created_at:
          type: string
          format: date-time
          description: The time the order became available to your pharmacy.
        updated_at:
          type: string
          format: date-time
        erp_reference:
          type:
            - string
            - 'null'
        accepted_at:
          type:
            - string
            - 'null'
          format: date-time
        rejected_at:
          type:
            - string
            - 'null'
          format: date-time
          description: The time you rejected the order.
        fulfilment:
          type: object
          properties:
            type:
              type: string
              enum:
                - express
                - shipping
                - pickup
            courier:
              type: string
              enum:
                - gojoe
                - pharmacy
              description: >-
                `gojoe`: GO JOE's courier collects the order. You report
                `packed` only. When the courier is booked depends on the
                pharmacy's `courier_booking` setting (see `GET /me`).
                `pharmacy`: you ship the order or hand it to the patient.
            preferred_delivery_at:
              type:
                - string
                - 'null'
              format: date-time
            pickup_slot_at:
              type:
                - string
                - 'null'
              format: date-time
            return_pin:
              type:
                - string
                - 'null'
              description: >-
                Only for orders with GO JOE's courier. The courier needs this
                PIN to return a package that could not be delivered.
            tracking:
              type:
                - object
                - 'null'
              properties:
                number:
                  type:
                    - string
                    - 'null'
                url:
                  type:
                    - string
                    - 'null'
        patient:
          type: object
          description: >-
            The patient data required to dispense and deliver the order. The API
            does not return the e-mail address or the billing address.
          properties:
            first_name:
              type:
                - string
                - 'null'
            last_name:
              type:
                - string
                - 'null'
            date_of_birth:
              type:
                - string
                - 'null'
              format: date
            phone:
              type:
                - string
                - 'null'
            shipping_address:
              type:
                - object
                - 'null'
              properties:
                street:
                  type:
                    - string
                    - 'null'
                additional:
                  type:
                    - string
                    - 'null'
                postcode:
                  type:
                    - string
                    - 'null'
                city:
                  type:
                    - string
                    - 'null'
        items:
          type: array
          items:
            type: object
            properties:
              product_id:
                type: string
                format: uuid
                description: The GO JOE product ID.
              name:
                type: string
              form:
                type:
                  - string
                  - 'null'
              quantity:
                type: number
              unit:
                type: string
                enum:
                  - g
                  - ml
              unit_price_cents:
                type: integer
              line_total_cents:
                type: integer
        totals:
          type: object
          properties:
            items_cents:
              type: integer
            delivery_fee_cents:
              type: integer
            total_cents:
              type: integer
            currency:
              type: string
              enum:
                - EUR
            paid:
              type: boolean
        prescription:
          type: object
          properties:
            stage:
              type: string
              enum:
                - vorab
                - signed
            issued_at:
              type:
                - string
                - 'null'
              format: date-time
            signed_at:
              type:
                - string
                - 'null'
              format: date-time
            doctor:
              type:
                - object
                - 'null'
              properties:
                name:
                  type:
                    - string
                    - 'null'
                phone:
                  type:
                    - string
                    - 'null'
                city:
                  type:
                    - string
                    - 'null'
            document:
              type:
                - object
                - 'null'
              properties:
                version:
                  type: string
                  description: Changes when the PDF changes.
                url:
                  type: string
                  description: The path of `GET /orders/{id}/prescription` for this order.
    OrderStatus:
      type: string
      enum:
        - new
        - accepted
        - packed
        - rejected
        - ready_for_pickup
        - out_for_delivery
        - completed
        - returning
        - returned
        - cancelled
      description: |
        The usual sequence is `new` → `accepted` → `packed` →
        `ready_for_pickup` or `out_for_delivery` → `completed`.

        - `returning`, `returned`: the courier could not deliver the order.
        - `rejected`: you have reported that you cannot fill the order
          (`POST /orders/{id}/reject`).
        - `cancelled`: the order is cancelled. Do not dispense it.

        See [Order lifecycle](https://developers.gojoe.de/guides/orders).
    Problem:
      type: object
      required:
        - status
        - code
        - detail
        - request_id
      properties:
        type:
          type: string
          format: uri
          description: >-
            A link to this code in the error reference:
            `https://developers.gojoe.de/guides/errors#<code>`.
        title:
          type: string
        status:
          type: integer
        code:
          type: string
          example: invalid_transition
          description: >
            The error code, for example `unauthorized`, `not_accepted` or

            `invalid_transition`. Codes do not change. The

            [error reference](https://developers.gojoe.de/guides/errors) lists
            all codes.
        detail:
          type: string
        request_id:
          type: string
          description: Identifies the request. Include it when you contact GO JOE.
  responses:
    Unauthorized:
      description: >-
        The key is missing, unknown or revoked, or it belongs to the other
        environment
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    NotFound:
      description: >-
        This key cannot access an order with this ID. The response is the same
        for orders of other accounts.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Conflict:
      description: >-
        The current state does not allow the request (see `code`), or a request
        with the same `Idempotency-Key` is still being processed
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Invalid:
      description: Invalid body
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    RateLimited:
      description: >-
        The account sent more requests than its limit allows. The default is 120
        requests per minute.
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Send your key in the `Authorization` header: `Bearer gj_live_…` in
        production, `Bearer gj_test_…` in the sandbox.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.