Get the caller
const url = 'https://app.caprid.com/v1/account';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://app.caprid.com/v1/account \ --header 'Authorization: Bearer <token>'Who you are and which Organizations you can manage. With a session,
that’s every Organization you’re a Member of. An Agent you claimed
gets the same answer as your session. With an API key, it’s
the key’s own Organization, and there’s no email, because an API key
belongs to the Organization rather than to a person. Instead,
api_key describes the key itself, with the Namespaces it is limited
to.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”The caller.
object
object
The person signed in. Absent for an API key.
When the person signed up. Absent for an API key.
The API key making the call, with its namespaces limit if it
has one. A limited key can’t list its Organization’s Namespaces,
so this is how it finds the ones it can reach. Absent for a
session.
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.
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.
The one Namespace you can reach, as this reported before Organizations. Absent unless you reach exactly one.
That Namespace’s platform_peering. Absent along with namespace.
Examples
A session that belongs to two Organizations
{ "account": { "email": "alice@acme.example", "created_at": 1760000000, "organizations": [ { "id": 4, "name": "Acme", "role": "owner", "created_at": 1760000000 }, { "id": 9, "name": "Globex", "role": "member", "created_at": 1760500000 } ] }}An API key whose Organization has one Namespace
{ "account": { "api_key": { "id": "3f9a1c07be42", "label": "initial", "preview": "R2x0Z9", "created_at": 1760000000, "last_used_at": 1760600000 }, "organizations": [ { "id": 4, "name": "Acme", "created_at": 1760000000 } ], "namespace": "acme", "platform_peering": false }}An API key limited to two Namespaces
{ "account": { "api_key": { "id": "8c21d4e09a7f", "label": "deploys", "preview": "Qm9vTx", "created_at": 1760700000, "last_used_at": 1760800000, "namespaces": [ "acme-prod", "acme-staging" ] }, "organizations": [ { "id": 4, "name": "Acme", "created_at": 1760000000 } ] }}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 on every route with the token of an Agent that has nothing to act
in. An Agent whose person hasn’t signed up gets this until they sign
up at /app/, and its next request after that acts as their new
Account. An Agent nobody has claimed gets this once its trial lapses,
because a registration gets one trial. It can register again to start
a new one, or a person can claim it so it acts as their Account.
object
Examples
The person who claimed the Agent hasn't signed up
{ "error": "the person who claimed this Agent has no Switchboard Account: once they sign up at /app/, the Agent acts as their Account"}The Agent's trial has lapsed
{ "error": "this Agent's trial is over: register again to start a new one, or have a person with a Switchboard Account claim this Agent"}