Threaded API Tokens

Who can mint a machine credential, how long it lasts, and how to use it with the CLI and the API.

Most teams that automate Threaded start by copying a person’s session or asking someone to click through the app on a schedule. That ties CI and scheduled jobs to a human account, and it leaves a credential behind when that person leaves.

In Threaded, an owner mints a named API token. The secret is shown once. Jobs send it as Authorization: Bearer followed by the secret, which starts with thr_sat_, and get editor access to that organization.

#What it is

  • API token. A name you choose, such as GitHub Actions. One name can hold several secrets over time. This page is separate from Admin › Integrations and from Connecting Threaded MCP.
  • Token. The secret starts with thr_sat_. Threaded stores a hash. The dialog API token created is the only time the full value is shown. The API returns that value in the token field on create and on mint, and nowhere else.
  • Editor access. A token minted here can view and edit organization work the way an editor can: instructions, actions, media, and comments. It is not an owner.

#Rules

  • Only an organization owner can open this page, create a token, mint another, revoke one, or delete a name. Editors, operators, and an API token itself are refused. The management API returns 403 You must have owner permissions on this Organization. for an editor, and 403 Service tokens cannot access this endpoint. for an API token.
  • Expiry is optional. Leave Set an expiration date unchecked and the secret works until you revoke it or delete the name. A time you set is enforced: after Expires, the API returns 401 Service token has expired. A time in the past is refused with Expiration must be in the future.
  • Every organization has API tokens. There’s no separate add-on to turn on.
  • There is no per-token access picker. Every token minted here has the same editor access. It cannot invite people, change roles, mint more tokens, or use the AI Assistant. It does not appear in Members.
  • It does not include the grant threaded notify needs. That command fails with Request failed (403): You must have editor permissions on this Organization.
  • It cannot preview, list, read, submit, approve, reject or merge a plant release, and it cannot read effectivity or make a revision effective. Those need a person signed in as an Owner or Editor. See Plant Git and Imports.
  • An API token does not sign in to hosted MCP, and it cannot mint the short-lived job token the hosted runner uses. That call returns Service tokens cannot access this endpoint. Hosted MCP signs in as a person. See From the CLI or API.
  • The plaintext cannot be recovered after you close API token created. Revoke has no undo.
  • Last used is recorded about every five minutes, not on every request.
  • Threaded’s own automation tokens are omitted from this list. You cannot mint or revoke them here.

#In the app

#Open API tokens

Open the Admin gear and choose API tokens.

Someone who is not an owner sees Owners only: Only organization owners can manage API tokens.

An empty list says No API tokens yet and Create one to mint your first token.

#Create a token

  1. Click Create API token.
  2. Enter a Name you will recognize later. The dialog’s example is GitHub Actions. An empty name shows Name is required. The API accepts at most 200 characters. A blank name returns 400 This field may not be blank. A missing name returns This field is required.
  3. Leave Set an expiration date unchecked, or check it and set Expires. Expires starts 90 days ahead. The field says The token stops working after this time. A blank date shows Choose an expiration date. A date Threaded cannot read shows Expiration is not a valid date. A time in the past shows Expiration must be in the future.
  4. Click Create & mint token.
  5. In API token created, copy the value. The warning is Copy this token now. It will not be shown again. Click Copy token, then Done.

The dialog also says tokens have editor-level access (view and edit), and that they cannot manage owners, members, or API tokens, and cannot use the AI Assistant.

#Mint another token

Expand the name (Show tokens for {name}). The row lists Prefix, Last used, Expires, and Status: Active, Expired, or Revoked.

Click Mint token. The dialog title is Mint token for {name}. Set an expiration if you want one, then click Create token. Copy the new value from API token created before you close it. Use this when you rotate: mint the new secret, update the job, then revoke the old one.

#Revoke or delete

Revoke is on a token while its status is Active. Confirm Revoke {prefix}…? The message is Anything using this token stops working.

Delete is on the name. Confirm Delete {name}? The message is All of its tokens are revoked, and anything using them stops working.

#Troubleshooting

I closed the dialog before copying. Threaded does not keep the plaintext. Mint another token, point the job at it, and revoke the one you may have lost.

Login says the token is invalid. The value was revoked, the name was deleted, or the copy is incomplete. Those cases return 401 Invalid service token. Deleting a name revokes every token under it, so the job sees the same invalid-token error as a revoke.

The job uses Authorization: Token. A person’s session uses Token. An API token uses Bearer. The Token scheme is rejected for a secret that starts with thr_sat_.

Could not copy token. Copying to the clipboard failed. Select the value in API token created and copy it before you click Done.

Could not load API tokens. The list request failed. Reload the page.

#From the CLI or API

