SandBase Account API
Organization balance and API execution history
Organization balance and API execution history
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-account-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 Account 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: Account
description: Organization balance and API execution history
paths:
/v1/account/balance:
get:
operationId: getAccountBalance
tags:
- Account
summary: Get account balance
description: Returns the balance and optional credit settings for the organization that owns the API key.
responses:
'200':
description: Organization balance
content:
application/json:
schema:
$ref: '#/components/schemas/AccountBalance'
'401':
description: The API key did not resolve an organization
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCostError'
'402':
description: API key spending limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCostError'
'403':
description: API key scope does not authorize this endpoint
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyScopeError'
'404':
description: Organization not found
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCostError'
/v1/account/history:
get:
operationId: listAccountHistory
tags:
- Account
summary: List execution history
description: Lists recent execution records for the API key's organization, newest first. Input and output snapshots are included only when stored JSON can be decoded. Error messages are sanitized before they are returned.
parameters:
- name: model
in: query
schema:
type: string
description: Exact logical model name.
- name: api_key_id
in: query
schema:
type: string
description: Exact API Key resource ID within the organization.
- name: type
in: query
schema:
type: string
description: Execution category. Supported filters are multimodal (image, video, and audio), llm, and api; any other value applies no type filter.
- name: status
in: query
schema:
type: string
enum:
- completed
- failure
- in_progress
description: Status group. failure includes failed and timeout; in_progress includes pending and running.
- name: error_type
in: query
schema:
type: string
maxLength: 50
description: Exact error type. Use unknown for records without an error type.
- name: range
in: query
schema:
type: string
default: 7d
description: Rolling created-at range when an explicit analytics window is not used. Supported values are 1h, 24h, 7d, and 30d; every other value falls back to 7d.
- name: page
in: query
schema:
type: integer
minimum: 1
default: 1
- name: page_size
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 20
- name: request_id
in: query
schema:
type: string
maxLength: 64
description: Exact organization-scoped execution ID lookup. When set, other filters are ignored and the response is forced to page 1 with page_size 1.
- name: time_basis
in: query
schema:
type: string
enum:
- created_at
- settled_at
default: created_at
description: Timestamp basis for an explicit start_at/end_at window.
- name: billing_scope
in: query
schema:
type: string
enum:
- any
- positive
- token
default: any
description: Settlement filter. positive and token are valid only with time_basis=settled_at.
- name: start_at
in: query
schema:
type: string
format: date-time
description: Inclusive RFC 3339 window start. Must be paired with end_at; the window cannot exceed 32 days.
- name: end_at
in: query
schema:
type: string
format: date-time
description: Exclusive RFC 3339 window end. Must be paired with start_at.
- name: latency_sample
in: query
schema:
type: string
enum:
- positive
- terminal_positive
description: Restrict latency samples to positive values, optionally only for terminal executions.
- name: min_latency_ms
in: query
schema:
type: integer
minimum: 0
description: Minimum recorded latency in milliseconds.
- name: timezone
in: query
schema:
type: string
maxLength: 64
description: Compatibility parameter. Without request_id, a valid IANA time-zone name is required when supplied, but raw response timestamps remain unchanged. Exact request_id mode ignores it.
responses:
'200':
description: Paginated execution history
content:
application/json:
schema:
$ref: '#/components/schemas/AccountHistoryPage'
'400':
description: Invalid filter or analytics window
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCostError'
'401':
description: The API key did not resolve an organization
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCostError'
'402':
description: API key spending limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCostError'
'403':
description: API key scope does not authorize this endpoint
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyScopeError'
'500':
description: History lookup failed
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCostError'
components:
schemas:
APIKeyScopeError:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- message
- request_id
properties:
code:
type: string
const: insufficient_scope
message:
type: string
request_id:
type: string
AccountHistoryItem:
type: object
required:
- id
- model
- type
- execution_mode
- status
- latency_ms
- user_cost
- prompt_tokens
- completion_tokens
- total_tokens
- cached_tokens
- cache_creation_tokens
- created_at
- api_key_prefix
properties:
id:
type: string
description: Opaque execution ID.
model:
type: string
type:
type: string
execution_mode:
type: string
status:
type: string
enum:
- pending
- running
- completed
- failed
- timeout
latency_ms:
type: integer
minimum: 0
user_cost:
type: string
description: USD cost serialized as an exact decimal string.
prompt_tokens:
type: integer
minimum: 0
completion_tokens:
type: integer
minimum: 0
total_tokens:
type: integer
minimum: 0
cached_tokens:
type: integer
minimum: 0
cache_creation_tokens:
type: integer
minimum: 0
created_at:
type: string
format: date-time
api_key_prefix:
type: string
error_message:
type: string
description: Sanitized failure message when recorded.
error_type:
type: string
completed_at:
type: string
format: date-time
period_settled_cost:
type: string
pattern: ^-?\d+\.\d{6}$
description: Settlement cost attributed to the selected settlement window when available.
input_params:
description: Parsed stored request parameters; omitted when absent or invalid JSON.
output_result:
description: Parsed stored output; numbers retain their JSON precision. Omitted when absent or invalid JSON.
AccountHistoryPage:
type: object
required:
- items
- total
- page
- page_size
properties:
items:
type: array
items:
$ref: '#/components/schemas/AccountHistoryItem'
total:
type: integer
minimum: 0
page:
type: integer
minimum: 1
page_size:
type: integer
minimum: 1
maximum: 100
TaskCostError:
type: object
required:
- error
properties:
error:
type: string
AccountBalance:
type: object
required:
- org_id
- balance
- credit_limit
- alert_threshold
properties:
org_id:
type: string
format: uuid
balance:
type: string
description: Current organization balance in USD, serialized as an exact decimal string.
credit_limit:
oneOf:
- type: string
- type: 'null'
description: Optional USD credit limit. Null means no credit limit.
alert_threshold:
oneOf:
- type: string
- type: 'null'
description: Optional USD balance alert threshold.
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.