Skip to main content

Make your first API call

Create a team at the map, copy its API key, and open Riverside Practice to enter GP Records. The key stays available in Team & API key in the fixed bottom bar. Read Team access and simulation time for browser setup.

The commands below create or join a team world and add a GP task for a fictional patient. They use curl and jq. If you already have a key, assign it to SIM_KEY and skip key creation.

Create a team world​

Set the origin to the address your organiser gave you. For a local instance:

export SIM_ORIGIN=http://localhost:8080

Create your key once:

export SIM_KEY=$(curl --fail --silent "$SIM_ORIGIN/api/keys" \
-H 'Content-Type: application/json' \
-d '{"teamName":"Example builders"}' | jq -r '.apiKey')

Share this key or your team name with teammates. Repeating the same name returns the same world and reusable key. Names are lowercase with whitespace removed, so Example builders and examplebuilders match. Use a distinct team name to start a separate world.

Read a patient​

curl --fail --silent "$SIM_ORIGIN/api/sites/gp/patients?q=SIM-000001" \
-H "Authorization: Bearer $SIM_KEY" | jq

The response contains items and total. The patient has a fictional identity and a SIM- identifier.

Add a task​

curl --fail --silent "$SIM_ORIGIN/api/sites/gp/actions" \
-H "Authorization: Bearer $SIM_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: first-gp-task' \
-d '{"type":"create_task","patientId":"SIM-000001","title":"Check discharge follow-up"}' | jq

The response is the created resource, including its id and status. Repeating this request with the same idempotency key and payload returns the same result.

Check the result​

curl --fail --silent "$SIM_ORIGIN/api/sites/gp/view" \
-H "Authorization: Bearer $SIM_KEY" \
| jq '.resources[] | select(.title == "Check discharge follow-up")'

Open GP Records at Riverside Practice and use the same team key to inspect the task in the portal.

Explore the ten-year plan or read the action reference.