An API token signs in the threaded CLI on your computer or in CI, and any HTTPS client that sends the Bearer header below. It does not sign in to hosted MCP (the in-app assistant, Cursor, or Claude). Those sign in as a person. Inside a hosted script, threaded already uses that person’s short-lived credential, and threaded auth login is refused: auth login is not available in a Threaded workspace: the workspace manages its own credential.

#Use the token with the CLI

Pass the secret as "$THREADED_SERVICE_TOKEN" from your secret manager. Do not put the secret in a command that gets logged.

Save a login:

threaded auth login --service-token "$THREADED_SERVICE_TOKEN" --organization '<org-uuid>'

--organization is required. threaded auth orgs lists memberships, and an API token is not a member, so it cannot discover the organization for you. Optional --base-url defaults to https://app.threadedmfg.com.

For CI, skip the saved login. Have the secret manager set THREADED_SERVICE_TOKEN, then export it so child processes see it. Do not write the secret into the command:

export THREADED_SERVICE_TOKEN
export THREADED_ORGANIZATION='<org-uuid>'

Alternatively, put the same keys in the nearest project .env file, up to the git root, without export. Only unset THREADED_* keys are applied from that file.

THREADED_BASE_URL overrides the host. THREADED_SERVICE_TOKEN overrides a saved personal login for that process. Set THREADED_ORGANIZATION too. If it is unset, the CLI uses the organization of the saved login on that computer, and calls fail if that is not the token’s organization. The hosted script runner does not read a project .env.

threaded auth status shows authMethod service_token. threaded auth refresh is refused: Service tokens cannot be refreshed. Mint a new token in organization settings. threaded auth logout clears the login on this computer only and prints Service tokens are cleared locally only; revoke unused tokens in organization settings.

threaded notify fails for a token minted on this page. The CLI prints Request failed (403): You must have editor permissions on this Organization.

#Call the API

Send Authorization: Bearer followed by the secret. The value starts with thr_sat_. Do not paste the secret into a command that gets logged. A shell expands $THREADED_SERVICE_TOKEN only inside double quotes:

curl -H "Authorization: Bearer $THREADED_SERVICE_TOKEN" \
  "https://app.threadedmfg.com/api/v1/organizations/$THREADED_ORGANIZATION/"

A single-quoted header, or a paste into a client that does not expand variables, sends the text $THREADED_SERVICE_TOKEN. That value does not start with thr_sat_, so the API returns 401 Authentication credentials were not provided. Invalid service token. is only for a thr_sat_ secret that is unknown or revoked.

With that header the token can call the same editor APIs a person can, including organization detail, work instructions, actions, and media. Managing tokens is a separate, owner-only surface. Use threaded api call while signed in as an owner:

  • v1_organizations_service_accounts_list: list names.
  • v1_organizations_service_accounts_create_create: create a name and mint the first token. Body fields are name (at most 200 characters) and optional expires_at. The response field token is the secret. List and retrieve do not include it.
  • v1_organizations_service_accounts_retrieve: read one name.
  • v1_organizations_service_accounts_partial_update: rename it (name).
  • v1_organizations_service_accounts_tokens_list: list a name’s tokens (prefix, expiry, revoked time, last used).
  • v1_organizations_service_accounts_tokens_create_create: mint another. Optional body field expires_at. The response field token is the new secret, and it is not returned again.
  • v1_organizations_service_accounts_tokens_revoke_create: revoke one token. Success is 204.

Deleting a name is not available through threaded api call, even for an owner. Delete it with Delete on the page, or send an HTTPS DELETE to /api/v1/organizations/<org_uuid>/service-accounts/<service_account_uuid>/ as a signed-in owner. That revokes every token under the name and returns 204.

For example, to list names:

threaded api call --operation-id v1_organizations_service_accounts_list --path organization_uuid=<org_uuid>

Statuses on the page:

  • Active: not revoked, and either no expiry or the expiry is still ahead.
  • Expired: the expiry time has passed. API calls return 401 Service token has expired.
  • Revoked: an owner revoked it. Deleting the name removes it from the page and revokes every token under it. API calls return 401 Invalid service token.

Common errors:

  • 401 Invalid service token.: unknown, revoked, deleted, or a bad copy. Mint a replacement.
  • 401 Service token has expired.: mint a new token.
  • 401 Invalid Bearer token header.: the header is not the word Bearer plus one token.
  • 403 You must have owner permissions on this Organization.: an editor tried to manage tokens.
  • 403 Service tokens cannot access this endpoint.: an API token tried to list, create, mint, or revoke tokens.
  • 400 Expiration must be in the future.
  • 400 This field may not be blank.: name was empty.
  • 400 This field is required.: name was missing.
  • Service token must start with thr_sat_.
  • Service token login requires —organization (service accounts are not listed by auth orgs).
  • Do not combine —service-token with —email/—password.
  • THREADED_SERVICE_TOKEN must start with thr_sat_ (got a non-service token value).