Skip to main content
Toknbase
REFERENCE

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.

Authentication 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

GET/api/secret

Get a single secret by name. Returns the plaintext value.

Parameters

NameTypeRequiredDescription
namestringrequiredThe 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

FieldTypeDescription
namestringThe secret name
valuestringThe plaintext secret value (decrypted)
environmentstringEnvironment tag (production, staging, etc.)
GET/api/secrets

List 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

FieldTypeDescription
secretsstring[]Array of accessible secret names (no values)
POST/api/secrets

Create a new secret.

Parameters

NameTypeRequiredDescription
namestringrequiredSecret name (alphanumeric, underscores, hyphens)
valuestringrequiredThe secret value to store
environmentstringoptionalEnvironment 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

FieldTypeDescription
okbooleantrue if the secret was created successfully
idstringThe internal ID of the new secret
PUT/api/secrets/:name

Update an existing secret value.

Parameters

NameTypeRequiredDescription
namestringrequiredSecret name in the URL path (e.g. DATABASE_URL)
valuestringrequiredNew 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

FieldTypeDescription
okbooleantrue if the update was applied successfully
DELETE/api/secrets/:name

Delete a secret permanently.

Parameters

NameTypeRequiredDescription
namestringrequiredSecret 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

FieldTypeDescription
okbooleantrue if the secret was deleted. Returns 404 if not found.

Warning

Secret values are returned in plaintext via the REST API. Always use HTTPS and treat agent tokens as secrets themselves. Rotate tokens regularly.

MCP Tools

The@toknbase/mcp-serverexposes 15 tools over the Model Context Protocol. Connect it to Cursor, Claude Code, Windsurf, VS Code, or Cline.

ToolDescription
toknbase_list_secretsLists all secret names accessible to the token
toknbase_get_secretGets a secret by name, returning its plaintext value (for MCP-enabled secrets)
toknbase_create_secretCreates a new secret
toknbase_update_secretUpdates an existing secret
toknbase_delete_secretDeletes a secret
toknbase_search_secretsSearches secrets by name pattern
toknbase_batch_create_secretsCreates multiple secrets in one call
toknbase_get_audit_logRetrieves the audit log
toknbase_list_team_secretsLists secrets shared with a team
toknbase_rotate_secretRotates a secret value
toknbase_create_folderCreates a folder for organizing secrets
toknbase_list_foldersLists all folders
toknbase_assign_folderAssigns a secret to a folder
toknbase_get_token_infoGets info about the current agent token

Important

MCP-enabled secrets are decrypted by the MCP server using the agent token as the key. The AI agent receives the plaintext value for any secret the user has explicitly enabled for agent access. Zero-knowledge refers to Toknbase servers — not the agent. Only enable MCP access for secrets your AI tools actually need.

Token Scopes

Every agent token is created with a scope that determines what operations it can perform.

ScopeAllowsRecommended for
read_onlyList and search secrets, read metadataAI editors that only need to reference secrets
read_writeCreate, update, delete secretsCI/CD pipelines, automation
full_accessAll operations including rotation and folder managementTrusted automation systems

Audit Chain Verification

Publicly verify any audit export against the live canister state — no account required.

GET/api/verifypublic · no auth required

Verify 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

ParameterRequiredDescription
hashrequiredThechainTipHashvalue 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

You can also verify using the browser-based verifier attoknbase.net/verify— paste any exported chain tip hash and get an instant result, no account needed.

Important

This endpoint is backed by ICP certified variables — the canister's chain tip hash is committed to the ICP subnet's certified state on every audit event. The response is cryptographically verifiable against the ICP network public key.

What's next

Was this page helpful?