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:readandapi_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
- Open API Tokens and select Create token.
- Enter a name of 1 to 40 characters, such as the pipeline that uses the token.
- Choose an expiry of 30, 90 or 365 days. The default is 90 days. A token always expires.
- Choose the workspaces the token may reach.
- Select the permissions the token needs. Fleet offers only permissions you hold that a custom role may hold.
- Select Create.
- 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. - Send it as
Authorization: Bearer <token>tohttps://app.emdashfleet.com/api/v1. - 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.