Skip to navigation

Manage the workspaces of an organisation

Summary

This guide uses an organisation key to read the organisation, create a workspace, give it call lines, and act inside it with the workspace operations. It also reads usage, people and keys, and archives and restores a workspace. It does not cover how to get the key; see Enterprise API.

Facts

Access. The Enterprise API is for Enterprise customers. To turn it on for your organisation, contact Rasen at team@rasen.ai.

ItemValue
AccessEnterprise customers only. Contact Rasen at team@rasen.ai. Until Rasen turns it on, every operation answers 403 organisation_api_not_enabled
KeyAn organisation key, secret ra_org_…, with organisation operations on. The 4 changes need a full_access key
ReadsgetOrganisation, listOrganisationWorkspaces, getOrganisationConcurrency, getOrganisationUsageSummary, listOrganisationPeople, listOrganisationPersonKeys: capability organisation.read
ChangescreateOrganisationWorkspace, setOrganisationWorkspaceConcurrency, archiveOrganisationWorkspace, restoreOrganisationWorkspace: capability organisation.manage
Either keygetLimits (GET /limits): capability usage.read
PathsBelow /organisations/{organisation_id}; getLimits is GET /limits
Required headersAuthorization on every request; Idempotency-Key (1 to 255 characters) on the 4 changes; Rasen-Workspace on every workspace operation
Workspace name1 to 200 characters. caller_region is india or us
Call-line shareshare 0 to 9999, with expected_revision from getOrganisationConcurrency
ArchiveRasen deletes the workspace at delete_at, 28 days after the archive, unless you restore it first
Usage rangeUTC, start inclusive and end exclusive, at most 93 days. The trailing 30 days by default
Page sizelimit and cursor on the three list operations. See Pagination
EnvironmentRASEN_API_BASE (the base URL, ending in /v1), RASEN_API_KEY (your organisation key), ORGANISATION_ID, WORKSPACE_ID, PERSON_ID, SHARE_REVISION
Python3.10 or later, with the httpx package
TypeScriptNode.js 22 or later (built-in fetch)

Set RASEN_API_KEY to the organisation key. Set ORGANISATION_ID to the ID on Organization settings, General settings, Organization ID in the Rasen app.

Steps

1. Read the organisation

curl -sS "$RASEN_API_BASE/organisations/$ORGANISATION_ID" \
-H "Authorization: Bearer $RASEN_API_KEY"

The answer has id, name, state, workspace_count and member_count. It has no role and no billing field.

2. List the workspaces

curl -sS "$RASEN_API_BASE/organisations/$ORGANISATION_ID/workspaces?limit=50" \
-H "Authorization: Bearer $RASEN_API_KEY"

The list has every workspace of the organisation except those that Rasen is deleting, also workspaces that are not in the key’s workspace list. It has metadata only, nothing inside a workspace.

3. Create a workspace

curl -sS -X POST "$RASEN_API_BASE/organisations/$ORGANISATION_ID/workspaces" \
-H "Authorization: Bearer $RASEN_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"name": "Clinic north", "caller_region": "india"}'

The answer is 201 with the new workspace. Set WORKSPACE_ID to its id. The organisation owner becomes the owner of the workspace. A key with a list of named workspaces does not get the new workspace in its list; a key with all workspaces does.

4. Read the call-line shares

curl -sS "$RASEN_API_BASE/organisations/$ORGANISATION_ID/concurrency" \
-H "Authorization: Bearer $RASEN_API_KEY"

total is the call lines of the organisation, and allotted is the sum of the shares. While open is false, you cannot set shares, and each workspace keeps the standard limit. When the organisation has set shares, a new workspace has 0 call lines until you set its share.

5. Set the share of the new workspace

Set SHARE_REVISION to the revision of the new workspace in the answer of step 4.

