Organisations
Create, list, rename and delete Organisations under /v1/orgs.
These are the endpoints the portal calls to manage Organisations. They accept a signed-in person's session only. Any other credential gets 403:
A person who is not a member of the Organisation gets 404 not_found, so the routes never confirm that an Organisation exists. A member without the role a route needs gets 403 forbidden.
The Organisation object
{
"orgId": "org_3f9a1c0b7e2d4a6f8c10",
"name": "Acme Health",
"status": "active",
"role": "owner",
"createdAt": 1790000000000
}Create an Organisation
Anyone signed in. You become its owner.
curl -s "$SAI_API_URL/v1/orgs" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "Acme Health" }'{
"orgId": "org_3f9a1c0b7e2d4a6f8c10",
"name": "Acme Health",
"status": "active",
"role": "owner",
"createdAt": 1790000000000
}List your Organisations
Anyone signed in. Lists every Organisation you are a member of, with your role in each.
curl -s "$SAI_API_URL/v1/orgs" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN"{
"organisations": [
{
"orgId": "org_3f9a1c0b7e2d4a6f8c10",
"name": "Acme Health",
"status": "active",
"role": "owner",
"createdAt": 1790000000000
}
]
}Get an Organisation
Owner or admin.
curl -s "$SAI_API_URL/v1/orgs/$ORG_ID" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN"200 with the Organisation, or 404 not_found.
Rename an Organisation
Owner only.
curl -s -X PATCH "$SAI_API_URL/v1/orgs/$ORG_ID" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "Acme Health Group" }'200 with the renamed Organisation.
Delete an Organisation
Owner only. Every Tenant must be deleted first.
curl -s -X DELETE "$SAI_API_URL/v1/orgs/$ORG_ID" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN"204 No Content. Deleting an Organisation removes its keys, members and pending invitations. Unspent credit is lost.
While any Tenant exists, active or disabled, the delete returns 409 and lists them, at most 100, with more set when there are others:
{
"error": "organisation_has_tenants",
"message": "Delete every Tenant before deleting the Organisation.",
"tenants": [{ "tenantId": "Xk2p9QzR4tLm8vNa3bCd", "name": "Riverside Clinic" }],
"more": false
}