Clients
Package: agentrouter.clients.v1 Service: ClientsService
Endpoints
Create a client
What it does: Creates a new client and a new API key attached 1:1 (client_id == key_id at bootstrap).
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
title | no | Human-friendly title for the client. |
key_name | no | Backing key name; defaults to title when empty. |
enterprise_context | no | Optional enterprise tenancy context (legacy AdminServer path). |
Response fields:
| Field | Required | Description |
|---|---|---|
client_id | no | Bootstrap behavior: the first key establishes the client identity, so initially client_id == key_id. |
key_id | no | Id (UUID) of the newly minted key version. |
api_key_once | no | The raw secret key, returned exactly once at creation; never stored. |
prefix | no | Public, non-secret key prefix. |
key_hash | no | Hash of the secret key material. |
key_address | no | System-generated lookup handle used to locate the key at auth time. |
key_suffix | no | Last 4 characters of the issued key, for display. |
{"signatures":{"go":"func (cl *ClientsClient) Create(ctx context.Context, req *clientsv1.CreateClientWithKeyRequest) (*clientsv1.CreateClientWithKeyResponse, error)","python":"create(customer_id: str, project_id: str, title: str, key_name: str) -\u003e CreateClientWithKeyResponse","typescript":"create(req: { customerId: string projectId: string title?: string keyName?: string }): Promise\u003cCreateClientWithKeyResponse\u003e","cli":"tare api clients create","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"title\": \"...\",\n \"key_name\": \"...\",\n \"enterprise_context\": {}\n }'"},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tclientsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/clients/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026clientsv1.CreateClientWithKeyRequest{}\n\n\tresp, err := client.Clients().Create(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/createclientwithkey\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\ntitle = \"...\"\nkey_name = \"...\"\ntry:\n result = client.clients.create(customer_id, project_id, title, key_name)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.clients.create(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients create","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"title\": \"...\",\n \"key_name\": \"...\",\n \"enterprise_context\": {}\n }'"},"persona":"Authenticated (API key or session token)","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients","slug":"create-a-client"}
List clients
What it does: Returns every client owned by the caller within the given (customer_id, project_id) scope.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
Response fields:
| Field | Required | Description |
|---|---|---|
clients | no | All clients owned by the caller within the (customer, project) scope. |
{"signatures":{"go":"func (cl *ClientsClient) List(ctx context.Context, customerID, projectID string) (*clientsv1.ListClientsResponse, error)","python":"list(customer_id: str, project_id: str) -\u003e ListClientsResponse","typescript":"list(customerId: string, projectId: string): Promise\u003cListClientsResponse\u003e","cli":"tare api clients list","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n)\n\n// input holds the request fields. Replace the placeholder values below.\ntype input struct {\n\tCustomerID string\n\tProjectID string\n}\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\tin := input{\n\t\tCustomerID: \"cust_01H...\",\n\t\tProjectID: \"proj_01H...\",\n\t}\n\n\tcustomerID := in.CustomerID\n\tprojectID := in.ProjectID\n\tresult, err := client.Clients().List(ctx, customerID, projectID)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", result)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/listclients\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\ntry:\n result = client.clients.list(customer_id, project_id)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Replace the placeholder values below.\nconst customerId = \"cust_01H...\"\nconst projectId = \"proj_01H...\"\ntry {\n const result = await client.clients.list(customerId, projectId)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients list","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\""},"persona":"Authenticated (API key or session token)","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients","slug":"list-clients"}
Get a client
What it does: Returns a single client by id within the scope.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) to fetch. |
Response fields:
| Field | Required | Description |
|---|---|---|
client | no | The requested client with its attached keys. |
{"signatures":{"go":"func (cl *ClientsClient) Get(ctx context.Context, customerID, projectID, clientID string) (*clientsv1.GetClientResponse, error)","python":"get(customer_id: str, project_id: str, client_id: str) -\u003e GetClientResponse","typescript":"get(customerId: string, projectId: string, clientId: string): Promise\u003cGetClientResponse\u003e","cli":"tare api clients get --client-id $CLIENT_ID","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H...\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n)\n\n// input holds the request fields. Replace the placeholder values below.\ntype input struct {\n\tCustomerID string\n\tProjectID string\n\tClientID string\n}\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\tin := input{\n\t\tCustomerID: \"cust_01H...\",\n\t\tProjectID: \"proj_01H...\",\n\t\tClientID: \"...\",\n\t}\n\n\tcustomerID := in.CustomerID\n\tprojectID := in.ProjectID\n\tclientID := in.ClientID\n\tresult, err := client.Clients().Get(ctx, customerID, projectID, clientID)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", result)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/getclient\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\ntry:\n result = client.clients.get(customer_id, project_id, client_id)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Replace the placeholder values below.\nconst customerId = \"cust_01H...\"\nconst projectId = \"proj_01H...\"\nconst clientId = \"...\"\ntry {\n const result = await client.clients.get(customerId, projectId, clientId)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients get --client-id $CLIENT_ID","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H...\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\""},"persona":"Authenticated (API key or session token)","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}","slug":"get-a-client"}
Update a client
What it does: Updates the editable client title.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) whose title is being updated. |
title | yes | New human-friendly title for the client. |
Response fields:
| Field | Required | Description |
|---|---|---|
client | no | The client after the title update. |
{"signatures":{"go":"func (cl *ClientsClient) UpdateTitle(ctx context.Context, customerID, projectID, clientID, title string) (*clientsv1.UpdateClientTitleResponse, error)","python":"update_title(customer_id: str, project_id: str, client_id: str, title: str) -\u003e UpdateClientTitleResponse","typescript":"updateTitle(customerId: string, projectId: string, clientId: string, title: string): Promise\u003cUpdateClientTitleResponse\u003e","cli":"tare api clients update --client-id $CLIENT_ID --title $TITLE","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H...\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"title\": \"...\"\n }'"},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n)\n\n// input holds the request fields. Replace the placeholder values below.\ntype input struct {\n\tCustomerID string\n\tProjectID string\n\tClientID string\n\tTitle string\n}\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\tin := input{\n\t\tCustomerID: \"cust_01H...\",\n\t\tProjectID: \"proj_01H...\",\n\t\tClientID: \"...\",\n\t\tTitle: \"...\",\n\t}\n\n\tcustomerID := in.CustomerID\n\tprojectID := in.ProjectID\n\tclientID := in.ClientID\n\ttitle := in.Title\n\tresult, err := client.Clients().UpdateTitle(ctx, customerID, projectID, clientID, title)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", result)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/updateclienttitle\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\ntitle = \"...\"\ntry:\n result = client.clients.update_title(customer_id, project_id, client_id, title)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Replace the placeholder values below.\nconst customerId = \"cust_01H...\"\nconst projectId = \"proj_01H...\"\nconst clientId = \"...\"\nconst title = \"...\"\ntry {\n const result = await client.clients.updateTitle(customerId, projectId, clientId, title)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients update --client-id $CLIENT_ID --title $TITLE","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H...\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"title\": \"...\"\n }'"},"persona":"Authenticated (API key or session token)","httpVerb":"PATCH","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}","slug":"update-a-client"}
Attach a key to a client
What it does: Attaches an existing key to a client.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) to attach the key to. |
key_id | yes | Id (UUID) of the existing key to attach. |
Response fields:
| Field | Required | Description |
|---|---|---|
success | no | True when the key was attached successfully. |
{"signatures":{"go":"func (cl *ClientsClient) AddKey(ctx context.Context, customerID, projectID, clientID, keyID string) (*clientsv1.AddKeyToClientResponse, error)","python":"add_key(customer_id: str, project_id: str, client_id: str, key_id: str) -\u003e AddKeyToClientResponse","typescript":"addKey(customerId: string, projectId: string, clientId: string, keyId: string): Promise\u003cAddKeyToClientResponse\u003e","cli":"tare api clients keys add --client-id $CLIENT_ID --key-id $KEY_ID","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"key_id\": \"...\"\n }'"},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n)\n\n// input holds the request fields. Replace the placeholder values below.\ntype input struct {\n\tCustomerID string\n\tProjectID string\n\tClientID string\n\tKeyID string\n}\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\tin := input{\n\t\tCustomerID: \"cust_01H...\",\n\t\tProjectID: \"proj_01H...\",\n\t\tClientID: \"...\",\n\t\tKeyID: \"...\",\n\t}\n\n\tcustomerID := in.CustomerID\n\tprojectID := in.ProjectID\n\tclientID := in.ClientID\n\tkeyID := in.KeyID\n\tresult, err := client.Clients().AddKey(ctx, customerID, projectID, clientID, keyID)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", result)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/addkeytoclient\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\nkey_id = \"...\"\ntry:\n result = client.clients.add_key(customer_id, project_id, client_id, key_id)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Replace the placeholder values below.\nconst customerId = \"cust_01H...\"\nconst projectId = \"proj_01H...\"\nconst clientId = \"...\"\nconst keyId = \"...\"\ntry {\n const result = await client.clients.addKey(customerId, projectId, clientId, keyId)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients keys add --client-id $CLIENT_ID --key-id $KEY_ID","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"key_id\": \"...\"\n }'"},"persona":"Authenticated (API key or session token)","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}/keys","slug":"attach-a-key-to-a-client"}
Rotate a client key
What it does: Creates a new key attached to client_id and may schedule the prior key's disable/destroy lifecycle.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) whose key is being rotated. |
user_key_address | no | Deprecated/ignored: key address is system-generated, not user-chosen. |
key_name | no | Name for the new key version. Required. |
enterprise_context | no | Optional enterprise tenancy context (legacy AdminServer path). |
old_key_id | no | Id (UUID) of the prior key to schedule disable/destroy for; empty skips scheduling. |
old_key_disable_at | no | Absolute time to auto-disable the old key; overridden by disable_after when set. |
old_key_destroy_at | no | Absolute time to auto-destroy the old key; overridden by destroy_after when set. |
disable_after | no | Convenience flags for the CLI: durations relative to now. When set they override old_key_disable_at / old_key_destroy_at. |
destroy_after | no | undocumented |
Response fields:
| Field | Required | Description |
|---|---|---|
client_id | no | Client id (UUID) the new key is attached to (unchanged by rotation). |
key_id | no | Id (UUID) of the newly minted key version. |
api_key_once | no | The raw secret key, returned exactly once; never stored. |
prefix | no | Public, non-secret key prefix. |
key_hash | no | Hash of the secret key material. |
key_address | no | System-generated lookup handle used to locate the key at auth time. |
key_suffix | no | Last 4 characters of the issued key, for display. |
old_key_lifecycle_scheduled | no | True when a disable/destroy schedule was applied to the prior key. |
{"signatures":{"go":"func (cl *ClientsClient) RotateKey(ctx context.Context, req *clientsv1.RotateKeyInClientRequest) (*clientsv1.RotateKeyInClientResponse, error)","python":"rotate_key(customer_id: str, project_id: str, client_id: str, key_name: str, user_key_address: str, old_key_id: str, disable_after: str, destroy_after: str) -\u003e RotateKeyInClientResponse","typescript":"rotateKey(req: { customerId: string projectId: string clientId: string keyName?: string userKeyAddress?: string oldKeyId?: string disableAfter?: string destroyAfter?: string }): Promise\u003cRotateKeyInClientResponse\u003e","cli":"tare api clients keys rotate --client-id $CLIENT_ID","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/rotate\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"user_key_address\": \"...\",\n \"key_name\": \"...\",\n \"enterprise_context\": {},\n \"old_key_id\": \"...\",\n \"old_key_disable_at\": {},\n \"old_key_destroy_at\": {},\n \"disable_after\": \"...\",\n \"destroy_after\": \"...\"\n }'"},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tclientsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/clients/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026clientsv1.RotateKeyInClientRequest{}\n\n\tresp, err := client.Clients().RotateKey(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/rotatekeyinclient\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\nkey_name = \"...\"\nuser_key_address = \"...\"\nold_key_id = \"...\"\ndisable_after = \"...\"\ndestroy_after = \"...\"\ntry:\n result = client.clients.rotate_key(customer_id, project_id, client_id, key_name, user_key_address, old_key_id, disable_after, destroy_after)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.clients.rotateKey(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients keys rotate --client-id $CLIENT_ID","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/rotate\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"user_key_address\": \"...\",\n \"key_name\": \"...\",\n \"enterprise_context\": {},\n \"old_key_id\": \"...\",\n \"old_key_disable_at\": {},\n \"old_key_destroy_at\": {},\n \"disable_after\": \"...\",\n \"destroy_after\": \"...\"\n }'"},"persona":"Authenticated (API key or session token)","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}/keys/rotate","slug":"rotate-a-client-key"}
Disable a client key version
What it does: Disables a key version immediately (reversible).
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) that owns the key version. |
key_version | yes | Key version id (UUID). Named key_version to match IA's vocabulary; fraser stores one row per version in api_keys. |
Response fields:
| Field | Required | Description |
|---|---|---|
success | no | True when the key version was disabled. |
{"signatures":{"go":"func (cl *ClientsClient) DisableKey(ctx context.Context, customerID, projectID, clientID, keyVersion string) (*clientsv1.DisableKeyVersionInClientResponse, error)","python":"disable_key(customer_id: str, project_id: str, client_id: str, key_version: str) -\u003e DisableKeyVersionInClientResponse","typescript":"disableKey(customerId: string, projectId: string, clientId: string, keyVersion: string): Promise\u003cDisableKeyVersionInClientResponse\u003e","cli":"tare api clients keys disable --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H.../disable\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{}'"},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n)\n\n// input holds the request fields. Replace the placeholder values below.\ntype input struct {\n\tCustomerID string\n\tProjectID string\n\tClientID string\n\tKeyVersion string\n}\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\tin := input{\n\t\tCustomerID: \"cust_01H...\",\n\t\tProjectID: \"proj_01H...\",\n\t\tClientID: \"...\",\n\t\tKeyVersion: \"...\",\n\t}\n\n\tcustomerID := in.CustomerID\n\tprojectID := in.ProjectID\n\tclientID := in.ClientID\n\tkeyVersion := in.KeyVersion\n\tresult, err := client.Clients().DisableKey(ctx, customerID, projectID, clientID, keyVersion)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", result)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/disablekeyversioninclient\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\nkey_version = \"...\"\ntry:\n result = client.clients.disable_key(customer_id, project_id, client_id, key_version)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Replace the placeholder values below.\nconst customerId = \"cust_01H...\"\nconst projectId = \"proj_01H...\"\nconst clientId = \"...\"\nconst keyVersion = \"...\"\ntry {\n const result = await client.clients.disableKey(customerId, projectId, clientId, keyVersion)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients keys disable --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H.../disable\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{}'"},"persona":"Authenticated (API key or session token)","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}/keys/{key_version}/disable","slug":"disable-a-client-key-version"}
Enable a client key version
What it does: Re-enables a disabled key version.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) that owns the key version. |
key_version | yes | Key version id (UUID) to re-enable. |
Response fields:
| Field | Required | Description |
|---|---|---|
success | no | True when the key version was re-enabled. |
{"signatures":{"go":"func (cl *ClientsClient) EnableKey(ctx context.Context, customerID, projectID, clientID, keyVersion string) (*clientsv1.EnableKeyVersionInClientResponse, error)","python":"enable_key(customer_id: str, project_id: str, client_id: str, key_version: str) -\u003e EnableKeyVersionInClientResponse","typescript":"enableKey(customerId: string, projectId: string, clientId: string, keyVersion: string): Promise\u003cEnableKeyVersionInClientResponse\u003e","cli":"tare api clients keys enable --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H.../enable\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{}'"},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n)\n\n// input holds the request fields. Replace the placeholder values below.\ntype input struct {\n\tCustomerID string\n\tProjectID string\n\tClientID string\n\tKeyVersion string\n}\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\tin := input{\n\t\tCustomerID: \"cust_01H...\",\n\t\tProjectID: \"proj_01H...\",\n\t\tClientID: \"...\",\n\t\tKeyVersion: \"...\",\n\t}\n\n\tcustomerID := in.CustomerID\n\tprojectID := in.ProjectID\n\tclientID := in.ClientID\n\tkeyVersion := in.KeyVersion\n\tresult, err := client.Clients().EnableKey(ctx, customerID, projectID, clientID, keyVersion)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", result)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/enablekeyversioninclient\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\nkey_version = \"...\"\ntry:\n result = client.clients.enable_key(customer_id, project_id, client_id, key_version)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Replace the placeholder values below.\nconst customerId = \"cust_01H...\"\nconst projectId = \"proj_01H...\"\nconst clientId = \"...\"\nconst keyVersion = \"...\"\ntry {\n const result = await client.clients.enableKey(customerId, projectId, clientId, keyVersion)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients keys enable --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H.../enable\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{}'"},"persona":"Authenticated (API key or session token)","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}/keys/{key_version}/enable","slug":"enable-a-client-key-version"}
Destroy a client key version
What it does: Permanently destroys a key version.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) that owns the key version. |
key_version | yes | Key version id (UUID) to permanently destroy. |
Response fields:
| Field | Required | Description |
|---|---|---|
success | no | True when the key version was destroyed. |
{"signatures":{"go":"func (cl *ClientsClient) DestroyKey(ctx context.Context, customerID, projectID, clientID, keyVersion string) (*clientsv1.DestroyKeyVersionInClientResponse, error)","python":"destroy_key(customer_id: str, project_id: str, client_id: str, key_version: str) -\u003e DestroyKeyVersionInClientResponse","typescript":"destroyKey(customerId: string, projectId: string, clientId: string, keyVersion: string): Promise\u003cDestroyKeyVersionInClientResponse\u003e","cli":"tare api clients keys destroy --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H...\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n)\n\n// input holds the request fields. Replace the placeholder values below.\ntype input struct {\n\tCustomerID string\n\tProjectID string\n\tClientID string\n\tKeyVersion string\n}\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\tin := input{\n\t\tCustomerID: \"cust_01H...\",\n\t\tProjectID: \"proj_01H...\",\n\t\tClientID: \"...\",\n\t\tKeyVersion: \"...\",\n\t}\n\n\tcustomerID := in.CustomerID\n\tprojectID := in.ProjectID\n\tclientID := in.ClientID\n\tkeyVersion := in.KeyVersion\n\tresult, err := client.Clients().DestroyKey(ctx, customerID, projectID, clientID, keyVersion)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", result)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/destroykeyversioninclient\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\nkey_version = \"...\"\ntry:\n result = client.clients.destroy_key(customer_id, project_id, client_id, key_version)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Replace the placeholder values below.\nconst customerId = \"cust_01H...\"\nconst projectId = \"proj_01H...\"\nconst clientId = \"...\"\nconst keyVersion = \"...\"\ntry {\n const result = await client.clients.destroyKey(customerId, projectId, clientId, keyVersion)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients keys destroy --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H...\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\""},"persona":"Authenticated (API key or session token)","httpVerb":"DELETE","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}/keys/{key_version}","slug":"destroy-a-client-key-version"}
Emergency-revoke a client key version
What it does: Disables a key immediately and optionally creates a replacement.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer slug. Defaults to the caller's session customer when empty. |
project_id | no | Owning project slug. Defaults to the caller's session project when empty. |
client_id | yes | Client id (UUID) that owns the key version being revoked. |
key_version | yes | Key version id (UUID) to revoke (disable immediately). |
generate_replacement | no | When true, also rotate in a replacement key after revoking. |
replacement_key_name | no | Name for the replacement key; required when generate_replacement is true. |
replacement_user_key_address | no | Deprecated/ignored: replacement key address is system-generated. |
replacement_enterprise_context | no | Optional enterprise tenancy context for the replacement key. |
Response fields:
| Field | Required | Description |
|---|---|---|
success | no | True when the key version was revoked. |
replacement | no | The freshly rotated replacement key; set only when one was requested. |
{"signatures":{"go":"func (cl *ClientsClient) EmergencyRevoke(ctx context.Context, req *clientsv1.EmergencyRevokeKeyVersionRequest) (*clientsv1.EmergencyRevokeKeyVersionResponse, error)","python":"emergency_revoke(customer_id: str, project_id: str, client_id: str, key_version: str, generate_replacement: bool, replacement_key_name: str, replacement_user_key_address: str) -\u003e EmergencyRevokeKeyVersionResponse","typescript":"emergencyRevoke(req: { customerId: string projectId: string clientId: string keyVersion: string generateReplacement?: boolean replacementKeyName?: string replacementUserKeyAddress?: string }): Promise\u003cEmergencyRevokeKeyVersionResponse\u003e","cli":"tare api clients keys emergency-revoke --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H.../emergency-revoke\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"generate_replacement\": false,\n \"replacement_key_name\": \"...\",\n \"replacement_user_key_address\": \"...\",\n \"replacement_enterprise_context\": {}\n }'"},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tclientsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/clients/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026clientsv1.EmergencyRevokeKeyVersionRequest{}\n\n\tresp, err := client.Clients().EmergencyRevoke(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/clients/emergencyrevokekeyversion\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Replace the placeholder values below.\ncustomer_id = \"cust_01H...\"\nproject_id = \"proj_01H...\"\nclient_id = \"...\"\nkey_version = \"...\"\ngenerate_replacement = \"...\"\nreplacement_key_name = \"...\"\nreplacement_user_key_address = \"...\"\ntry:\n result = client.clients.emergency_revoke(customer_id, project_id, client_id, key_version, generate_replacement, replacement_key_name, replacement_user_key_address)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.clients.emergencyRevoke(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"clients\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api clients keys emergency-revoke --client-id $CLIENT_ID --key-version $KEY_VERSION","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../clients/client_01H.../keys/01H.../emergency-revoke\" \\\n -H \"Authorization: Bearer ${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"generate_replacement\": false,\n \"replacement_key_name\": \"...\",\n \"replacement_user_key_address\": \"...\",\n \"replacement_enterprise_context\": {}\n }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/clients/{client_id}/keys/{key_version}/emergency-revoke","slug":"emergency-revoke-a-client-key-version"}