Lockally AI API
Metered LLM features (thread classification; BYOK or prepaid AI units)
Metered LLM features (thread classification; BYOK or prepaid AI units)
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/lockally-com:lockally-com-ai-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: lockally control plane AI API
version: 0.1.0
summary: REST API for managing tenants, domains, mailboxes, and outbound mail
description: 'The lockally control plane lets integrators and direct customers manage
everything except actual mail data flow (which uses standard JMAP / IMAP /
SMTP-submission against the data plane endpoints).
**Authentication.** All `/v1/*` endpoints require a Bearer API key in the
`Authorization` header. Keys are formatted `lk_live__`,
or `lk_test_` for a test key. Create keys in the dashboard, or with
`POST /v1/api-keys` using a key that holds `tenant:admin`.
The key''s plan is checked on every request, so a key stops working if the
account moves to a plan without API access, and works again if it moves back.
**Errors.** Failures return RFC 9457
`application/problem+json` documents.
**Scopes.** Each endpoint requires a specific scope on the presented key.
Insufficient scope returns `403` with the required scope name in `detail`.'
contact:
name: lockally support
email: support@lockally.com
license:
name: AGPL-3.0-only OR LicenseRef-LOC-Commercial
identifier: AGPL-3.0-only
servers:
- url: https://api.lockally.com
description: Production
- url: http://127.0.0.1:8081
description: Local development / spike
security:
- bearerAuth: []
tags:
- name: AI
description: Metered LLM features (thread classification; BYOK or prepaid AI units)
paths:
/v1/threads/{threadID}/classify:
post:
operationId: classifyThread
tags:
- AI
summary: LLM-classify a thread
description: 'Returns {intent, urgency, summary, suggested_action} via the tenant''s AI tier (BYOK or prepaid units, see /v1/ai-config). Cached per thread state: unchanged threads return the cache free; ?refresh=true forces a re-run. A failed model call charges nothing. 402 when the AI tier is off.'
x-required-scope: inboxes:read
parameters:
- name: threadID
in: path
required: true
schema:
type: string
format: uuid
- name: refresh
in: query
schema:
type: boolean
responses:
'200':
description: Classification
content:
application/json:
schema:
$ref: '#/components/schemas/ThreadClassification'
'402':
description: AI tier not enabled / out of units
/v1/ai-config:
get:
operationId: getAiConfig
tags:
- AI
summary: Read the tenant's AI configuration
description: Mode (off/byok/units), model, masked key hint, AI-unit balance, whether the units tier is available on this deployment.
x-required-scope: tenant:read
responses:
'200':
description: AI config
content:
application/json:
schema:
$ref: '#/components/schemas/AiConfig'
put:
operationId: updateAiConfig
tags:
- AI
summary: Configure the AI tier
description: 'Body: {"mode": "off|byok|units", "model": "...", "anthropic_key": "sk-ant-..."}. BYOK keys are stored AES-256-GCM encrypted; the cleartext is never returned. Omit anthropic_key to keep the stored one.'
x-required-scope: tenant:admin
responses:
'200':
description: Applied
content:
application/json:
schema:
$ref: '#/components/schemas/AiConfigUpdate'
/v1/billing/ai-units/checkout:
post:
operationId: createAiUnitsCheckout
tags:
- AI
summary: Buy prepaid AI units
description: 'Body: {"bundle": "100|500|2000"}. One classification = one unit; bundles expire after 6 months. Admin session required. 503 until Paystack billing is configured.'
x-required-scope: tenant:admin
responses:
'200':
description: Paystack authorization URL for the selected AI unit bundle.
content:
application/json:
schema:
type: object
required:
- authorization_url
- reference
properties:
authorization_url:
type: string
format: uri
reference:
type: string
units:
type: integer
components:
schemas:
AiConfigUpdate:
type: object
required:
- mode
- model
properties:
mode:
type: string
enum:
- 'off'
- byok
- units
model:
type: string
ThreadClassification:
type: object
required:
- thread_id
properties:
thread_id:
type: string
format: uuid
cached:
type: boolean
description: True when a previous classification was reused.
billed:
type: boolean
description: True when this call consumed an AI unit.
classification:
$ref: '#/components/schemas/Classification'
Classification:
type: object
properties:
intent:
type: string
description: For example support_request, sales_lead, billing, spam.
urgency:
type: string
enum:
- low
- normal
- high
summary:
type: string
description: One line.
suggested_action:
type: string
description: One line.
AiConfig:
type: object
required:
- mode
- model
properties:
mode:
type: string
enum:
- 'off'
- byok
- units
model:
type: string
byok_key_hint:
type: string
units_balance:
type: integer
units_available:
type: boolean
description: True when a platform model key is configured.
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: lk_live_<prefix>_<secret>
description: API key, format `lk_live_<8-char-prefix>_<32-char-secret>`.
oauth2:
type: oauth2
description: 'OAuth 2.1 (authorization code + PKCE). The access token is sent as the
`Authorization: Bearer` credential, exactly like an API key, so any SDK
that accepts a bearer token works with OAuth. Discovery:
`/.well-known/oauth-authorization-server`.
'
flows:
authorizationCode:
authorizationUrl: https://api.lockally.com/oauth/authorize
tokenUrl: https://api.lockally.com/oauth/token
scopes:
inboxes:read: Read agent-accessible mailboxes and threads
inboxes:write: Send and act on agent-accessible mailboxes