Skip to content
API documentation
View as MarkdownOpen in Claude

API account

Fetch the API account your token belongs to

GET
/v1/api-account/validate-me

The account whose apiKey signed the token: its _id, apiKey, companyName, scopes, roles and isActive, never its apiSecret. Call it to check that your tokens are accepted and which account they name.

The one operation without the envelope. The account is the whole body, not data inside { success, message, data }.

roles are the grants an operator gave your account, each { effect, action, target, authorized? }. When an operation answers 403 forbidden with "Insufficient role permissions", compare them with its x-permission: no allow role matched it on that organization, or a disallow role did.

It needs the api/* permission, which only a role whose action is api/*, */* or * grants; a role for the student or exam operations does not. A change an operator makes to your account, to its roles or deactivating it, can take up to 60 seconds to reach this and every other operation.

Responses

200 OK

The object itself, not wrapped in the { success, message, data } envelope every other operation answers with.

The body is the object itself, without the { success, message, data } envelope.

Body

  • _idstringrequired

    Your account’s id.

    example6650a1b2c3d4e5f6a7b8c9f0

  • apiKeystringrequired

    Your account’s apiKey: what goes in a token’s kid header and sub claim.

    examplekey_EXAMPLEexample0123456789

  • companyNamestringrequired

    The company the account was issued to.

    exampleExample Learning Ltd

  • scopesarray of stringrequired

    Labels an operator set on the account. Informational: no operation checks them, and what your account may do is decided by its roles.

    example[]

  • rolesarray of RoleResponserequired

    What your account may do, as an operator set it. Compare them with an operation’s x-permission to see why it answers 403 forbidden. Only an operator can change them, and a change reaches every operation within 60 seconds.

    4 fields of each item
    • effectstringrequired

      allow grants what the role matches; disallow refuses it, and wins over every allow that matches the same request.

      one ofallowdisallow

      exampleallow

    • actionstringrequired

      The operations it matches, as <resource>/<operation>: an exact action such as student/read, a * for either part such as student/* or */read, or * for every action. Each operation names the action it needs in x-permission.

      examplestudent/*

    • targetstringrequired

      The organization it applies to: an organization’s slug, or * for every organization. An operation without :organizationId in its path acts on mto.

      examplemto

    • authorizedstring

      An account _id the role is limited to. Absent, or your own _id, and the role applies to your account; any other id and it does nothing, a disallow included.

      example6650a1b2c3d4e5f6a7b8c9f0

  • isActivebooleanrequired

    Always true here: a token of an account that is not active is refused with 401 before this is reached.

    exampletrue

Headers

X-RateLimit-Limit integer

Requests your account may make to this operation per window (100).

X-RateLimit-Remaining integer

Requests left in the current window.

X-RateLimit-Reset integer

Seconds until the current window ends.

Example

{
  "_id": "6650a1b2c3d4e5f6a7b8c9f0",
  "apiKey": "key_EXAMPLEexample0123456789",
  "companyName": "Example Learning Ltd",
  "scopes": [],
  "roles": [
    {
      "effect": "allow",
      "action": "student/*",
      "target": "mto",
      "authorized": "6650a1b2c3d4e5f6a7b8c9f0"
    }
  ],
  "isActive": true
}

Example request

# $TOKEN: a short-lived token you minted with your API key and secret
curl -sS 'https://api.main-team.org/v1/api-account/validate-me' \
  -H "Authorization: Bearer $TOKEN"

Search the API documentation

Guides, endpoints by name, path or permission, and error codes such as not_found.