Create an Organization
const url = 'https://app.caprid.com/v1/organizations';const options = { method: 'POST', headers: { cookie: '__Host-switchboard_session=<__Host-switchboard_session>', 'Content-Type': 'application/json' }, body: '{"namespace":"acme-labs","name":"Acme Labs"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.caprid.com/v1/organizations \ --header 'Content-Type: application/json' \ --cookie __Host-switchboard_session=<__Host-switchboard_session> \ --data '{ "namespace": "acme-labs", "name": "Acme Labs" }'Creates another Organization, the way signup created your first. Use one to keep a separate customer, or a project you’ll hand over, apart from the rest. It has its own Namespaces, API keys, Members and relays.
You become its Owner. It is named after its Namespace unless you give
it a name, which you can change later. The response holds its first
API key, and this is the only time that key’s secret is shown, so
store it now.
This takes a signed-in session. An API key acts for its own Organization, so it can’t create another.
An Account may create 5 Organizations. Organizations you joined by invitation don’t count. If you need more, ask Mux to raise your cap.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
A Namespace’s name, which is the root of every path signed for it.
It never changes. Use lowercase letters, digits and hyphens, and start
and end with a letter or digit. Some names, like admin and
default, are reserved, and so is every name that starts with
trial-, which only Trial Organizations get.
For display. Defaults to the Namespace.
Example
{ "namespace": "acme-labs", "name": "Acme Labs"}Responses
Section titled “Responses”The new Organization, its Namespace, and its first API key.
object
A customer of Switchboard. It owns its Namespaces, and the API keys, Nodes and enrollments that serve them. Its Members manage all of it.
object
Identifies the Organization in routes. It never changes.
For display. Any Member can change it.
Your role in it. Absent for an API key, which has none.
When a Trial Organization lapses, so its Agent knows how long it has to get a person to claim it. Absent for every other Organization.
object
A Namespace’s name, which is the root of every path signed for it.
It never changes. Use lowercase letters, digits and hyphens, and start
and end with a letter or digit. Some names, like admin and
default, are reserved, and so is every name that starts with
trial-, which only Trial Organizations get.
The Organization that owns it, for good.
Whether its tracks may travel between your Self-hosted relays and Platform relays, the relays Mux runs.
object
Identifies the key for revoking it. Not a secret.
The first 6 characters of the secret after sb_, so you can tell keys apart.
Absent for a key that never expires.
Absent for a key that has never been used.
The Namespaces the key is limited to, by name. Absent for a key
with no limit. A deleted Namespace drops out, so a key whose
Namespaces have all been deleted has [] here and can do nothing.
The API key itself. Shown only in this response.
Example
{ "organization": { "id": 12, "name": "Acme Labs", "role": "owner", "created_at": 1792900000 }, "namespace": { "name": "acme-labs", "organization_id": 12, "platform_peering": false, "created_at": 1792900000 }, "api_key": { "id": "3f9a1c07be42", "label": "initial", "preview": "R2x0Z9", "created_at": 1792900000, "secret": "sb_R2x0Z9kQ7mVt3xLp8wNc1bYh5sDf2gJr6uEa0zWiTq4" }}The request is malformed or a field is invalid. The message says which.
object
Example
{ "error": "the requested grants exceed the key's scope"}No valid credential. Missing, expired and revoked credentials all get the same response, and so does an API key whose trial has lapsed. An Agent token from before a claim gets a 401 too, once the claim has made the trial a person’s, with a message saying to get a new token.
object
Example
{ "error": "the requested grants exceed the key's scope"}Headers
Section titled “Headers”Example
Bearer realm="switchboard"Sent with an API key, or you have already created as many Organizations as you may. The message says which.
object
Example
{ "error": "an Account may create 5 Organizations, and you have already; ask whoever runs this Switchboard to raise your cap"}The Namespace is taken. Namespace names are never reused, even after one is deleted.
object
Example
{ "error": "the requested grants exceed the key's scope"}