Create an API token
Create an API token with a role, a project scope and an expiry, call the API with it, and revoke it. A token is a credential for everything its role allows across the NebulaCtrl API.
Scripts and CI call the NebulaCtrl API with an API token instead of a browser session. A token belongs to one organization and acts with the role you give it.
A token is a credential for the control plane
An unrestricted Admin token can do what a person with the admin role does through the API: deploy, change variables and domains, create clusters and servers, manage members, registries and Git connections, and approve production. Anyone who holds the token can do the same, with no sign-in and no second factor. Give each integration the lowest role it needs, limit it to the projects it touches, set an expiry, and keep it in your CI's secret store.
Before you begin
- You need the admin or owner role and a signed-in browser session. A token cannot create another token.
- Know what the integration does. The role you pick decides which API operations the token can call; the role table lists what each role can do.
Create a token
- Open Settings > API tokens and select Create token.
- Enter a Name that tells you what uses the token, for example
ci-deploy. - Choose a Role: Viewer, Deployer (the default) or Admin. A token cannot have the owner role, and you cannot give it a role above your own.
- Under Projects, keep All projects (includes projects created later) or choose Only some and tick the projects.
- Choose when it Expires: 30 days, 90 days (the default), 1 year or never.
- Select Create token.
- Copy the token from Copy your token now and store it. It is shown once. The dialog closes only with Done.
The token has the form nbl_ID_SECRET. NebulaCtrl stores a SHA-256 hash of the secret, so it cannot show the token again.
Call the API with the token
Send the token as a bearer credential. A token already belongs to one organization, so the X-Nebula-Organization header is optional; if you send it, it must name that organization.
curl -s -o /dev/null -w '%{http_code}\n' \
-H "Authorization: Bearer $NEBULA_TOKEN" \
https://nebula.example.com/api/v1/projectsNEBULA_TOKEN holds the token, and https://nebula.example.com is your control plane's public URL.
200The HTTP API reference lists every operation and the errors it returns. A token that is revoked, expired or malformed gets no identity at all, so the operation answers sign in or provide an API token to ACTION.
Limit a token to projects
A project-limited token reaches only its projects, with the role you gave it. List operations, streams and the Activity page show only those projects.
It is refused everything that acts on the whole organization, even reading it: clusters, nodes, members, teams, policy, API tokens, Git connections and registry credentials. It cannot create projects, clusters or servers. The refusal reads this API token is limited to specific projects and cannot perform ACTION, which acts on the whole organization; use a token without project limits or sign in.
If every project a token is limited to is deleted, the token stays limited and reaches nothing.
What no token can do
Whatever its role, a token cannot:
- create API tokens;
- create organizations, send or accept invitations, or read your notification inbox;
- finish a GitHub App connection, which runs in the browser;
- delete or transfer an organization, or grant or remove the owner role;
- request or cancel a control plane update, which needs an owner of the Default organization;
- turn on Require two-factor for everyone. Tokens are also exempt from that requirement.
In production approvals, a token acts in the name of the person who created it, and only while the token is active.
Rotate and revoke
A token cannot be edited, and there is no rotate action. To rotate:
- Create a new token with the same role and scope.
- Switch your integration to it.
- Select Revoke on the old token's row, then Revoke token.
Revoking takes effect on the token's next request. Open event streams re-check their credential every 30 seconds and close once it is revoked. Any admin or owner can revoke any token in the organization.
NebulaCtrl revokes every token a person created when that person is removed, leaves, has their role lowered, or transfers ownership.
Verify
- The table in Settings > API tokens lists the token with its Role, Projects and Expires columns.
- Last used changes from
neverafter the first call. It updates at most once a minute. - Creating and revoking a token are audit events, and each action the token takes is recorded with the token as the actor. See the audit log.
Tokens with no expiry, or with fewer than 14 days left, appear in a warning color in the table.
Next steps
Manage members and teams
Invite people to an organization, set their roles, group them into teams, require two-factor sign-in and provision members from your identity provider with SCIM.
Connect Git providers and registries
Connect GitHub, GitLab or Forgejo so services build and deploy on push, set up webhooks and commit statuses, and add registry credentials for private images.