Create and revoke API tokens

Create a named API token with an expiry, workspaces and permissions, and revoke it when done.

Create an API token to call the Fleet API from a script or a pipeline.

Before you start

  • You are an Owner, Admin or Developer, or your custom role holds api_tokens:read and api_tokens:write. Read-Only members do not see API Tokens.
  • Creating a token needs a sign-in within the last 30 minutes. An API token cannot create another token.
  • A token holds a subset of your permissions. It loses a permission when your role loses it.

Steps

  1. Open API Tokens and select Create token.
  2. Enter a name of 1 to 40 characters, such as the pipeline that uses the token.
  3. Choose an expiry of 30, 90 or 365 days. The default is 90 days. A token always expires.
  4. Choose the workspaces the token may reach.
  5. Select the permissions the token needs. Fleet offers only permissions you hold that a custom role may hold.
  6. Select Create.
  7. Copy the token into the secret store of the tool that will use it. It starts with ef_ and has 40 more characters. Fleet cannot show it again.
  8. Send it as Authorization: Bearer <token> to https://app.emdashfleet.com/api/v1.
  9. To revoke a token, select Revoke on its row in API Tokens and confirm. Revoking needs no recent sign-in.

Result

API Tokens lists the token with its name, a hint such as ef_ab…yz, its workspaces and its expiry. Owners and Admins list and revoke every token of the account. A Developer lists and revokes only their own.

A revoked token answers 401 from its next request. A token also stops working when it expires or when its creator is suspended, and for good when its creator is removed. Fleet emails the creator 7 days before expiry. Create the replacement and revoke the old token before then.

If something goes wrong

  • At the token limit, Fleet refuses a new token. Revoke a token you no longer use first. See Limits.
The free beta covers up to <n> <sites, team members, workspaces or API tokens>. To ask for a higher limit, open a ticket under Support and tell us how many you need. We reply within 2 business days.
  • You lost a token. Revoke it and create a new one. Never send a token to support. Fleet never asks for one.

Related

Report a problem with this page