API-only: a persisted role-backed API token creates a token with the calling role or a selected role with equal or narrower permissions and restrictions at issuance. Selected-role membership is not required. Role changes remain live. Requires the API token creation feature and grant-token-via-api permission. Expiring callers can only create tokens that expire earlier; unexpiring callers may create unexpiring tokens. Revocation is independent. Delegated tokens cannot create further tokens, regardless of role permissions. A delegated token has a fixed expiry that neither its own rotation nor parent rotation extends.
Required permission
Account > Admin > ApiTokens > Grant Token Via Api
Request body
- {object}
name
string requiredmin length3max length100pattern^[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*$description
stringmax length200pattern^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$roleId
stringSelected role ID. Omit with roleType to inherit the calling role.pattern^[A-Za-z0-9-]+$roleType
stringone oforg, teamexpiresAt
string | nullMust precede the calling credential expiry. Omit or use null for no expiry when the caller is unexpiring.
Response body
- {object}Response object.
data
{object} requiredResult data.id
string requiredtoken
string requiredexpiresAt
string | null required
POST /v1/tokens
POST /v1/teams/{teamId}/tokens
Example request
curl --header "Content-Type: application/json" \
--header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
--request POST \
--data '{"name":"string"}' \
"https://api.northflank.com/v1/tokens"Example response
200 OK
JSON
{
"data": {
"id": "string",
"token": "string",
"expiresAt": "1970-01-01T00:00:00.000Z"
}
}