ACL Tokens HTTP API
The /acl/bootstrap
, /acl/tokens
, and /acl/token/
endpoints are used to manage ACL tokens.
For more details about ACLs, please see the ACL Guide.
Bootstrap Token
This endpoint is used to bootstrap the ACL system and provide the initial management token. An operator created token can be provided in the body of the request to bootstrap the cluster if required. If no header is provided the cluster will return a generated management token. The provided token should be presented in a UUID format. This request is always forwarded to the authoritative region. It can only be invoked once until a bootstrap reset is performed.
Method | Path | Produces |
---|---|---|
POST | /acl/bootstrap | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | none |
Sample Request
Sample Response
Sample Operator Payload
Sample Request With Operator Token
Sample Response With Operator Token
List Tokens
This endpoint lists all ACL tokens. This lists the local tokens and the global tokens which have been replicated to the region, and may lag behind the authoritative region.
Method | Path | Produces |
---|---|---|
GET | /acl/tokens | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes and required ACLs.
Blocking Queries | Consistency Modes | ACL Required |
---|---|---|
YES | all | management |
Parameters
global
(bool: false)
- If true, only return ACL tokens that are replicated globally to all regions.prefix
(string: "")
- Specifies a string to filter ACL tokens based on an accessor ID prefix. Because the value is decoded to bytes, the prefix must have an even number of hexadecimal characters (0-9a-f). This is specified as a query string parameter.next_token
(string: "")
- This endpoint supports paging. Thenext_token
parameter accepts a string which identifies the next expected ACL token. This value can be obtained from theX-Nomad-NextToken
header from the previous response.per_page
(int: 0)
- Specifies a maximum number of ACL tokens to return for this request. If omitted, the response is not paginated. The value of theX-Nomad-NextToken
header of the last response can be used as thenext_token
of the next request to fetch additional pages.filter
(string: "")
- Specifies the expression used to filter the results. Consider using pagination or a query parameter to reduce resource used to serve the request.reverse
(bool: false)
- Specifies the list of returned ACL tokens should be sorted in the reverse order. By default ACL tokens are returned sorted in chronological order (older ACL tokens first), or in lexicographical order by their ID if theprefix
orglobal
query parameters are used.
Sample Request
Sample Response
Create Token
This endpoint creates an ACL Token. If the token is a global token, the request is forwarded to the authoritative region.
Method | Path | Produces |
---|---|---|
POST | /acl/token | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | management |
Parameters
Name
(string: <optional>)
- Specifies the human-readable name of the token.Type
(string: <required>)
- Specifies the type of token. Must be eitherclient
ormanagement
.Policies
(array<string>: <required>)
- Must be null or blank formanagement
type tokens, otherwise must specify at least one policy forclient
type tokens.Global
(bool: <optional>)
- If true, indicates this token should be replicated globally to all regions. Otherwise, this token is created local to the target region. This can not be changed after token creation.ExpirationTime
(time: "")
- If set, this represents the point after which a token should be considered revoked and is eligible for destruction. The default unset value represents NO expiration.ExpirationTTL
(duration: 0s)
- This is a convenience field and if set will initialize theExpirationTime
field to a value ofCreateTime
+ExpirationTTL
. This value must be between thetoken_min_expiration_ttl
andtoken_max_expiration_ttl
ACL configuration parameters.
Sample Payload
Sample Request
Sample Response
Update Token
This endpoint updates an existing ACL Token. If the token is a global token, the request is forwarded to the authoritative region. Note that a token cannot be switched from global to local or visa versa.
Method | Path | Produces |
---|---|---|
POST | /acl/token/:accessor_id | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | management |
Parameters
AccessorID
(string: <required>)
- Specifies the token (by accessor) that is being updated. Must match payload body and request path.Name
(string: <optional>)
- Specifies the human readable name of the token.Type
(string: <required>)
- Specifies the type of token. Must be eitherclient
ormanagement
.Policies
(array<string>: <required>)
- Must be null or blank formanagement
type tokens, otherwise must specify at least one policy forclient
type tokens.
Sample Payload
Sample Request
Sample Response
Read Token
This endpoint reads an ACL token with the given accessor. If the token is a global token which has been replicated to the region it may lag behind the authoritative region.
Method | Path | Produces |
---|---|---|
GET | /acl/token/:accessor_id | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes and required ACLs.
Blocking Queries | Consistency Modes | ACL Required |
---|---|---|
YES | all | management or a SecretID matching the AccessorID |
Sample Request
Sample Response
Read Self Token
This endpoint reads the ACL token given by the passed SecretID. If the token is a global token which has been replicated to the region it may lag behind the authoritative region.
Method | Path | Produces |
---|---|---|
GET | /acl/token/self | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes and required ACLs.
Blocking Queries | Consistency Modes | ACL Required |
---|---|---|
YES | all | Any valid ACL token |
Sample Request
Sample Response
Delete Token
This endpoint deletes the ACL token by accessor. This request is forwarded to the authoritative region for global tokens.
Method | Path | Produces |
---|---|---|
DELETE | /acl/token/:accessor_id | (empty body) |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | management |
Parameters
accessor_id
(string: <required>)
- Specifies the ACL token accessor ID.
Sample Request
Upsert One-Time Token
This endpoint creates a one-time token for the ACL token provided in the
X-Nomad-Token
header. Returns 403 if the token header is not set.
Method | Path | Produces |
---|---|---|
POST | /acl/token/onetime | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | any |
Sample Request
Sample Response
Exchange One-Time Token
This endpoint exchanges a one-time token for the original ACL token used to create it.
Method | Path | Produces |
---|---|---|
POST | /acl/token/onetime/exchange | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | any |
Sample Request
Sample Response