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

# Sandbox

> Fake orders on demand, and the GO JOE side of the flow at the push of a button.

The sandbox is a complete copy of the GO JOE Pharmacy API with its own
database. It holds no real patients and talks to no real courier, doctor or
signing service, so you can build and test your ERP without waiting for real
orders.

| | Sandbox | Production |
| - | - | - |
| Base URL | `https://sandbox-api.gojoe.de/api/pharm/v1` | `https://gojoe.de/api/pharm/v1` |
| Keys | `gj_test_…` | `gj_live_…` |
| Orders | made by you with `POST /sandbox/orders` | real patients |
| Prescriptions | PDFs marked **MUSTER** | the doctor's Vorab-Rezept and QES-signed prescription |

A test key never works on production and a live key never works in the
sandbox; both answer `401 wrong_environment`.

## Create a test order

```bash theme={null}
curl -X POST https://sandbox-api.gojoe.de/api/pharm/v1/sandbox/orders \
  -H "Authorization: Bearer gj_test_…" -H "Content-Type: application/json" \
  -d '{"pharmacy_id": "<pharmacy_id>", "fulfilment": "express"}'
```

* `fulfilment`: `express` (GO JOE's courier collects from you), `shipping`
  (you ship) or `pickup` (the patient collects). Default `express`.
* `prescription_stage`: `vorab` (default) or `signed`.
* `items` (optional): `[{ "pharmacy_sku": "4711", "quantity": 10 }]` with
  article numbers you pushed and GO JOE mapped. Without it the order gets one
  or two products your sandbox pharmacy has in stock.

The answer is the full order (`201`). Your webhook endpoint receives
`order.created` within seconds, and the event is in `GET /events` too. From
here on use the normal endpoints: fetch, download the prescription, accept,
report `packed` and so on.

## Play GO JOE's side

`POST /sandbox/orders/{id}/advance` with one `action`:

| action | what happens | you receive |
| - | - | - |
| `sign_prescription` | the doctor signs; the signed MUSTER PDF replaces the Vorab-Rezept | `order.prescription_signed` |
| `replace_prescription` | a new Vorab-Rezept, as 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` |

```bash theme={null}
curl -X POST https://sandbox-api.gojoe.de/api/pharm/v1/sandbox/orders/<order_id>/advance \
  -H "Authorization: Bearer gj_test_…" -H "Content-Type: application/json" \
  -d '{"action": "sign_prescription"}'
```

An action that makes no sense for the order (a courier event on a shipping
order, signing twice) answers `409` with a `code` saying why.

## A full run

1. Create an express order with `prescription_stage: vorab`.
2. Fetch it, download the Vorab-Rezept, accept it with your order number.
3. Report `packed`, then play `courier_picked_up` and `courier_delivered`.
4. On a second order, play `sign_prescription` before packing and check your
   ERP swaps in the signed PDF.
5. On a third, play `cancel` after accepting and check your ERP stops it.

Each of these ticks a step of the go-live check GO JOE sees for your account
([Going live](https://developers.gojoe.de/guides/go-live.md)).

## Good to know

* Webhooks in the sandbox go out right after each API call (new events and
  retries). If your endpoint was down, the next call you make delivers what is
  due, and `GET /events` always has everything.
* The sandbox's data can be reset by GO JOE. Don't keep anything there you need.


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