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.
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
The answer has id, name, state, workspace_count and member_count. It has no role and no
billing field.
2. List the workspaces
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
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
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.
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.
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
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
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
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-Workspaceon every workspace operation. There is no default workspace. - MUST send a new
Idempotency-Keyfor each new change. To retry a lost answer, send the same key and the same body again. - MUST read
getOrganisationConcurrencybefore each share change, and send therevisionof the workspace asexpected_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_roleorrole. These are open lists.
Verify
Expected output: the new workspace is in items, with its concurrency_share.