Access Tokens¶
The AccessToken resource¶
Access Token for the Scalr API.
Key path
Description
type* (string)
Available values:access-tokens
id (string)
attributes.created-at (string)
Date/Time the token was created.
attributes.description (string)
The description of the token.
attributes.last-used-at (string)
Date/Time when the token was last used.
attributes.token (string)
The JWT token which an API client should pass in the
Authorization: Bearer <token>
header. Available only in the Create an Access Token response.relationships.created-by (object)
The user who created the token.
relationships.created-by.data.type* (string)
Available values:users
relationships.created-by.data.id* (string)
links (object)
Create an Access Token¶
-
POST
/api/iacp/v3/access-tokens
¶ This endpoint creates access token.
- Query Parameters
include (array) – The comma-separated list of relationship paths. (Available values:
created-by
)
Request body:
Key path
Description
data.type* (string)
Available values:access-tokens
data.id (string)
data.attributes.description (string)
The description of the token.
data.links (object)
Example Request:
POST /api/iacp/v3/access-tokens HTTP/1.1 Host: my.scalr.io Content-Type: application/vnd.api+json Prefer: profile=preview { "data": { "attributes": { "description": "string" }, "id": "string", "links": {}, "type": "access-tokens" } }
- Status Codes
201 Created – Successfully created.
422 Unprocessable Entity – Malformed request body (missing attributes, wrong types, etc.).
4XX – Client error.
5XX – Server error.
Delete an Access Token¶
-
DELETE
/api/iacp/v3/access-tokens/{access_token}
¶ Delete an access token by ID.
- Parameters
access_token (string) – The ID of the access token to be deleted.
- Status Codes
204 No Content – Deleted.
404 Not Found – Object not found or user unauthorized.
4XX – Client error.
5XX – Server error.
Get an Access Token¶
-
GET
/api/iacp/v3/access-tokens/{access_token}
¶ Get an access token by ID.
- Parameters
access_token (string) – The ID of the access token to get.
- Query Parameters
include (array) – The comma-separated list of relationship paths. (Available values:
created-by
)
Example Request:
GET /api/iacp/v3/access-tokens/{access_token} HTTP/1.1 Host: my.scalr.io Prefer: profile=preview
- Status Codes
200 OK – Success.
404 Not Found – Object not found or user unauthorized.
4XX – Client error.
5XX – Server error.
Update an Access Token¶
-
PATCH
/api/iacp/v3/access-tokens/{access_token}
¶ Update an access token by ID.
- Parameters
access_token (string) – The ID of the access token to be updated.
- Query Parameters
include (array) – The comma-separated list of relationship paths. (Available values:
created-by
)
Request body:
Key path
Description
data.type* (string)
Available values:access-tokens
data.id (string)
data.attributes.description (string)
The description of the token.
data.links (object)
Example Request:
PATCH /api/iacp/v3/access-tokens/{access_token} HTTP/1.1 Host: my.scalr.io Content-Type: application/vnd.api+json Prefer: profile=preview { "data": { "attributes": { "description": "string" }, "id": "string", "links": {}, "type": "access-tokens" } }
- Status Codes
200 OK – Successfully updated.
404 Not Found – Object not found or user unauthorized.
422 Unprocessable Entity – Malformed request body (missing attributes, wrong types, etc.).
4XX – Client error.
5XX – Server error.
List Agent Pool Access Tokens¶
-
GET
/api/iacp/v3/agent-pools/{agent_pool}/access-tokens
¶ - Parameters
agent_pool (string) – The ID of the agent pool to list access tokens for.
- Query Parameters
page[number] (string) – Page number
page[size] (string) – Page size
sort (array) – The comma-separated list of attributes. (Available values:
created-at
,description
,last-used-at
)include (array) – The comma-separated list of relationship paths. (Available values:
created-by
)query (string) – Query string
Example Request:
GET /api/iacp/v3/agent-pools/{agent_pool}/access-tokens HTTP/1.1 Host: my.scalr.io Prefer: profile=preview
- Status Codes
200 OK – Success.
404 Not Found – Object not found or user unauthorized.
4XX – Client error.
5XX – Server error.
Create an Agent Pool Access Token¶
-
POST
/api/iacp/v3/agent-pools/{agent_pool}/access-tokens
¶ This endpoint creates agent pool’s access token.
- Parameters
agent_pool (string) – The ID of the agent pool to create a token for.
- Query Parameters
include (array) – The comma-separated list of relationship paths. (Available values:
created-by
)
Request body:
Key path
Description
data.type* (string)
Available values:access-tokens
data.id (string)
data.attributes.description (string)
The description of the token.
data.links (object)
Example Request:
POST /api/iacp/v3/agent-pools/{agent_pool}/access-tokens HTTP/1.1 Host: my.scalr.io Content-Type: application/vnd.api+json Prefer: profile=preview { "data": { "type": "access-tokens", "attributes": { "description": "my-pool-token" }, "relationships": {} } }
- Status Codes
Successfully created.
Example Respone:
HTTP/1.1 201 Created Content-Type: application/vnd.api+json Preference-Applied: profile=preview { "data": { "attributes": { "created-at": "2021-08-17T14:21:06Z", "description": "my-pool-token", "last-used-at": null, "token": "GciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.IjoiYXQtdGthY3J0cWsybm81NDlvIiwic3ViIjoiYXBvb2wtdGthY21iam9lbWhldWtnIn0.OPSCBzPZYjvfO9QWF2je6UgPWIZ7g" }, "id": "at-tkacrtqk2no549o", "links": {}, "relationships": { "created-by": { "data": { "id": "user-svrcmmpcrkmit1g", "type": "users" } } }, "type": "access-tokens" }, "included": null, "meta": null }
422 Unprocessable Entity – Malformed request body (missing attributes, wrong types, etc.).
4XX – Client error.
5XX – Server error.