API Reference
REST endpoints and MCP tool reference for all Toknbase integrations.
Overview
Every API request requires an Authorization header
Requests without this header return401 Unauthorized. Get your agent token from Dashboard → Tokens → Service Identities. Every example in this reference requires this header.
curl https://4wj64-piaaa-aaaan-q5q7q-cai.icp0.io/api/secrets \
-H"Authorization: Bearer YOUR_AGENT_TOKEN"Where to get your token:Dashboard → Tokens → Service Identities → Create new token. Choose the minimum scope your use case requires. The examples below omit the header for brevity — it is always required.
Toknbase exposes two integration surfaces: a REST HTTP API for CI/CD pipelines and shell scripts, and 14 MCP tools for AI editor integrations. Base URL:https://4wj64-piaaa-aaaan-q5q7q-cai.raw.icp0.io
REST Endpoints
/api/secretGet a single secret by name. Returns the plaintext value.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | required | The secret name to retrieve |
Request
curl -s -X GET \ -H"Authorization: Bearer $TOKNBASE_AGENT_TOKEN" \ "https://4wj64-piaaa-aaaan-q5q7q-cai.raw.icp0.io/api/secret"
Response
{
"name": "DATABASE_URL",
"value": "postgres://user:pass@host/db",
"environment": "production"
}Response Schema
| Field | Type | Description |
|---|---|---|
name | string | The secret name |
value | string | The plaintext secret value (decrypted) |
environment | string | Environment tag (production, staging, etc.) |
/api/secretsList all secret names accessible by this token. Values are not returned.
Request
curl -s -X GET \ -H"Authorization: Bearer $TOKNBASE_AGENT_TOKEN" \ "https://4wj64-piaaa-aaaan-q5q7q-cai.raw.icp0.io/api/secrets"
Response
{
"secrets": [
"DATABASE_URL",
"STRIPE_KEY",
"OPENAI_API_KEY"
]
}Response Schema
| Field | Type | Description |
|---|---|---|
secrets | string[] | Array of accessible secret names (no values) |
/api/secretsCreate a new secret.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | required | Secret name (alphanumeric, underscores, hyphens) |
value | string | required | The secret value to store |
environment | string | optional | Environment tag (production, staging, development) |
Request
curl -s -X POST \
-H"Authorization: Bearer $TOKNBASE_AGENT_TOKEN" \
-H"Content-Type: application/json" \
-d '{"name":"MY_SECRET","value":"..."}' \
"https://4wj64-piaaa-aaaan-q5q7q-cai.raw.icp0.io/api/secrets"Response
{
"ok": true,
"id": "sec_abc123"
}Response Schema
| Field | Type | Description |
|---|---|---|
ok | boolean | true if the secret was created successfully |
id | string | The internal ID of the new secret |
/api/secrets/:nameUpdate an existing secret value.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | required | Secret name in the URL path (e.g. DATABASE_URL) |
value | string | required | New secret value to replace the existing one |
Request
curl -s -X PUT \
-H"Authorization: Bearer $TOKNBASE_AGENT_TOKEN" \
-H"Content-Type: application/json" \
-d '{"name":"MY_SECRET","value":"..."}' \
"https://4wj64-piaaa-aaaan-q5q7q-cai.raw.icp0.io/api/secrets/:name"Response
{
"ok": true
}Response Schema
| Field | Type | Description |
|---|---|---|
ok | boolean | true if the update was applied successfully |
/api/secrets/:nameDelete a secret permanently.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | required | Secret name in the URL path (e.g. DATABASE_URL) |
Request
curl -s -X DELETE \ -H"Authorization: Bearer $TOKNBASE_AGENT_TOKEN" \ "https://4wj64-piaaa-aaaan-q5q7q-cai.raw.icp0.io/api/secrets/:name"
Response
{
"ok": true
}Response Schema
| Field | Type | Description |
|---|---|---|
ok | boolean | true if the secret was deleted. Returns 404 if not found. |
Warning
MCP Tools
The@toknbase/mcp-serverexposes 15 tools over the Model Context Protocol. Connect it to Cursor, Claude Code, Windsurf, VS Code, or Cline.
| Tool | Description |
|---|---|
| toknbase_list_secrets | Lists all secret names accessible to the token |
| toknbase_get_secret | Gets a secret by name, returning its plaintext value (for MCP-enabled secrets) |
| toknbase_create_secret | Creates a new secret |
| toknbase_update_secret | Updates an existing secret |
| toknbase_delete_secret | Deletes a secret |
| toknbase_search_secrets | Searches secrets by name pattern |
| toknbase_batch_create_secrets | Creates multiple secrets in one call |
| toknbase_get_audit_log | Retrieves the audit log |
| toknbase_list_team_secrets | Lists secrets shared with a team |
| toknbase_rotate_secret | Rotates a secret value |
| toknbase_create_folder | Creates a folder for organizing secrets |
| toknbase_list_folders | Lists all folders |
| toknbase_assign_folder | Assigns a secret to a folder |
| toknbase_get_token_info | Gets info about the current agent token |
Important
Token Scopes
Every agent token is created with a scope that determines what operations it can perform.
| Scope | Allows | Recommended for |
|---|---|---|
read_only | List and search secrets, read metadata | AI editors that only need to reference secrets |
read_write | Create, update, delete secrets | CI/CD pipelines, automation |
full_access | All operations including rotation and folder management | Trusted automation systems |
Audit Chain Verification
Publicly verify any audit export against the live canister state — no account required.
/api/verifypublic · no auth requiredVerify a chain tip hash against the canister's certified state. Returns whether the hash matches the current audit chain root committed to ICP certified variables.
Query Parameters
| Parameter | Required | Description |
|---|---|---|
hash | required | ThechainTipHashvalue from a Toknbase compliance export |
Request
curl"https://4wj64-piaaa-aaaan-q5q7q-cai.raw.icp0.io/api/verify?hash=abc123def456"
Response — verified
{
"verified": true,
"canisterId": "4wj64-piaaa-aaaan-q5q7q-cai",
"timestamp": 1712000000000000000,
"entriesCount": 1247
}Response — not verified
{
"verified": false,
"canisterId": "4wj64-piaaa-aaaan-q5q7q-cai",
"timestamp": 1712000000000000000,
"entriesCount": 1247
}Note
Important