PayWithLocus Top Ups API
Locus-hosted checkout top-ups and quotes
Locus-hosted checkout top-ups and quotes
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/paywithlocus-com:paywithlocus-com-top-ups-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: Locus Pro Top Ups 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: Top-ups
description: Locus-hosted checkout top-ups and quotes
paths:
/credits/tenants/me/topups:
get:
tags:
- Top-ups
summary: List the account's payment history
operationId: getCreditsTenantsMeTopups
description: Returns only TOPUP ledger entries for the account's pooled balance, newest first. Available to Personal and enterprise accounts. Manual top-ups and automatic reloads are distinguished by entry metadata; this narrow history does not expose provider charges, end-user rows, or margin data.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 25
default: 25
description: Maximum entries to return.
- name: cursor
in: query
schema:
type: string
description: Opaque nextCursor from the previous page.
responses:
'200':
description: Top-up history page
content:
application/json:
schema:
$ref: '#/components/schemas/LedgerPage'
'403':
$ref: '#/components/responses/InsufficientScope'
/credits/tenants/me/topups/{entryId}/receipt:
get:
tags:
- Top-ups
summary: Open the Stripe receipt for one top-up
operationId: getCreditsTenantsMeTopupsByEntryIdReceipt
description: Returns Stripe's hosted receipt URL for one card top-up from the payment history. Only TOPUP entries on the account's pooled balance that came from a Stripe payment have one; anything else answers 404.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: entryId
in: path
required: true
schema:
type: string
format: uuid
description: Ledger entry id from the payment history.
responses:
'200':
description: Receipt URL
content:
application/json:
schema:
type: object
required:
- success
- url
properties:
success:
type: boolean
const: true
url:
type: string
format: uri
'403':
$ref: '#/components/responses/InsufficientScope'
'404':
description: The entry has no card receipt.
/credits/stripe/operations:
get:
tags:
- Top-ups
summary: Top-up and Stripe ingress health
operationId: getCreditsStripeOperations
description: 'Operational health for this workspace''s card funding: signed-webhook inbox state and recent top-up activity. Use it to tell a stuck top-up apart from a delivery backlog.'
security:
- dashboardSession: []
- secretKey: []
responses:
'200':
description: Inbox and activity status
content:
application/json:
schema:
type: object
required:
- success
- operations
properties:
success:
const: true
operations:
type: object
required:
- inbox
- activity
properties:
inbox:
type: object
additionalProperties: true
description: Signed Stripe webhook inbox state, including unprocessed and dead-lettered counts.
activity:
type: object
additionalProperties: true
description: Recent top-up session and settlement activity for this workspace.
additionalProperties: false
'403':
$ref: '#/components/responses/InsufficientScope'
/credits/tenants/me/auto-recharge:
post:
tags:
- Top-ups
summary: Configure automatic balance reload
operationId: postCreditsTenantsMeAutoRecharge
description: Charges the saved card when the account's prepaid balance falls below thresholdUsd and credits amountUsd. Both fields must be positive and supplied together; send both as null to disable. Personal accounts call this auto-reload and require the account owner on a session authenticated within the last ten minutes. Enterprise workspaces call it auto-recharge and require a workspace owner or admin with payouts:manage plus recent MFA or passkey step-up. Evaluation workspaces may configure auto-recharge without activating a commercial agreement. Make one successful manual top-up first so Stripe has a reusable payment method.
security:
- dashboardSession: []
parameters:
- $ref: '#/components/parameters/WorkspaceStepUpHeader'
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- type: object
required:
- thresholdUsd
- amountUsd
properties:
thresholdUsd:
$ref: '#/components/schemas/DecimalString'
amountUsd:
$ref: '#/components/schemas/DecimalString'
additionalProperties: false
- type: object
required:
- thresholdUsd
- amountUsd
properties:
thresholdUsd:
type: 'null'
amountUsd:
type: 'null'
additionalProperties: false
responses:
'200':
description: Automatic reload configuration updated; autoRecharge is null when disabled
'400':
description: Unknown field, non-positive amount, or only one of thresholdUsd and amountUsd was supplied
'403':
description: Owner/recent-authentication requirement, enterprise step-up requirement, insufficient scope, or funding unavailable
/credits/topups/quote:
post:
tags:
- Top-ups
summary: Quote a top-up (exact-decimal gross-up)
operationId: postCreditsTopupsQuote
description: 'Send exactly one exact decimal string: usd or credits. Numeric compatibility values are deprecated. Declare externalUserId when the eventual create targets an end user so the bonus fields match the create.'
security:
- dashboardSession: []
- secretKey: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TopupQuoteRequest'
responses:
'200':
description: Quote
content:
application/json:
schema:
type: object
required:
- success
- quote
properties:
success:
const: true
quote:
$ref: '#/components/schemas/TopupQuote'
'400':
$ref: '#/components/responses/TopupError'
/credits/topups/config:
get:
tags:
- Top-ups
summary: Get machine-readable top-up constraints
operationId: getCreditsTopupsConfig
description: Returns the workspace-specific top-up amount constraints and credit denomination. Read it before creating a checkout so the requested amount is valid.
security:
- dashboardSession: []
- secretKey: []
responses:
'200':
description: Tenant-specific amount constraints and denomination
content:
application/json:
schema:
$ref: '#/components/schemas/TopupConstraintsEnvelope'
/credits/topups:
post:
tags:
- Top-ups
summary: Create a hosted checkout session
operationId: postCreditsTopups
description: Canonical v2 contract. externalUserId present → end-user top-up. Absent → platform-pool self-top-up. Send exactly one exact-decimal usd or credits amount. There is no fixed or daily platform top-up ceiling. Evaluation funding does not activate a commercial agreement.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: Idempotency-Key
in: header
required: false
schema:
type: string
maxLength: 255
description: Reuse for retries of the same checkout creation.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TopupRequest'
responses:
'201':
description: Checkout session
content:
application/json:
schema:
$ref: '#/components/schemas/TopupSessionResponse'
'400':
description: Validation or minimum-amount failure
content:
application/json:
schema:
$ref: '#/components/schemas/TopupErrorResponse'
/credits/topups/{sessionId}:
get:
tags:
- Top-ups
summary: Get authoritative checkout state
operationId: getCreditsTopupsBySessionId
description: Returns the authoritative state of a workspace top-up checkout session. Poll it after Stripe Checkout instead of trusting the browser redirect.
security:
- dashboardSession: []
- secretKey: []
parameters:
- name: sessionId
in: path
required: true
schema:
type: string
pattern: ^cs_
responses:
'200':
description: Checkout state
content:
application/json:
schema:
$ref: '#/components/schemas/TopupStatus'
'400':
$ref: '#/components/responses/TopupError'
components:
schemas:
TopupConstraints:
type: object
required:
- currency
- minUsd
- maxUsd
- incrementUsd
- maxAmountDecimalPlaces
- amountEncoding
- creditsPerDollar
- purchasingEnabled
- disabledReason
properties:
currency:
const: USD
minUsd:
type: string
example: '5.00'
maxUsd:
type:
- string
- 'null'
const: null
description: No fixed platform maximum; commercial and processor controls remain risk-based.
incrementUsd:
const: '0.01'
maxAmountDecimalPlaces:
const: 6
amountEncoding:
const: decimal_string
creditsPerDollar:
type: string
purchasingEnabled:
type: boolean
description: False when this tenant cannot currently create checkout sessions or buy credits.
disabledReason:
type:
- string
- 'null'
enum:
- funding_unavailable
- null
bonusTiers:
type: array
description: Volume-bonus cliff tiers over creditsUsd — the highest reached tier applies to the whole purchase. Management surface only; omitted from the end-user /me config because end-user top-ups never earn a bonus.
items:
type: object
required:
- minUsd
- bonusBps
properties:
minUsd:
type: string
bonusBps:
type: integer
TopupError:
type: object
required:
- success
- error
- code
- message
properties:
success:
const: false
error:
type: string
code:
type: string
enum:
- below_minimum
- not_whole_cents
- invalid_amount
- invalid_amount_choice
- invalid_request
- invalid_url
- invalid_external_user_id
- invalid_metadata
- identity_not_allowed
- unknown_field
- invalid_session_id
- tenant_unavailable
- missing_stripe_customer
message:
type: string
TopupRequest:
allOf:
- $ref: '#/components/schemas/TopupAmount'
- type: object
required:
- successUrl
- cancelUrl
properties:
usd:
$ref: '#/components/schemas/DecimalString'
credits:
$ref: '#/components/schemas/DecimalString'
successUrl:
type: string
format: uri
maxLength: 2048
cancelUrl:
type: string
format: uri
maxLength: 2048
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
metadata:
$ref: '#/components/schemas/TopupMetadata'
unevaluatedProperties: false
TopupMetadata:
type: object
maxProperties: 16
propertyNames:
pattern: ^[A-Za-z0-9][A-Za-z0-9_.-]{0,39}$
additionalProperties:
type: string
maxLength: 256
description: Serialized object is limited to 500 characters.
TopupAmount:
oneOf:
- type: object
required:
- usd
not:
required:
- credits
properties:
usd:
$ref: '#/components/schemas/DecimalString'
- type: object
required:
- credits
not:
required:
- usd
properties:
credits:
$ref: '#/components/schemas/DecimalString'
TopupQuoteRequest:
description: Quote pricing for a hypothetical top-up. Declare externalUserId when the eventual create targets an end user, so the quote's bonus fields match what the create will actually grant (end-user top-ups never earn a volume bonus).
allOf:
- $ref: '#/components/schemas/TopupAmount'
- type: object
properties:
usd:
$ref: '#/components/schemas/DecimalString'
credits:
$ref: '#/components/schemas/DecimalString'
externalUserId:
$ref: '#/components/schemas/ExternalUserId'
unevaluatedProperties: false
TopupQuote:
type: object
required:
- feeMode
- creditsUsd
- credits
- feeUsd
- totalUsd
properties:
feeMode:
type: string
enum:
- pass_through
- absorb
creditsUsd:
type: string
credits:
type: string
feeUsd:
type: string
totalUsd:
type: string
bonus:
type:
- object
- 'null'
description: Volume bonus this amount earns (POST /topups/quote only; tenant pool top-ups). Null when no tier is reached; end-user purchases never earn one.
required:
- bonusUsd
- bonusCredits
- bonusBps
properties:
bonusUsd:
type: string
description: USD value of the bonus credits, 6dp decimal string.
bonusCredits:
type: string
description: bonusUsd in the tenant's display denomination.
bonusBps:
type: integer
description: Applied bonus rate in basis points.
nextBonusTier:
type:
- object
- 'null'
description: Cheapest volume-bonus tier this amount has NOT reached — the add-more upsell hint. Null at or above the top tier. POST /topups/quote only.
required:
- minUsd
- bonusBps
properties:
minUsd:
type: string
bonusBps:
type: integer
CreditsTenantScope:
type: string
enum:
- tenant:read
- tenant:write
- catalog:write
- credits:move
- credentials:manage
- tokens:manage
- payouts:manage
- members:manage
- widget:read
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.
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
LedgerPage:
type: object
additionalProperties: false
required:
- success
- entries
- nextCursor
properties:
success:
type: boolean
const: true
entries:
type: array
items:
$ref: '#/components/schemas/LedgerEntry'
nextCursor:
type:
- string
- 'null'
LedgerEntry:
type: object
additionalProperties: false
required:
- id
- direction
- category
- amountUsdc
- amountCredits
- balanceAfterUsdc
- baseUsdc
- marginUsdc
- markupBps
- sourceKey
- externalReference
- externalUserId
- metadata
- createdAt
properties:
id:
type: string
format: uuid
direction:
type: string
enum:
- DEBIT
- CREDIT
category:
type: string
amountUsdc:
$ref: '#/components/schemas/DecimalString'
amountCredits:
$ref: '#/components/schemas/DecimalString'
balanceAfterUsdc:
$ref: '#/components/schemas/DecimalString'
baseUsdc:
oneOf:
- $ref: '#/components/schemas/DecimalString'
- type: 'null'
marginUsdc:
oneOf:
- $ref: '#/components/schemas/DecimalString'
- type: 'null'
markupBps:
type:
- integer
- 'null'
sourceKey:
type: string
externalReference:
type:
- string
- 'null'
externalUserId:
type:
- string
- 'null'
metadata: {}
createdAt:
type: string
format: date-time
TopupStatus:
type: object
required:
- success
- sessionId
- state
- paymentStatus
properties:
success:
const: true
sessionId:
type: string
state:
type: string
enum:
- pending
- completed
- expired
paymentStatus:
type: string
fulfillment:
type: string
enum:
- awaiting_payment
- processing
- ready
- expired
- failed
description: Ledger state. `completed` means Stripe was paid; credits are spendable once this is `ready`.
TopupConstraintsEnvelope:
type: object
required:
- success
- constraints
properties:
success:
const: true
constraints:
$ref: '#/components/schemas/TopupConstraints'
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.
TopupSessionResponse:
type: object
required:
- success
- sessionId
- url
- externalUserId
- quote
properties:
success:
type: boolean
const: true
sessionId:
type: string
pattern: ^cs_
url:
type: string
format: uri
externalUserId:
type:
- string
- 'null'
quote:
$ref: '#/components/schemas/TopupQuote'
bonus:
type: object
description: Present only when this checkout session will mint a volume bonus on completion (tenant pool top-up reaching a tier).
required:
- bonusUsd
- bonusCredits
- bonusBps
properties:
bonusUsd:
type: string
bonusCredits:
type: string
bonusBps:
type: integer
additionalProperties: false
TopupErrorResponse:
type: object
required:
- success
- error
- code
- message
properties:
success:
type: boolean
const: false
error:
type: string
code:
type: string
enum:
- below_minimum
- not_whole_cents
- invalid_amount
- invalid_amount_choice
- invalid_request
- invalid_url
- invalid_external_user_id
- invalid_metadata
- identity_not_allowed
- unknown_field
- invalid_session_id
- tenant_unavailable
- missing_stripe_customer
message:
type: string
additionalProperties: false
responses:
InsufficientScope:
description: The authenticated management credential lacks one or more required scopes
content:
application/json:
schema:
$ref: '#/components/schemas/InsufficientScopeError'
TopupError:
description: Stable top-up validation, velocity, or ownership error
content:
application/json:
schema:
$ref: '#/components/schemas/TopupError'
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.