Docs/Organisations
Organisations

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:

Credentialerror
Personal API keysession_required
Organisation Keynot_available_for_organisation_key
Tenant tokennot_available_for_tenant

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

An OrganisationJSON
{
  "orgId": "org_3f9a1c0b7e2d4a6f8c10",
  "name": "Acme Health",
  "status": "active",
  "role": "owner",
  "createdAt": 1790000000000
}
FieldNotes
orgIdSai's id for the Organisation.
name1 to 100 characters. Names are not unique.
statusactive or disabled. A disabled Organisation can still be read, but every change, every Tenant token and every Organisation Key is refused with 403 organisation_disabled. Contact support@simular.ai.
roleYour role in it: owner or admin. See Members.
createdAtUnix time in milliseconds.

Create an Organisation

Anyone signed in. You become its owner.

Create an OrganisationcURL
curl -s "$SAI_API_URL/v1/orgs" \
  -H "Authorization: Bearer $FIREBASE_ID_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Health" }'
FieldTypeRequiredNotes
namestringyes1 to 100 characters.
201 Created · OrganisationJSON
{
  "orgId": "org_3f9a1c0b7e2d4a6f8c10",
  "name": "Acme Health",
  "status": "active",
  "role": "owner",
  "createdAt": 1790000000000
}
StatuserrorWhen
400invalid_bodyname is missing or out of range.
403phone_verification_requiredA free account has not verified a phone number, as for an API key.
422organisation_limit_reachedYou already created 5 Organisations.
429rate_limitedMore than 5 Organisations created in an hour.

List your Organisations

Anyone signed in. Lists every Organisation you are a member of, with your role in each.

List your OrganisationscURL
curl -s "$SAI_API_URL/v1/orgs" \
  -H "Authorization: Bearer $FIREBASE_ID_TOKEN"
200 OK · OrganisationsJSON
{
  "organisations": [
    {
      "orgId": "org_3f9a1c0b7e2d4a6f8c10",
      "name": "Acme Health",
      "status": "active",
      "role": "owner",
      "createdAt": 1790000000000
    }
  ]
}

Get an Organisation

Owner or admin.

Get an OrganisationcURL
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.

Rename an OrganisationcURL
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" }'
FieldTypeRequiredNotes
namestringyes1 to 100 characters.

200 with the renamed Organisation.

StatuserrorWhen
403forbiddenYou are an admin, not an owner.
403organisation_disabledThe Organisation is disabled.
404not_foundNo such Organisation, or not yours.

Delete an Organisation

Owner only. Every Tenant must be deleted first.

Delete an OrganisationcURL
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:

409 Conflict · organisation_has_tenantsJSON
{
  "error": "organisation_has_tenants",
  "message": "Delete every Tenant before deleting the Organisation.",
  "tenants": [{ "tenantId": "Xk2p9QzR4tLm8vNa3bCd", "name": "Riverside Clinic" }],
  "more": false
}
StatuserrorWhen
403forbiddenYou are an admin, not an owner.
403organisation_disabledThe Organisation is disabled.
404not_foundNo such Organisation, or not yours.
409organisation_has_tenantsThe Organisation still has Tenants.