curl -sS -X PUT "$RASEN_API_BASE/organisations/$ORGANISATION_ID/workspaces/$WORKSPACE_ID/concurrency" \
-H "Authorization: Bearer $RASEN_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d "{\"share\": 5, \"expected_revision\": $SHARE_REVISION}"

The answer has the new share and revision. The total of the organisation does not change. A raise above the free call lines is refused with share_above_free; a lower share always passes, and running calls finish.

6. Act inside the workspace

Every workspace operation of the API reference works with the organisation key when Rasen-Workspace names the workspace. This step reads the workspace context and the rate limits of the key in it.

curl -sS "$RASEN_API_BASE/context" \
-H "Authorization: Bearer $RASEN_API_KEY" \
-H "Rasen-Workspace: $WORKSPACE_ID"
curl -sS "$RASEN_API_BASE/limits" \
-H "Authorization: Bearer $RASEN_API_KEY" \
-H "Rasen-Workspace: $WORKSPACE_ID"

getContext answers with the workspace that Rasen-Workspace names. getLimits answers with scope workspace: the numbers of the workspace and of the key in it, for each minute. Without Rasen-Workspace, getLimits answers with scope organisation: the numbers of the organisation.

7. Read the usage of the organisation

curl -sS "$RASEN_API_BASE/organisations/$ORGANISATION_ID/usage/summary?start=2026-10-01T00:00:00Z&end=2026-11-01T00:00:00Z" \
-H "Authorization: Bearer $RASEN_API_KEY"

The answer has totals (minutes and calls) and rows by agent, by workspace and by component. An archived workspace counts; a workspace that Rasen is deleting does not. The answer has no cost, currency or invoice.

8. List the people and the keys of a person

curl -sS "$RASEN_API_BASE/organisations/$ORGANISATION_ID/people" \
-H "Authorization: Bearer $RASEN_API_KEY"
curl -sS "$RASEN_API_BASE/organisations/$ORGANISATION_ID/people/$PERSON_ID/keys" \
-H "Authorization: Bearer $RASEN_API_KEY"

The people list has the Owner, each Admin, and each person with a role in a workspace, with their workspaces and roles. Set PERSON_ID to a person_id from it. The key list has the workspace keys that the person created: name and prefix only, never a secret. An organisation key is never listed.

9. Archive and restore a workspace

curl -sS -X POST "$RASEN_API_BASE/organisations/$ORGANISATION_ID/workspaces/$WORKSPACE_ID/archive" \
-H "Authorization: Bearer $RASEN_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"
curl -sS -X POST "$RASEN_API_BASE/organisations/$ORGANISATION_ID/workspaces/$WORKSPACE_ID/restore" \
-H "Authorization: Bearer $RASEN_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"

The archive answers with access_state, delete_at and numbers_released. It releases the workspace’s inbound numbers and its call-line share at once, and every key of the workspace then gets 403 workspace_archived. The restore must come before delete_at. The inbound numbers and the share do not come back: set the share again (step 5).

Rules

  • MUST send the organisation key only from a server. MUST NOT put it in browser or mobile code.
  • MUST send Rasen-Workspace on every workspace operation. There is no default workspace.
  • MUST send a new Idempotency-Key for each new change. To retry a lost answer, send the same key and the same body again.
  • MUST read getOrganisationConcurrency before each share change, and send the revision of the workspace as expected_revision.
  • MUST stop the running calls and campaigns of a workspace before you archive it.
  • MUST keep an unknown value of state, access_state, organisation_role or role. These are open lists.

Verify

curl -sS "$RASEN_API_BASE/organisations/$ORGANISATION_ID/workspaces?limit=50" \
-H "Authorization: Bearer $RASEN_API_KEY"

Expected output: the new workspace is in items, with its concurrency_share.

{"items": [{"id": "ws_01j00000000000000000000000", "name": "Clinic north", "state": "active", "concurrency_share": 5}], "next_cursor": null}

Errors

CodeCauseFix
organisation_api_not_enabledRasen has not turned on the Enterprise API for the organisation. Every operation answers 403.Contact Rasen at team@rasen.ai. Do not retry.
forbiddenA workspace key called an organisation operation, or the organisation key lacks organisation operations or the capability (details.required_capabilities).Use an organisation key with organisation operations on. Use a full_access key for the 4 changes.
not_foundThe organisation_id is not the key’s organisation, or the workspace is outside the organisation or the key’s workspace list.Check the ID. Use a key whose workspace list has the workspace.
invalid_requestA workspace operation has no valid Rasen-Workspace (details.field Rasen-Workspace), or a field is invalid.Send the workspace ID in Rasen-Workspace. Fix the field that details names.
workspace_limit_reachedThe organisation has as many workspaces as its plan allows. 402 on create and restore.The organisation owner upgrades the plan or archives another workspace. Do not retry.
caller_region_unavailableThe caller region offers no language now (details.caller_region). 409 on create.Choose another caller_region.
workspace_busyCalls, campaigns or other work still run in the workspace (details.kinds). 409 on archive.Stop the work, then archive with a new Idempotency-Key.
conflict (concurrency_not_open)Shares cannot be set yet: open is false on getOrganisationConcurrency. 409 on a share change.Wait until open is true. Each workspace keeps the standard limit until then.
conflict (share_above_free)The raise is above the free call lines of the organisation. 409 on a share change.Lower another share first, or send a lower share.
conflict (stale_share)expected_revision is not the current revision of the share. 409 on a share change.Read getOrganisationConcurrency again and send the new revision.
workspace_archivedThe workspace is archived. A share change takes only 0, and a workspace operation is refused.Restore the workspace first.
idempotency_key_reusedThe Idempotency-Key was used for another body.Send a new key for a new change.