Every API here is available over the APIs.io API and to AI agents over MCP.
MCP server
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
Tools for apis
7 MCP tools reach this
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.
All 92 tools →
Call it yourself
curl for this page
This API
curl "https://apis.io/api/v1/apis/paywithlocus-com:paywithlocus-com-end-users-api"
All apis
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.
Get an API 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: Locus Pro End users API
description: Production is live at https://api.paywithlocus.com/api. Stage remains available for evaluation and integration testing at https://api.stage.paywithlocus.com/api; credentials, balances, and tenant data are isolated by environment. Embedded prepaid credits over the Locus pay-per-use catalog. Money and top-up amounts use exact decimal strings (up to 6dp). Every burn requires an Idempotency-Key header. Management routes accept a tenant secret key or authorized dashboard session as shown per operation. High-risk operations protected by workspace-administrator step-up require an owner or admin dashboard session, the applicable scope, and MFA/passkey authentication completed in the last ten minutes; developer, billing, viewer, and secret-key principals remain ineligible even when a matching scope is present. Scoped secret keys retain only the explicitly documented Agent Connection lifecycle exception. Widget routes accept an end-user JWT alone; when a publishable key is present it must belong to the JWT's tenant. MCP uses OAuth 2.1 Authorization Code with PKCE by default and also accepts the explicitly documented tenant secret key, end-user JWT, or scoped agent connection compatibility credentials. Burns accept the execution credentials shown per operation. Publishable keys never authorize management or burns by themselves.
version: 0.7.0
servers:
- url: https://api.paywithlocus.com/api
description: Production
- url: https://api.stage.paywithlocus.com/api
description: Stage — evaluation and integration testing
security:
- secretKey: []
tags:
- name: End users
description: End-user accounts, tokens, and allocations
paths:
/credits/.well-known/end-user-jwks.json:
get:
tags:
- End users
summary: Public JWKS for end-user tokens
operationId: getCreditsWellKnownEndUserJwksJson
description: RS256 public keys for verifying end-user tokens yourself, keyed by the token's kid claim. Public and cacheable for 5 minutes. Revoked signing keys are never published, so a token signed by a retired key fails verification here exactly as it does server-side.
security: []
responses:
'200':
description: JWK Set
headers:
Cache-Control:
schema:
const: public, max-age=300, must-revalidate
content:
application/json:
schema:
type: object
required:
- keys
properties:
keys:
type: array
items:
type: object
required:
- kty
- n
- e
- alg
- use
- kid
properties:
kty:
const: RSA
n:
type: string
e:
type: string
alg:
const: RS256
use:
const: sig
kid:
type: string
/credits/end-users/{externalUserId}/tokens:
get:
tags:
- End users
summary: List an end user's minted tokens
operationId: getCreditsEndUsersByExternalUserIdTokens
description: Token metadata for one end user, newest first, capped at 200 records. Use it to audit what is outstanding and to find the tokenId to revoke. The tokens themselves are returned only at mint time and are never recoverable.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
responses:
'200':
description: Token metadata
content:
application/json:
schema:
type: object
required:
- success
- tokens
properties:
success:
const: true
tokens:
type: array
items:
$ref: '#/components/schemas/EndUserTokenRecord'
additionalProperties: false
'403':
$ref: '#/components/responses/InsufficientScope'
/credits/end-users/{externalUserId}/tokens/{tokenId}:
delete:
tags:
- End users
summary: Revoke an end-user token
operationId: deleteCreditsEndUsersByExternalUserIdTokensByTokenId
description: Revokes one outstanding end-user token by its durable jti. Revocation takes effect immediately on the next use, which is the only way to cut a leaked token short — bearer tokens are otherwise replayable until they expire.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
- name: tokenId
in: path
required: true
schema:
type: string
description: Token record id from GET /credits/end-users/{externalUserId}/tokens.
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
reason:
type: string
description: Recorded on the credential audit event.
additionalProperties: false
responses:
'204':
description: Revoked.
'403':
$ref: '#/components/responses/InsufficientScope'
'404':
description: No such token for this end user.
/credits/end-users:
get:
tags:
- End users
summary: List end-users with balances
operationId: getCreditsEndUsers
description: Lists the workspace's end-user accounts with their balances, with cursor pagination. q filters by a case-insensitive substring of externalUserId.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: q
in: query
schema:
type: string
maxLength: 120
description: Case-insensitive substring match on externalUserId.
- name: cursor
in: query
schema:
type: string
- name: limit
in: query
schema:
type: integer
maximum: 200
default: 50
responses:
'200':
description: End-user accounts
content:
application/json:
schema:
type: object
required:
- success
- endUsers
- nextCursor
properties:
success:
const: true
endUsers:
type: array
items:
$ref: '#/components/schemas/EndUserAccount'
nextCursor:
type:
- string
- 'null'
/credits/end-users/{externalUserId}:
delete:
tags:
- End users
summary: Retire a test or integration end user without deleting financial history
operationId: deleteCreditsEndUsersByExternalUserId
description: Workspace owner or admin with fresh MFA/passkey step-up only. Fails closed unless the balance is zero and every reservation, top-up attempt, external purchase, and refund is terminal. Revokes end-user tokens and scoped agent credentials, cancels outstanding approvals, resets the operational policy, freezes the credit account, and marks the identity inactive. Ledger, funding, settlement, replay, and audit rows are retained. Repeating a completed retirement is safe.
security:
- dashboardSession: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
- $ref: '#/components/parameters/WorkspaceStepUpHeader'
responses:
'200':
description: Retirement converged
content:
application/json:
schema:
type: object
required:
- success
- externalUserId
- retired
- alreadyRetired
- accountId
- revokedTokens
- revokedAgentConnections
- canceledApprovals
- policyReset
properties:
success:
const: true
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
retired:
type: boolean
alreadyRetired:
type: boolean
accountId:
type:
- string
- 'null'
format: uuid
revokedTokens:
type: integer
minimum: 0
revokedAgentConnections:
type: integer
minimum: 0
canceledApprovals:
type: integer
minimum: 0
policyReset:
type: boolean
'401':
description: Authentication required
'403':
description: Workspace owner/admin role and fresh MFA/passkey step-up required
'409':
description: Balance or asynchronous money work is still open
/credits/end-users/{externalUserId}/token:
post:
tags:
- End users
summary: Mint an end-user token
operationId: postCreditsEndUsersByExternalUserIdToken
description: Mint server-side only. Creates the tenant-scoped end-user record and credit account on first use. JWT claims are sub, tid, iss=locus-credits, aud=locus-credits-enduser, iat, exp, jti, and optional sid. The sid claim is a SHA-256 fingerprint, not the raw session value. Verification allows 30 seconds of clock skew. There is no refresh token; re-authenticate the user and mint a replacement. A sid-bound token requires the original value in X-Locus-Session-Id whenever used.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/EndUserTokenRequest'
responses:
'200':
description: Token
content:
application/json:
schema:
$ref: '#/components/schemas/EndUserTokenResponse'
'400':
description: Invalid externalUserId, expiresIn, sessionId, or unknown field
/credits/end-users/{externalUserId}/policy:
get:
tags:
- End users
summary: Read an immutable end user's execution policy
operationId: getCreditsEndUsersByExternalUserIdPolicy
description: Returns the end user's current execution policy, or null when no policy is set. Policies are immutable; a change creates a new policy.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
responses:
'200':
description: Current policy or null
content:
application/json:
schema:
$ref: '#/components/schemas/EndUserPolicyEnvelope'
put:
tags:
- End users
summary: Create or replace an end user's execution policy
operationId: putCreditsEndUsersByExternalUserIdPolicy
description: Workspace owner/admin session or a secret key with tokens:manage. Admission, counters, the credit hold, and the reservation commit atomically. Amounts use the tenant's exact credit denomination.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EndUserPolicyInput'
responses:
'200':
description: Policy applied
content:
application/json:
schema:
$ref: '#/components/schemas/EndUserPolicyEnvelope'
'400':
description: Unknown field or invalid exact-credit/count contract
delete:
tags:
- End users
summary: Reset an end user's execution policy to no policy
operationId: deleteCreditsEndUsersByExternalUserIdPolicy
description: Workspace owner/admin session or a secret key with tokens:manage. Deletes operational policy counters only after all live reservations have captured or released. The append-only policy decision journal remains queryable by account. Repeating a completed reset is safe and returns reset=false.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
responses:
'200':
description: Policy is null
content:
application/json:
schema:
type: object
required:
- success
- externalUserId
- policy
- reset
- priorPolicyId
properties:
success:
const: true
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
policy:
type: 'null'
reset:
type: boolean
priorPolicyId:
type:
- string
- 'null'
format: uuid
'409':
description: An active reservation must capture or release before reset
/credits/end-users/{externalUserId}/policy/events:
get:
tags:
- End users
summary: List policy allow, deny, capture, release, and reset decisions
operationId: getCreditsEndUsersByExternalUserIdPolicyEvents
description: Lists the end user's policy decisions (allow, deny, capture, release, and reset), newest first. Use it to explain why a call was allowed or blocked.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 250
default: 100
responses:
'200':
description: Newest policy decisions first
content:
application/json:
schema:
type: object
required:
- success
- externalUserId
- events
properties:
success:
const: true
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
events:
type: array
items:
$ref: '#/components/schemas/EndUserPolicyEvent'
/credits/end-users/{externalUserId}/allocate:
post:
tags:
- End users
summary: Allocate credits to an end-user
operationId: postCreditsEndUsersByExternalUserIdAllocate
description: Atomic platform-pool → end-user transfer; both sides ledgered. Fails (402) if the pool cannot cover it — unfunded allocations are impossible. Amounts are exact decimal strings.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
- name: Idempotency-Key
in: header
required: true
schema:
type: string
minLength: 1
maxLength: 255
description: One key per logical transfer; reuse it on retries.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- credits
properties:
credits:
$ref: '#/components/schemas/DecimalString'
promo:
type: boolean
description: Ledger as a promo/comp grant
additionalProperties: false
responses:
'200':
description: Allocation applied; returns both balances
content:
application/json:
schema:
$ref: '#/components/schemas/TransferResult'
'402':
description: Platform pool balance insufficient
/credits/end-users/{externalUserId}/deallocate:
post:
tags:
- End users
summary: Reverse an allocation
operationId: postCreditsEndUsersByExternalUserIdDeallocate
description: Moves credits from the end user's balance back to the workspace platform pool, reversing an earlier allocation. Send amounts as decimal strings and reuse the same Idempotency-Key when retrying one logical transfer.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: externalUserId
in: path
required: true
schema:
$ref: '#/components/schemas/ExternalUserId'
- name: Idempotency-Key
in: header
required: true
schema:
type: string
minLength: 1
maxLength: 255
description: One key per logical transfer; reuse it on retries.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- credits
properties:
credits:
$ref: '#/components/schemas/DecimalString'
additionalProperties: false
responses:
'200':
description: Credits returned to the platform pool
content:
application/json:
schema:
$ref: '#/components/schemas/TransferResult'
components:
schemas:
EndUserPolicyEnvelope:
type: object
required:
- success
- externalUserId
- policy
properties:
success:
const: true
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
policy:
oneOf:
- $ref: '#/components/schemas/EndUserPolicy'
- type: 'null'
ExternalUserId:
type: string
minLength: 1
maxLength: 200
pattern: ^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,199}$
description: Case-sensitive immutable ID in the tenant namespace. Prefer an identity-provider subject, not an email address.
InsufficientScopeError:
type: object
additionalProperties: false
required:
- success
- error
- code
- message
- requiredScopes
- presentScopes
properties:
success:
const: false
error:
const: Forbidden
code:
const: INSUFFICIENT_SCOPE
message:
type: string
requiredScopes:
type: array
items:
$ref: '#/components/schemas/CreditsTenantScope'
minItems: 1
uniqueItems: true
presentScopes:
type: array
items:
$ref: '#/components/schemas/CreditsTenantScope'
uniqueItems: true
EndUserPolicyInput:
type: object
required:
- mode
properties:
mode:
type: string
enum:
- ask
- bounded
- unlimited
budgetPeriod:
type:
- string
- 'null'
enum:
- hour
- day
- week
- month
- null
budgetCredits:
oneOf:
- $ref: '#/components/schemas/DecimalString'
- type: 'null'
maxChargeCredits:
oneOf:
- $ref: '#/components/schemas/DecimalString'
- type: 'null'
allowProviders:
type:
- array
- 'null'
items:
type: string
maxItems: 200
denyProviders:
type:
- array
- 'null'
items:
type: string
maxItems: 200
allowEndpoints:
type:
- array
- 'null'
items:
type: string
description: provider/endpoint
maxItems: 200
denyEndpoints:
type:
- array
- 'null'
items:
type: string
description: provider/endpoint
maxItems: 200
allowModels:
type:
- array
- 'null'
items:
type: string
maxItems: 200
denyModels:
type:
- array
- 'null'
items:
type: string
maxItems: 200
maxConcurrentReservations:
type:
- integer
- 'null'
minimum: 1
maximum: 1000000
maxCallsPerPeriod:
type:
- integer
- 'null'
minimum: 1
maximum: 1000000
maxCallsPerLoop:
type:
- integer
- 'null'
minimum: 1
maximum: 1000000
additionalProperties: false
EndUserTokenResponse:
type: object
required:
- success
- token
- expiresAt
- expiresIn
- tokenId
- externalUserId
properties:
success:
const: true
token:
type: string
expiresAt:
type: string
format: date-time
expiresIn:
type: integer
minimum: 60
maximum: 3600
tokenId:
type: string
format: uuid
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
additionalProperties: false
EndUserTokenRecord:
type: object
description: Metadata for one minted end-user token. The token itself is returned only at mint time and is never recoverable.
additionalProperties: false
required:
- id
- signingKeyId
- status
- expiresAt
- revokedAt
- revokedReason
- lastUsedAt
- createdAt
properties:
id:
type: string
format: uuid
signingKeyId:
type: string
description: kid of the RS256 key that signed it, resolvable through the public JWKS.
status:
type: string
enum:
- active
- expired
- revoked
description: Reported as expired as soon as expiresAt has passed, without waiting for a sweep.
expiresAt:
type: string
format: date-time
revokedAt:
type:
- string
- 'null'
format: date-time
revokedReason:
type:
- string
- 'null'
lastUsedAt:
type:
- string
- 'null'
format: date-time
createdAt:
type: string
format: date-time
EndUserPolicyEvent:
type: object
required:
- id
- policyId
- accountId
- action
- reasonCode
- createdAt
properties:
id:
type: string
format: uuid
policyId:
type: string
format: uuid
accountId:
type: string
format: uuid
reservationId:
type:
- string
- 'null'
format: uuid
action:
type: string
enum:
- ALLOW
- DENY
- CAPTURE
- RELEASE
reasonCode:
type: string
description: Stable POLICY_* denial code or lifecycle reason.
amountUsdc:
type:
- string
- 'null'
amountCredits:
type:
- string
- 'null'
idempotencyKey:
type:
- string
- 'null'
metadata:
type:
- object
- 'null'
additionalProperties: true
createdAt:
type: string
format: date-time
CreditsTenantScope:
type: string
enum:
- tenant:read
- tenant:write
- catalog:write
- credits:move
- credentials:manage
- tokens:manage
- payouts:manage
- members:manage
- widget:read
EndUserTokenRequest:
type: object
properties:
expiresIn:
type: integer
minimum: 60
maximum: 3600
default: 3600
sessionId:
type: string
minLength: 16
maxLength: 128
pattern: ^[A-Za-z0-9][A-Za-z0-9._:-]{15,127}$
description: High-entropy binding value. The JWT stores only its SHA-256 fingerprint; send the raw value as X-Locus-Session-Id.
additionalProperties: false
TransferResult:
type: object
required:
- success
- externalUserId
- usd
- credits
- poolBalanceUsd
- endUserBalanceUsd
properties:
success:
const: true
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
usd:
$ref: '#/components/schemas/DecimalString'
credits:
$ref: '#/components/schemas/DecimalString'
poolBalanceUsd:
$ref: '#/components/schemas/DecimalString'
endUserBalanceUsd:
$ref: '#/components/schemas/DecimalString'
additionalProperties: false
EndUserPolicy:
allOf:
- $ref: '#/components/schemas/EndUserPolicyInput'
- type: object
required:
- id
- activeReservations
- createdAt
- updatedAt
properties:
id:
type: string
format: uuid
activeReservations:
type: integer
minimum: 0
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
DecimalString:
type: string
pattern: ^\d+(?:\.\d{1,6})?$
description: Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
EndUserAccount:
type: object
required:
- externalUserId
- accountId
- balanceUsdc
- balanceCredits
- status
- createdAt
properties:
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
accountId:
type: string
format: uuid
balanceUsdc:
$ref: '#/components/schemas/DecimalString'
balanceCredits:
$ref: '#/components/schemas/DecimalString'
status:
type: string
enum:
- active
- frozen
createdAt:
type: string
format: date-time
additionalProperties: false
responses:
InsufficientScope:
description: The authenticated management credential lacks one or more required scopes
content:
application/json:
schema:
$ref: '#/components/schemas/InsufficientScopeError'
parameters:
WorkspaceStepUpHeader:
name: X-Locus-Step-Up
in: header
required: false
schema:
type: string
format: password
description: Short-lived raw MFA/passkey step-up token bound to the authenticated Cognito subject. Send it alongside the dashboard Bearer token for workspace-administrator mutations when the base session does not itself prove MFA within the last ten minutes. Never send it with a tenant secret key.
securitySchemes:
secretKey:
type: http
scheme: bearer
description: Tenant secret key (lcr_…). Server-side only.
sandboxKey:
type: http
scheme: bearer
description: 'Sandbox key (lcrsb_…). Metered calls are simulated: no credits move, no providers are called. No management access. Simulation is served from fixtures for the hosted provider catalog; external-rail providers are not registered with the sandbox interceptor and answer 404.'
endUserToken:
type: http
scheme: bearer
description: 60-3600 second end-user JWT minted via /credits/end-users/{id}/token. If the JWT has sid, send the original session value in X-Locus-Session-Id; sid contains only its SHA-256 fingerprint. Bearer tokens are replayable until expiry; use short TTLs, optional session binding, and Idempotency-Key on operations.
publishableKey:
type: apiKey
in: header
name: X-Locus-Publishable-Key
description: 'Widget calls: rides alongside the end-user token.'
dashboardSession:
type: http
scheme: bearer
description: Locus Pro dashboard session (Cognito). High-risk workspace administration requires an owner or admin role and fresh MFA/passkey step-up.
mcpOAuth:
type: oauth2
description: Primary authentication for the hosted MCP resource. Public clients use Authorization Code with PKCE S256. mcp:read covers discovery and resource reads; billed tools/call additionally requires mcp:execute; offline_access requests a rotating refresh token.
flows:
authorizationCode:
authorizationUrl: https://api.paywithlocus.com/api/credits/mcp/oauth/authorize
tokenUrl: https://api.paywithlocus.com/api/credits/mcp/oauth/token
refreshUrl: https://api.paywithlocus.com/api/credits/mcp/oauth/token
scopes:
mcp:read: Discover and read the authenticated MCP catalog and resources.
mcp:execute: Execute billed MCP tools.
offline_access: Issue and rotate a persistent refresh token.
mcpRegistrationToken:
type: http
scheme: bearer
description: Dynamic-client registration access token returned once when the MCP OAuth client is created. It remains valid only for that client's registration management URI.
agentConnection:
type: http
scheme: bearer
description: Scoped lcac_ credential. Tenant-managed Agent Connections authorize only their bound MCP and wrapped execution surfaces. A bootstrap connection for a self-registered agent additionally authorizes the explicit /credits/agent/* self-service routes for its own account; neither form authorizes general tenant management.
okibiIdentity:
type: http
scheme: bearer
bearerFormat: Okibi capability
description: Short-lived capability injected only by an Identity-eligible signed Okibi CLI release. It is verified by @okibi/partner-kit for issuer, audience, installation, grant activity, and required route scopes. Never persist or copy it into native Locus configuration.