Sandbox & testing
Magic phone numbers, the advance and trigger-webhook endpoints, and exactly how sandbox differs from live.
The sandbox is a full copy of the Partner API for building and testing. It uses the same base URL, https://api.physioaroundme.com/v1, and you reach it with a sk_test_ key. You get sandbox access once Rehabify approves your organisation. Create keys in the Partner Portal under Developers → API keys.
There are no shared or public sandbox keys. Use your own.
What sandbox never does
- It never contacts patients, and never sends emails or WhatsApp messages to them.
- It never earns commissions.
GET /partners/commissionsreturns an empty list, andearningsinGET /partners/commercialare always zero. - It never uses real providers. Matched providers are simulated as
{ "name": "Sandbox Physiotherapist", "license_number": "SANDBOX-0001" }. - It never mixes with live. Sandbox referrals, links and webhooks are invisible to live keys, and sandbox events go only to your sandbox webhook endpoint.
The sandbox rate limit is 10 requests per second.
Magic phone numbers
Use these values for patient.phone on POST /partners/referrals with a test key, to simulate different journeys. Each status change fires the matching webhook, just like in live.
| Phone | Behaviour |
|---|---|
+2348000000001 | → contacted after ~5 s |
+2348000000002 | → contacted (~5 s) → provider_matched + booked (~15 s) |
+2348000000003 | full journey: contacted (~5 s) → booked (~15 s) → in_treatment (~25 s) → completed (~35 s) |
+2348000000004 | rejected immediately: 422 patient_ineligible (no referral created) |
+2348000000005 | → not_suitable after ~10 s |
+2348000000006 | → cancelled after ~10 s |
| any other | stays received — use the advance endpoint |
Advance a referral
POST /sandbox/referrals/{id}/advanceMoves a sandbox referral to a new status and fires the same webhooks a real transition fires. {id} is the sandbox referral's id or tracking_code. With a live key, this endpoint returns 403 sandbox_only.
| Field | Type | Description |
|---|---|---|
status | string | contacted, booked, in_treatment, completed, not_suitable, cancelled or closed. |
Rules:
- Statuses only move forward:
received→contacted→booked→in_treatment→completed.not_suitable,cancelledandclosedend the journey. - Moving backwards, or out of a terminal status (
completed,not_suitable,cancelled,closed), returns422 invalid_status_transition. - Advancing to
bookedwhen no provider is matched yet firesreferral.provider_matchedfirst, thenreferral.booked. The provider is the simulatedSandbox Physiotherapist.
TRACKING_CODE="RHB-0123456789" # a sandbox referral that is still "received"
curl "https://api.physioaroundme.com/v1/sandbox/referrals/$TRACKING_CODE/advance" \
-X POST \
-H "Authorization: Bearer $REHABIFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "booked" }'Response: 200 OK with the updated referral object.
Errors: 403 sandbox_only (live key), 404 referral_not_found, and 422 invalid_status_transition or validation_error.
Trigger a test webhook
POST /sandbox/trigger-webhookSends a signed test event to your sandbox webhook endpoint. It's signed with your sandbox secret and has the same format as real events. With a live key, this endpoint returns 403 sandbox_only. You can also send test events from the portal.
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Any event type (referral.created … referral.closed) or ping. |
referral_id | string | No | The id or tracking_code of one of your sandbox referrals. Without it, a sample sandbox referral is used (id ref_sample_000000000000000000000000, tracking_code RHB-1234567890). |
curl https://api.physioaroundme.com/v1/sandbox/trigger-webhook \
-X POST \
-H "Authorization: Bearer $REHABIFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "type": "referral.booked" }'{
"object": "webhook_test",
"event_id": "evt_01JA4W6X8Y0Z2A4B6C8D0E2F4G",
"type": "referral.booked",
"status": "queued",
"endpoint": "https://example.com/webhooks/rehabify"
}The delivered event has data.previous_status: null, data.sequence: 0 and data.test: true. A ping carries data.message: "Test event from Rehabify" and a data.referral. See Test events. Test events don't change the referral.
Errors: 403 sandbox_only (live key), 404 referral_not_found (unknown referral_id), 409 webhook_endpoint_not_configured (no sandbox endpoint is set), and 422 validation_error (unknown type).
Other endpoints in sandbox
| Endpoint | Sandbox behaviour |
|---|---|
GET /partners/sessions | Sessions are simulated from the referral's sandbox status and have "simulated": true. |
GET /partners/reports/{id} and /pdf | Built from the simulated sessions. |
POST /partners/referral-links | Creates a sandbox link. Its leads create sandbox referrals and never attribute real patients. |
GET /partners/commercial | Your terms, with earnings always zero. |
GET /partners/commissions | Always an empty list. |
POST /partners/eligibility | A simulated preview ("simulated": true). Any member_id containing EXPIRED is ineligible. See Eligibility. |