API

Token

The tokens members made for an agent, never their values: list them or revoke one.

Operations

Every route this entity exposes. Each route links to its own reference on this page.

Method Route SDK operation Returns
GET /agents/{id}/tokens list The tokens
DELETE /agents/{id}/tokens/{tokenId} remove The token no longer works

Examples

One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.

Golang

Construct client as shown in the Golang setup, then call the operations:

tokens, err := client.Token(nil).List(map[string]any{"agent_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(tokens)
removed, err := client.Token(nil).Remove(map[string]any{"agent_id": "example", "id": "example_id"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(removed)

Lua

Construct client as shown in the Lua setup, then call the operations:

local tokens, err = client:Token():list({ agent_id = "example" })
local removed, err = client:Token():remove({ agent_id = "example", id = "example_id" })

PHP

Construct client as shown in the PHP setup, then call the operations:

$tokens = $client->Token()->list(["agent_id" => "example"]);
$client->Token()->remove(["agent_id" => "example", "id" => "example_id"]);

Python

Construct client as shown in the Python setup, then call the operations:

tokens = client.Token().list({"agent_id": "example"})
client.Token().remove({"agent_id": "example", "id": "example_id"})

Ruby

Construct client as shown in the Ruby setup, then call the operations:

tokens = client.Token.list({ "agent_id" => "example" })
client.Token.remove({ "agent_id" => "example", "id" => "example_id" })

TypeScript

Construct client as shown in the TypeScript setup, then call the operations:

const tokens = await client.Token().list({ agent_id: "example" })
await client.Token().remove({ agent_id: "example", id: "example_id" })

Fields

Field Type Required Description
createdAt string Yes Created At
id string Yes Id
lastUsedAt any Yes Last Used At
name string Yes Name

list

GET /agents/{id}/tokens

Operation ID: listTokens.

Authentication: bearer token (token) or oauth2 (oauth).

Parameters

Parameter In Type Required Description
id path string Yes The agent's id

Responses

200: The tokens

application/json

Property Type Required Description
[].createdAt string (date-time) Yes
[].id string (uuid) Yes
[].lastUsedAt string (date-time) or null Yes
[].name string Yes
4XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes
5XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes

remove

DELETE /agents/{id}/tokens/{tokenId}

Operation ID: revokeToken.

Authentication: bearer token (token) or oauth2 (oauth).

Parameters

Parameter In Type Required Description
id path string Yes The agent's id
tokenId path string Yes

Responses

204: The token no longer works
4XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes
5XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes