SandBase Secrets API
Write-only Bearer tokens for MCP connections
Write-only Bearer tokens for MCP connections
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/sandbase-ai:sandbase-ai-secrets-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: SandBase Secrets API
description: 'SandBase is an agent-native platform for connecting Agents to the real world.
Use one account and one key to call Models, ready-made APIs, and Agents.
## Authentication
Public API requests require a SandBase API key. Use `Authorization: Bearer sk-YOUR_KEY` by default.
Anthropic Messages and Google Gemini-compatible operations also document their native SDK-compatible key locations.
## SDK Compatibility
- **LLM Gateway** (`/v1/chat/completions`): Use OpenAI SDK with `base_url="https://api.sandbase.ai/v1"`
- **Embeddings** (`/v1/embeddings`): Use OpenAI SDK with `base_url="https://api.sandbase.ai/v1"`
- **Images** (`/v1/images/generations`, `/v1/images/edits`): Use OpenAI SDK with `base_url="https://api.sandbase.ai/v1"`
- **Anthropic Messages** (`/v1/messages`): Use Anthropic SDK with `base_url="https://api.sandbase.ai"`
- **Google Gemini GenerateContent** (`/v1beta/models/{model}:generateContent`): Configure the Google Gen AI SDK to use `https://api.sandbase.ai`
- **Agents and Sessions** (`/v1/agents`, `/v1/agents/sessions`): Follow the OpenAI Agents protocol (`OpenAI-Beta: agents=v1` is optional) plus the documented SandBase extensions
- **Agents platform resources** (`/v1/agents*`, `/v1/mcp-connections*`, `/v1/secrets*`, `/v1/skills*`): Accept `Authorization: Bearer` or `X-API-Key` and return the `AgentsError` envelope'
version: 1.0.0
x-sandbase-session-contract:
status: active
feature: Agents platform Sessions
description: A Session (ses_*) runs one saved Agent version in a SandBase-hosted environment. Sessions are created directly with POST /v1/agents/sessions. Internal runtime identities are never exposed.
contact:
name: SandBase
url: https://www.sandbase.ai
license:
name: Proprietary
servers:
- url: https://api.sandbase.ai
description: Production
security:
- BearerAuth: []
tags:
- name: Secrets
description: Write-only Bearer tokens for MCP connections
paths:
/v1/secrets:
post:
operationId: createSecret
tags:
- Secrets
summary: Create secret
description: Store a write-only Bearer token for one MCP server URL. Idempotency-Key is required. The token is never returned.
security:
- BearerAuth: []
- AgentsApiKey: []
parameters:
- $ref: '#/components/parameters/IdempotencyKeyRequired'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SecretCreateRequest'
responses:
'201':
description: Secret created
content:
application/json:
schema:
$ref: '#/components/schemas/Secret'
'400':
description: invalid_request (malformed JSON, unknown fields, failed validation, or an unsupported option)
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'401':
description: 'unauthorized: missing, malformed, or conflicting API key headers'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'402':
description: 'spending_limit_exceeded: API key spending limit or organization balance exhausted'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'403':
description: insufficient_scope (scoped key) or org_disabled
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'409':
description: 'conflict: stale row_version, lifecycle state, or Idempotency-Key reused with a different body'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'503':
description: authorization_unavailable, admission_unavailable, executor_unavailable, storage_unavailable, or internal_error
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
get:
operationId: listSecrets
tags:
- Secrets
summary: List secrets
description: List Secret metadata with offset pagination.
security:
- BearerAuth: []
- AgentsApiKey: []
parameters:
- $ref: '#/components/parameters/OffsetLimit'
- $ref: '#/components/parameters/Offset'
responses:
'200':
description: Secret page
content:
application/json:
schema:
$ref: '#/components/schemas/SecretList'
'401':
description: 'unauthorized: missing, malformed, or conflicting API key headers'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'402':
description: 'spending_limit_exceeded: API key spending limit or organization balance exhausted'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'403':
description: insufficient_scope (scoped key) or org_disabled
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'503':
description: authorization_unavailable, admission_unavailable, executor_unavailable, storage_unavailable, or internal_error
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
/v1/secrets/{secret_id}:
parameters:
- $ref: '#/components/parameters/SecretIdPath'
get:
operationId: getSecret
tags:
- Secrets
summary: Get secret
description: Read Secret metadata. The token is never returned.
security:
- BearerAuth: []
- AgentsApiKey: []
responses:
'200':
description: Secret
content:
application/json:
schema:
$ref: '#/components/schemas/Secret'
'401':
description: 'unauthorized: missing, malformed, or conflicting API key headers'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'402':
description: 'spending_limit_exceeded: API key spending limit or organization balance exhausted'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'403':
description: insufficient_scope (scoped key) or org_disabled
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'404':
description: 'not_found: the resource does not exist in this organization'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'503':
description: authorization_unavailable, admission_unavailable, executor_unavailable, storage_unavailable, or internal_error
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
delete:
operationId: deleteSecret
tags:
- Secrets
summary: Revoke secret
description: Revoke the Secret. Idempotency-Key is required. Connections that use it stop working for new Sessions and further input.
security:
- BearerAuth: []
- AgentsApiKey: []
parameters:
- $ref: '#/components/parameters/IdempotencyKeyRequired'
responses:
'204':
description: Secret revoked
'400':
description: invalid_request (malformed JSON, unknown fields, failed validation, or an unsupported option)
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'401':
description: 'unauthorized: missing, malformed, or conflicting API key headers'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'402':
description: 'spending_limit_exceeded: API key spending limit or organization balance exhausted'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'403':
description: insufficient_scope (scoped key) or org_disabled
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'404':
description: 'not_found: the resource does not exist in this organization'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'503':
description: authorization_unavailable, admission_unavailable, executor_unavailable, storage_unavailable, or internal_error
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
/v1/secrets/{secret_id}/rotate:
parameters:
- $ref: '#/components/parameters/SecretIdPath'
post:
operationId: rotateSecret
tags:
- Secrets
summary: Rotate secret
description: Replace the token for the same server_url with compare-and-set on row_version. Idempotency-Key is required. Only new Sessions use the new token.
security:
- BearerAuth: []
- AgentsApiKey: []
parameters:
- $ref: '#/components/parameters/IdempotencyKeyRequired'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SecretRotateRequest'
responses:
'201':
description: Secret
content:
application/json:
schema:
$ref: '#/components/schemas/Secret'
'400':
description: invalid_request (malformed JSON, unknown fields, failed validation, or an unsupported option)
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'401':
description: 'unauthorized: missing, malformed, or conflicting API key headers'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'402':
description: 'spending_limit_exceeded: API key spending limit or organization balance exhausted'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'403':
description: insufficient_scope (scoped key) or org_disabled
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'404':
description: 'not_found: the resource does not exist in this organization'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'409':
description: 'conflict: stale row_version, lifecycle state, or Idempotency-Key reused with a different body'
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
'503':
description: authorization_unavailable, admission_unavailable, executor_unavailable, storage_unavailable, or internal_error
content:
application/json:
schema:
$ref: '#/components/schemas/AgentsError'
components:
schemas:
SecretCreateRequest:
type: object
additionalProperties: false
required:
- name
- kind
- server_url
- token
properties:
name:
type: string
minLength: 1
maxLength: 128
kind:
type: string
const: mcp_bearer
server_url:
type: string
format: uri
maxLength: 2048
description: HTTPS MCP server URL without credentials, query, or fragment. The Secret only works for this exact URL.
token:
type: string
minLength: 1
maxLength: 16384
writeOnly: true
Secret:
type: object
required:
- id
- name
- kind
- server_url
- status
- row_version
- created_at
- updated_at
properties:
id:
type: string
description: Secret ID (`sec_` prefix).
name:
type: string
kind:
type: string
const: mcp_bearer
server_url:
type: string
status:
type: string
enum:
- pending
- active
- disabled
description: disabled means revoked.
row_version:
type: integer
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
SecretRotateRequest:
type: object
additionalProperties: false
required:
- token
- row_version
properties:
token:
type: string
minLength: 1
maxLength: 16384
writeOnly: true
row_version:
type: integer
minimum: 1
AgentsError:
type: object
description: Error envelope for Agents platform resources. message is a fixed, safe sentence for each code.
required:
- error
properties:
error:
type: object
required:
- type
- code
- param
- message
properties:
type:
type: string
enum:
- invalid_request_error
- authentication_error
- server_error
code:
type: string
description: Stable machine-readable code. Unknown future codes should be treated by HTTP status.
enum:
- unauthorized
- insufficient_scope
- authorization_unavailable
- org_disabled
- spending_limit_exceeded
- quota_exceeded
- concurrency_limit
- admission_unavailable
- invalid_request
- not_found
- conflict
- session_input_pending
- session_input_expired
- session_environment_unavailable
- tenant_provisioning_failed
- tenant_unavailable
- executor_rejected
- executor_unavailable
- executor_contract_error
- skill_not_found
- skill_unavailable
- skill_runtime_incompatible
- storage_unavailable
- internal_error
- request_too_large
param:
type: 'null'
message:
type: string
SecretList:
allOf:
- $ref: '#/components/schemas/AgentsOffsetList'
- type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Secret'
AgentsOffsetList:
type: object
required:
- data
- total
- limit
- offset
properties:
data:
type: array
items:
type: object
additionalProperties: true
total:
type: integer
limit:
type: integer
offset:
type: integer
parameters:
Offset:
name: offset
in: query
required: false
schema:
type: integer
minimum: 0
default: 0
description: Number of records to skip.
IdempotencyKeyRequired:
name: Idempotency-Key
in: header
required: true
schema:
type: string
minLength: 1
maxLength: 128
description: Required. 1-128 characters without leading or trailing whitespace. Reuse the same key and body when retrying.
OffsetLimit:
name: limit
in: query
required: false
schema:
type: integer
minimum: 1
default: 20
description: Page size. Defaults to 20; non-numeric or non-positive values fall back to 20. Attachment lists return 400 above 100; other offset lists cap the value at 200.
SecretIdPath:
name: secret_id
in: path
required: true
schema:
type: string
description: Secret ID (`sec_` prefix).
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: SandBase API key. Treat the complete credential as an opaque secret.
AnthropicApiKey:
type: apiKey
in: header
name: x-api-key
description: Supported only by `POST /v1/messages` for Anthropic SDK compatibility
GoogleApiKey:
type: apiKey
in: header
name: x-goog-api-key
description: Supported by Google Gemini-compatible endpoints. Takes precedence over the other key locations.
GoogleQueryApiKey:
type: apiKey
in: query
name: key
description: Google SDK compatibility fallback. Prefer x-goog-api-key or Authorization because URLs can be logged.
WebhookApiKey:
type: apiKey
in: header
name: X-API-Key
description: Accepted by the webhook Events API (/events/webhooks*). Authorization Bearer takes precedence when both are sent.
AgentsApiKey:
type: apiKey
in: header
name: X-API-Key
description: Accepted only by Agents platform resources (/v1/agents*, /v1/mcp-connections*, /v1/secrets*, /v1/skills*). If Authorization is also sent, both must carry the same key.