> ## 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.

# Play a GO JOE event

> **Sandbox only.** Plays one thing that happens on GO JOE's side, so you
can test how your ERP reacts without waiting for it:

| action | what happens | you receive |
|---|---|---|
| `sign_prescription` | the doctor signs; a signed MUSTER PDF replaces the Vorab-Rezept | `order.prescription_signed` |
| `replace_prescription` | a new Vorab-Rezept (e.g. after a failed signature) | `order.prescription_replaced` |
| `update_address` | the patient changes the delivery address | `order.updated` |
| `courier_picked_up` | express: GO JOE's courier collects the order | `order.status_changed` (`out_for_delivery`) |
| `courier_delivered` | express: the courier delivers | `order.status_changed` (`completed`) |
| `courier_returning` | express: delivery failed, the courier brings it back | `order.status_changed` (`returning`) |
| `cancel` | the patient cancels | `order.cancelled` |




## 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 back what happens to them, and
    keep GO JOE's stock and prices current.
  description: >
    The GO JOE Pharmacy API lets a pharmacy (or the ERP of a pharmacy group)

    receive paid, doctor-approved GO JOE orders and report their progress.


    **How it works**


    1. GO JOE sends a short, signed **webhook** (`order.created`) to your
    endpoint.

    2. Your ERP **fetches the full order** with `GET /orders/{id}` and downloads
    the
       prescription with `GET /orders/{id}/prescription`.
    3. You **accept** the order with your own order number (`POST
    /orders/{id}/accept`).

    4. You **report progress**: `packed`, `ready_for_pickup`,
    `out_for_delivery`,
       `completed` (`POST /orders/{id}/status`).
    5. Missed a webhook? Everything is also in the **event feed** (`GET
    /events`),
       which you can replay from your last cursor.
    6. Keep **stock and prices** current with `PUT
    /pharmacies/{pharmacy_id}/inventory`
       (whole catalogue or changed rows) and `PATCH …/inventory/{pharmacy_sku}` (one article).

    **Prescriptions come in two stages.** An order appears as soon as the

    *Vorab-Rezept* exists (`prescription.stage = vorab`). When the doctor's

    qualified electronic signature (QES) is done you receive

    `order.prescription_signed`; download the document again and file the signed

    version in place of the Vorab-Rezept.


    **Conventions:** JSON, UTF-8, timestamps in ISO-8601 UTC, money in integer

    cents (EUR, gross), quantities in g (flower) or ml (extracts). Ignore fields

    you don't know: new fields can appear at any time without a version change.

    Errors are `application/problem+json` with a stable `code`.
  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_…; fake orders and MUSTER prescriptions only)
security:
  - apiKey: []
tags:
  - name: Account
  - name: Orders
  - name: Events
  - name: Inventory
  - name: Webhooks
    description: What GO JOE sends to your webhook URL.
  - name: Sandbox
    description: >-
      Simulator endpoints. They exist on the sandbox only and answer 404 on
      production.
paths:
  /sandbox/orders/{id}/advance:
    parameters:
      - $ref: '#/components/parameters/OrderId'
      - $ref: '#/components/parameters/IdempotencyKey'
    post:
      tags:
        - Sandbox
      summary: Play a GO JOE event
      description: >
        **Sandbox only.** Plays one thing that happens on GO JOE's side, so you

        can test how your ERP reacts without waiting for it:


        | action | what happens | you receive |

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

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

        | `replace_prescription` | a new Vorab-Rezept (e.g. after a failed
        signature) | `order.prescription_replaced` |

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

        | `courier_picked_up` | express: GO JOE's courier collects the order |
        `order.status_changed` (`out_for_delivery`) |

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

        | `courier_returning` | express: delivery failed, the courier brings it
        back | `order.status_changed` (`returning`) |

        | `cancel` | the patient cancels | `order.cancelled` |
      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 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: >-
        Any unique string. Retrying with the same key within 24 h returns the
        first response without running the request again.
      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: When the order reached your pharmacy
        updated_at:
          type: string
          format: date-time
        erp_reference:
          type:
            - string
            - 'null'
        accepted_at:
          type:
            - string
            - 'null'
          format: date-time
        fulfilment:
          type: object
          properties:
            type:
              type: string
              enum:
                - express
                - shipping
                - pickup
            courier:
              type: string
              enum:
                - gojoe
                - pharmacy
              description: >-
                `gojoe`: GO JOE books the courier when you report `packed`.
                `pharmacy`: you ship or hand over.
            preferred_delivery_at:
              type:
                - string
                - 'null'
              format: date-time
            pickup_slot_at:
              type:
                - string
                - 'null'
              format: date-time
            return_pin:
              type:
                - string
                - 'null'
              description: >-
                For GO JOE courier orders: the PIN to take back an undeliverable
                package.
            tracking:
              type:
                - object
                - 'null'
              properties:
                number:
                  type:
                    - string
                    - 'null'
                url:
                  type:
                    - string
                    - 'null'
        patient:
          type: object
          description: >-
            Only what is needed to dispense and deliver. No e-mail, no 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: 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 whenever the PDF changes.
                url:
                  type: string
                  description: Path of GET /orders/{id}/prescription
    OrderStatus:
      type: string
      enum:
        - new
        - accepted
        - packed
        - ready_for_pickup
        - out_for_delivery
        - completed
        - returning
        - returned
        - cancelled
      description: >
        `new` → `accepted` → `packed` → `ready_for_pickup` | `out_for_delivery`
        → `completed`.

        `returning`/`returned` when a courier could not deliver. `cancelled`: do
        not dispense.
    Problem:
      type: object
      required:
        - status
        - code
        - detail
        - request_id
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        code:
          type: string
          example: invalid_transition
          description: >
            Stable error code, e.g. `unauthorized`, `wrong_environment`,
            `insufficient_scope`,

            `rate_limited`, `order_not_found`, `not_accepted`,
            `already_accepted`,

            `invalid_transition`, `courier_managed_by_gojoe`, `order_cancelled`,

            `order_rejected`, `idempotency_key_reused`.
        detail:
          type: string
        request_id:
          type: string
          description: Quote this to GO JOE support.
  responses:
    Unauthorized:
      description: Missing, unknown or revoked key, or a key for the other environment
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    NotFound:
      description: No such order for this key (also for orders of other pharmacies)
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Conflict:
      description: Not possible in the order's current state (see `code`)
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Invalid:
      description: Invalid body
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    RateLimited:
      description: More than the account's limit (default 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: '`Authorization: Bearer gj_live_…` (production) or `gj_test_…` (sandbox).'

````

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