Authentication

Send an access token in the Authorization header on each API request. The token belongs to one organization. Choosing a different organization in the app doesn’t change where the token works.

curl --fail-with-body --silent --show-error \
  -H "Authorization: Bearer $TCC_ACCESS_TOKEN" \
  'https://api.thecompany.company/v1/sessions?limit=1'

This request needs sessions:read. The quickstart also needs sessions:write to create a session and submit text, and environments:read to choose an environment.

Choose who the token acts as

TokenPrincipalUse it for
Personal access tokenYour user in the organization where you create it.Your own scripts and local development.
Service user tokenA service user in that organization.CI and shared workflows that should not run as a person.

For a personal token, open Settings → Access tokens, select New access token, choose permissions and an expiration, then select Create. For a service user, use Settings → Service users and open the token list for that user. Use New token there if your role allows you to manage the service user.

Give the token only the permissions your code needs. A token’s scopes restrict what its user can do; they don’t grant organization or resource access the user lacks. Copy the token when it appears: the app doesn’t show it again. Store it in your secret manager, not in source or logs.

Rotate a token

Create a replacement with the required permissions, update the secret in each caller, and confirm a request works with the replacement. Then delete the old token. If a token appears in a log or a commit, delete it immediately and replace it.

Good to know

  • A 401 points to an authentication problem. A 403 can mean the token is valid but the caller or its scopes do not allow the requested action. See error handling.
  • Both personal and service user access tokens can submit TextSubmitted events with sessions:write and session write access. The API uses the authenticated caller; the payload does not choose a user identity. A human's personal access token can direct the session as that user; a service user token does not gain human-only interaction privileges.
  • Use text submission for input as the token's user, or session-to-session messaging for server-stamped sending-session provenance.