PayWithLocus Widget API

End-user JWT surface; a matching publishable key is optional

GitHub OpenAPI

Operations 6

GET /credits/me/balance Own balance (end-user) #
GET /credits/me/catalog Discover APIs available to the authenticated end user #
GET /credits/me/ledger Own ledger (end-user) #
POST /credits/me/topups Open a top-up for self (end-user) #
GET /credits/me/topups/config Get machine-readable top-up constraints #
GET /credits/me/topups/{sessionId} Get authoritative state for this user's checkout #

Work with this as data

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-widget-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 Specification

paywithlocus-com-widget-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Locus Pro Widget 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: Widget
  description: End-user JWT surface; a matching publishable key is optional
paths:
  /credits/me/balance:
    get:
      tags:
      - Widget
      summary: Own balance (end-user)
      operationId: getCreditsMeBalance
      description: Returns the calling end user's own balance in the workspace's credit denomination. Authenticates with an end-user token, optionally alongside a publishable key for the browser widget.
      security:
      - endUserToken: []
      - endUserToken: []
        publishableKey: []
      parameters:
      - $ref: '#/components/parameters/SessionBindingHeader'
      responses:
        '200':
          description: Balance in the tenant's credit denomination
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - balance
                properties:
                  success:
                    const: true
                  balance:
                    type: object
                    required:
                    - externalUserId
                    - balanceUsdc
                    - balanceCredits
                    - status
                    properties:
                      externalUserId:
                        $ref: '#/components/schemas/ExternalUserId'
                      balanceUsdc:
                        $ref: '#/components/schemas/DecimalString'
                      balanceCredits:
                        $ref: '#/components/schemas/DecimalString'
                      status:
                        type: string
                        enum:
                        - active
                        - frozen
                    additionalProperties: false
                additionalProperties: false
  /credits/me/catalog:
    get:
      tags:
      - Widget
      summary: Discover APIs available to the authenticated end user
      operationId: getCreditsMeCatalog
      description: Versioned cursor catalog. Returns only endpoints enabled by the tenant and allowed by this end user's current provider policy. Omitted endpoints do not reveal whether they are disabled, denied, or unknown. Tenant rules, base USD cost, markup, and margin are never returned; price.usd is the final customer-visible effective price. Results sort by stable endpoint ID. Cursors are opaque, filters are exact/case-insensitive, and responses are private/non-cacheable so policy changes are visible on the next request. The end-user token authenticates this read on its own; when a publishable key is sent it must belong to the token's tenant.
      security:
      - endUserToken: []
      - endUserToken: []
        publishableKey: []
      parameters:
      - name: provider
        in: query
        schema:
          type: string
          maxLength: 128
        description: Exact stable provider ID (case-insensitive)
      - name: category
        in: query
        schema:
          type: string
          maxLength: 128
        description: Exact provider category (case-insensitive)
      - name: cursor
        in: query
        schema:
          type: string
          maxLength: 512
        description: Opaque cursor returned by the previous page
      - name: limit
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 50
      responses:
        '200':
          description: Privacy-safe, policy-filtered provider catalog
          headers:
            Cache-Control:
              schema:
                type: string
                const: private, no-store
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndUserCatalogResponse'
  /credits/me/ledger:
    get:
      tags:
      - Widget
      summary: Own ledger (end-user)
      operationId: getCreditsMeLedger
      description: Returns newest-first transaction history for the end user encoded in the bearer token. The caller cannot select another externalUserId. Entries include charges, top-ups, allocations, refunds, and other posted balance movements. End-user responses redact base cost, markup, margin, tenant identifiers, and internal pricing configuration.
      security:
      - endUserToken: []
      - endUserToken: []
        publishableKey: []
      parameters:
      - $ref: '#/components/parameters/SessionBindingHeader'
      - name: cursor
        in: query
        description: Opaque nextCursor from the previous page.
        schema:
          type: string
      - name: limit
        in: query
        description: Number of transaction-history entries to return.
        schema:
          type: integer
          minimum: 1
          maximum: 200
          default: 50
      responses:
        '200':
          description: End-user transaction history with internal pricing fields redacted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LedgerPage'
  /credits/me/topups:
    post:
      tags:
      - Widget
      summary: Open a top-up for self (end-user)
      operationId: postCreditsMeTopups
      description: Identity is derived only from the end-user token. externalUserId is rejected.
      security:
      - endUserToken: []
      - endUserToken: []
        publishableKey: []
      parameters:
      - $ref: '#/components/parameters/SessionBindingHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TopupSelfRequest'
      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/me/topups/config:
    get:
      tags:
      - Widget
      summary: Get machine-readable top-up constraints
      operationId: getCreditsMeTopupsConfig
      description: Returns the top-up amount constraints that apply to the calling end user. Read it before the end user starts a widget checkout.
      security:
      - endUserToken: []
      - endUserToken: []
        publishableKey: []
      parameters:
      - $ref: '#/components/parameters/SessionBindingHeader'
      responses:
        '200':
          description: Amount constraints
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopupConstraintsEnvelope'
  /credits/me/topups/{sessionId}:
    get:
      tags:
      - Widget
      summary: Get authoritative state for this user's checkout
      operationId: getCreditsMeTopupsBySessionId
      description: Returns the authoritative state of one of the calling end user's own top-up checkout sessions. Poll it after checkout instead of trusting the browser redirect.
      security:
      - endUserToken: []
      - endUserToken: []
        publishableKey: []
      parameters:
      - $ref: '#/components/parameters/SessionBindingHeader'
      - 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
    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'
    EndUserCatalogEndpoint:
      type: object
      additionalProperties: false
      required:
      - id
      - slug
      - displayName
      - description
      - enabled
      - price
      properties:
        id:
          type: string
          description: Stable public endpoint ID
        slug:
          type: string
          example: tavily/search
        displayName:
          type: string
          example: Search
        description:
          type: string
          description: Price- and policy-neutral endpoint description
        enabled:
          type: boolean
          const: true
        price:
          $ref: '#/components/schemas/EndUserCatalogPrice'
    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
    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.
    EndUserCatalogProvider:
      type: object
      additionalProperties: false
      required:
      - id
      - slug
      - displayName
      - category
      - description
      - logoUrl
      - enabled
      - endpoints
      properties:
        id:
          type: string
          description: Stable public provider ID
        slug:
          type: string
        displayName:
          type: string
        category:
          type: string
        description:
          type: string
        logoUrl:
          type: string
          format: uri
          description: Absolute stable brand-asset URL
        enabled:
          type: boolean
          const: true
        endpoints:
          type: array
          items:
            $ref: '#/components/schemas/EndUserCatalogEndpoint'
    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'
    TopupSelfRequest:
      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
          metadata:
            $ref: '#/components/schemas/TopupMetadata'
        unevaluatedProperties: false
    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
    EndUserCatalogPrice:
      oneOf:
      - type: object
        additionalProperties: false
        required:
        - state
        - credits
        - usd
        properties:
          state:
            type: string
            const: exact
          credits:
            type: string
          usd:
            type: string
            description: Final customer-visible effective USD price; never base cost
      - type: object
        additionalProperties: false
        required:
        - state
        properties:
          state:
            type: string
            enum:
            - dynamic
            - unavailable
    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
    EndUserCatalogResponse:
      type: object
      additionalProperties: false
      required:
      - success
      - version
      - providers
      - nextCursor
      properties:
        success:
          type: boolean
          const: true
        version:
          type: string
          const: '2026-08-14'
        providers:
          type: array
          items:
            $ref: '#/components/schemas/EndUserCatalogProvider'
        nextCursor:
          type:
          - string
          - 'null'
  parameters:
    SessionBindingHeader:
      name: X-Locus-Session-Id
      in: header
      required: false
      schema:
        type: string
        minLength: 16
        maxLength: 128
        pattern: ^[A-Za-z0-9][A-Za-z0-9._:-]{15,127}$
      description: Required only when the end-user JWT carries sid. Send the original high-entropy session value; sid is its SHA-256 fingerprint. Ignored for secret-key authentication.
  responses:
    TopupError:
      description: Stable top-up validation, velocity, or ownership error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TopupError'
  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.