https://prod.voice.miraiminds.co. Sub-workspaces sit under a workspace
that has gone live, so the examples on this page use
the production address.
Sub-workspaces are off until we turn them on for your workspace and set how
many you can have. Ask us to turn them on. Until then, creating one answers
403 sub_workspaces_disabled. You create and manage sub-workspaces through the
API, and you can work in any of them from the console.How it fits together
Your company’s live workspace is the parent. Each brand is a sub-workspace directly under it, with an id like any other workspace:ws_ followed by 24 hex
characters. Sub-workspaces go one level deep, so a sub-workspace can’t have
sub-workspaces of its own.
People sign in to the parent, and API keys belong to the parent. One key reaches
the parent and every sub-workspace under it. It can never reach a workspace
under another parent.
What a brand shares with the parent
Everything else belongs to one brand, and you see it only with that brand’s
header: its agents, campaigns and calls, its phone numbers, its do-not-call
list, its knowledge bases, and its tools and tool secrets. An agent in one brand
can’t be used for a call in another.
Phone numbers in a sub-workspace
Each sub-workspace can rent its own numbers from Mirai with theMirai-Workspace header. A number rented in a sub-workspace is that
sub-workspace’s: it shows in its Phone numbers, its agents answer it, and
only its header reaches it. Your account’s wallet pays the ₹1,500 each three
months, as for every brand.
Business verification comes from your account when the sub-workspace has
none. A sub-workspace without an approved business verification of its own
rents under your account’s approved one. You verify once, and each end
customer gets its own number. verification_source on the options,
verifications, quotes and rentals says account. A sub-workspace that has
verified itself always uses its own (verification_source: "workspace"); we
recommend that when each brand is a separate business. If neither is
approved, a quote answers 409 verification_required. Only your own account’s
verification is ever used: another account’s never is.
Renewal reminders (7 days and 24 hours ahead), renewal receipts and releases
are emailed to your account’s owners and billing members. There is no grace
period: see Renewal, reminders and release.
As webhooks, they reach the sub-workspace’s own subscriptions and your
account’s. data.workspace_id names the sub-workspace. See
Phone number events.
In the console
Anyone on your workspace can switch between it and its brands in the console. The switcher sits at the top of the sidebar (in the title bar on a phone) and always shows what you’re looking at: your workspace, marked Account, or a brand, marked Brand. It lists every active sub-workspace by name, with a search box when there are more than a few.- Pick a brand to see and change that brand’s agents, calls and recordings,
campaigns, phone numbers, knowledge bases, do-not-call list and tools, the
same things its
Mirai-Workspaceheader reaches. - Billing, the wallet, API keys, Company details and Team stay
your workspace’s whichever brand you’re on. On Developers, a brand shows
the
Mirai-Workspaceheader to use with your key. - A link copied from the console opens on the same brand. Archived brands drop out of the switcher.
More than one company
The same switcher lists your companies when you belong to more than one, for example when you look after several clients’ workspaces. A company’s owner adds you from Team, and the role you get applies to that company only: you can be an owner in one and a developer in another.- Companies are listed by name, each with your role there, above the current company’s brands.
- Picking another company opens it on the same section, with its own agents, calls, wallet, invoices and team. Companies never share a wallet: that’s what sub-workspaces are for.
- Signing in opens the company you used last.
- If you switch in one tab, your other open tabs reload into that company rather than saving into the one you left.
Address a sub-workspace
Send your API key as usual, and name the brand inMirai-Workspace:
- The value is the sub-workspace’s
idor theexternal_idyou gave it. X-WorkspaceandWorkspaceare accepted as the same header. An integration that already sendsworkspacecan keep its header name.- The header works on every
/v2route. The request then acts inside that brand: an agent you create belongs to the brand, andGET /v2/callsandGET /v2/phone-numberslist the brand’s calls and numbers. - Without the header, or with the parent’s own id in it, the request acts on the parent as before.
external_id is acme-skincare, send that
value in the header. The agent must be one of that brand’s agents; an agent from
the parent or another brand answers 404 not_found.
- cURL
- Python
- Node.js
404 workspace_not_found. One that names an archived sub-workspace answers
403 workspace_archived. See errors.
The workspace object
Manage sub-workspaces
The routes below create and change sub-workspaces. Call them with your API key alone. They act on the parent and refuse a request that names a sub-workspace inMirai-Workspace.
Create a sub-workspace
- cURL
- Python
- Node.js
201 Created with the workspace object.
If the external_id is already used, or an active sub-workspace already has the
name, you get 409 workspace_exists, and the response carries the existing
workspace next to the error. A script that timed out and retries with the same external_id can
read the brand it already made instead of creating a second one, as the code
above does. Check that external_id matches: a name clash with a different
brand returns that other brand.
409 Conflict
409 sub_workspace_limit. Archive a brand you no longer serve, or
ask for a higher limit.
List sub-workspaces
200 OK
Get and update a sub-workspace
{id} is the sub-workspace’s ws_ id or its external_id.
PATCH takes name, external_id, kind, timezone, currency and
profile. Send only the fields you change. A profile you send replaces the
stored one. The uniqueness rules from create still apply, so a clash answers
409 workspace_exists.
404 workspace_not_found. PATCH on an archived
sub-workspace answers 409 workspace_archived; restore it first.
Archive and restore
Mirai-Workspace answers 403 workspace_archived. Its agents, calls and
settings are kept, and its external_id stays reserved. Archived sub-workspaces
don’t count toward your limit.
You can’t archive a brand while one of its campaigns is playing. The request
answers 409 workspace_busy. Pause or stop the campaign first,
with the brand’s header, then archive.
active. Its name must still be free among your
active sub-workspaces, or you get 409 workspace_exists, and you need room
under your limit, or you get 409 sub_workspace_limit.
Both answer with the workspace object, showing its new status.
Onboard a brand with your v1 code
kind comes from the
path. New code can call POST /v2/workspaces
directly.
A field the route doesn’t know answers
400 invalid_request, as v1 refused one.
200 in the shape v1 gave that path, and v1 shaped the two
differently. Both add the v2 workspace object as
sub_workspace.
The custom answer
onboard/custom returns the new brand under data, in v1’s field names. Read
the id from data._id (or data.id) as your v1 code does, and send it in the
workspace (or Mirai-Workspace) header from now on.
200 OK
The Shopify answer
onboard/shopify returns the id at the top level, with a billing block:
200 OK
The errors are the same as for create. Without an
externalId, a retried request with the same name answers
409 workspace_exists while the first brand is active, with that brand under
workspace. Send an externalId to address the brand by your own id and to
make retries find the brand they already made.
Money across brands
Every brand spends from the parent’s wallet. Read each figure with the brand’sMirai-Workspace header, or without it for the parent.
See one brand’s usage
Send the brand’s header to the routes you already use:GET /v2/insightsgives the brand’s calls, outcomes and call spend over a window, in one read.GET /v2/calls/summarycounts the brand’s calls and their live time.GET /v2/callslists the brand’s calls, each with itscost_inr.GET /v2/walletshows the parent’s wallet. The balance is shared, so it is the same for every brand.
- cURL
- Python
- Node.js
Coming from v1
On v1, your brands were workspaces under your organization. On v2 they are sub-workspaces under your parent workspace.
When Mirai moves your brands from v1, each brand becomes a sub-workspace whose
external_id is its v1 workspace id. The workspace header your code sends
today keeps its value; only the host and the key change. A brand you create on
v2 through the onboarding paths has no external_id, so use the workspace id
they return.
Agents, calls and webhooks have a different shape on v2.
Migrating from v1 maps each endpoint and field. Send the
brand’s header on each of those requests.
Errors
Related
Calls
Place a brand’s calls, list them and count them.
Wallet
The balance every brand spends from.
Migrating from v1
Each v1 endpoint, field and webhook on v2.
Errors
Every error code in one place.