PayWithLocus Webhooks API

Signed events, delivery inspection, and replay

GitHub OpenAPI

Operations 6

GET /credits/tenants/me/webhook-verification Read the latest webhook ownership challenge #
POST /credits/tenants/me/webhook-secret/reveal Reveal the first verified webhook signing secret once #
POST /credits/tenants/me/webhook-secret/rotate Rotate the webhook signing secret #
GET /credits/webhooks/events List durable webhook events #
GET /credits/webhooks/events/{eventId} Inspect an event and every delivery attempt #
POST /credits/webhooks/events/{eventId}/replay Replay a retained event #

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-webhooks-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-webhooks-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Locus Pro Webhooks 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: Webhooks
  description: Signed events, delivery inspection, and replay
paths:
  /credits/tenants/me/webhook-verification:
    get:
      tags:
      - Webhooks
      summary: Read the latest webhook ownership challenge
      operationId: getCreditsTenantsMeWebhookVerification
      description: Polling this endpoint never reveals or consumes the webhook signing secret.
      security:
      - dashboardSession: []
      - secretKey: []
      responses:
        '200':
          description: Latest tenant-scoped verification, or null when none was requested
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - webhookVerification
                properties:
                  success:
                    const: true
                  webhookVerification:
                    oneOf:
                    - $ref: '#/components/schemas/WebhookVerification'
                    - type: 'null'
  /credits/tenants/me/webhook-secret/reveal:
    post:
      tags:
      - Webhooks
      summary: Reveal the first verified webhook signing secret once
      operationId: postCreditsTenantsMeWebhookSecretReveal
      description: Workspace owner/admin and MFA/passkey step-up protected. Status polling cannot consume this reveal. If it was already revealed, rotate the secret instead.
      security:
      - dashboardSession: []
      parameters:
      - $ref: '#/components/parameters/WorkspaceStepUpHeader'
      responses:
        '200':
          description: First signing secret
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - webhookSecret
                properties:
                  success:
                    const: true
                  webhookSecret:
                    type: string
                    pattern: ^whsec_
        '409':
          description: Verification is incomplete or the secret was already revealed
  /credits/tenants/me/webhook-secret/rotate:
    post:
      tags:
      - Webhooks
      summary: Rotate the webhook signing secret
      operationId: postCreditsTenantsMeWebhookSecretRotate
      description: Returns the new secret once. Requires a workspace owner or admin with credentials:manage and MFA or passkey step-up completed in the last ten minutes. Deliveries contain signatures for both the current and previous secrets during a 24-hour overlap.
      security:
      - dashboardSession: []
      parameters:
      - $ref: '#/components/parameters/WorkspaceStepUpHeader'
      responses:
        '200':
          description: New signing secret and old-secret expiry
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - webhook_secret
                - previous_secret_valid_until
                properties:
                  success:
                    const: true
                  webhook_secret:
                    type: string
                    pattern: ^whsec_
                  previous_secret_valid_until:
                    type: string
                    format: date-time
  /credits/webhooks/events:
    get:
      tags:
      - Webhooks
      summary: List durable webhook events
      operationId: getCreditsWebhooksEvents
      description: Lists durable webhook events for the workspace, newest first, with cursor pagination. Filter by event type to find an event before inspecting its delivery attempts.
      security:
      - dashboardSession: []
      - secretKey: []
      parameters:
      - name: type
        in: query
        schema:
          $ref: '#/components/schemas/WebhookEventType'
      - name: cursor
        in: query
        schema:
          type: string
          format: uuid
      - name: limit
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 25
      responses:
        '200':
          description: Newest events first
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEventPage'
  /credits/webhooks/events/{eventId}:
    get:
      tags:
      - Webhooks
      summary: Inspect an event and every delivery attempt
      operationId: getCreditsWebhooksEventsByEventId
      description: Returns one webhook event with its immutable envelope and every delivery attempt. Use it to debug failed deliveries. Returns 404 when the event belongs to another workspace.
      security:
      - dashboardSession: []
      - secretKey: []
      parameters:
      - name: eventId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Immutable envelope and delivery history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEventDetail'
        '404':
          description: Event not found in this tenant
  /credits/webhooks/events/{eventId}/replay:
    post:
      tags:
      - Webhooks
      summary: Replay a retained event
      operationId: postCreditsWebhooksEventsByEventIdReplay
      description: Creates one new attempt using the same stable event ID and current endpoint. Returns 409 while another attempt is pending.
      security:
      - dashboardSession: []
      - secretKey: []
      parameters:
      - name: eventId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '202':
          description: Replay attempted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEventDetail'
        '409':
          description: An attempt is already pending or event retention expired
        '422':
          description: Webhook endpoint is not configured
components:
  schemas:
    WebhookEventType:
      type: string
      enum:
      - credits.topup.completed
      - credits.topup.failed
      - credits.burn.completed
      - credits.burn.failed
      - credits.refund.issued
      - credits.dispute.opened
      - credits.dispute.closed
      - credits.balance.changed
      - credits.balance.low
      - credits.account.frozen
      - credits.usage_drift.detected
      - credits.usage_drift.resolved
    WebhookTopupFailedData:
      type: object
      required:
      - externalUserId
      - reason
      - reference
      properties:
        externalUserId:
          type:
          - string
          - 'null'
        reason:
          type: string
        reference:
          type: string
        paymentIntentId:
          type: string
      additionalProperties: false
    WebhookBalanceChangedData:
      type: object
      required:
      - reference
      - externalUserId
      - deltaUsd
      - balanceUsd
      - reason
      properties:
        apiCallId:
          type: string
        reference:
          type: string
        externalUserId:
          type:
          - string
          - 'null'
        deltaUsd:
          $ref: '#/components/schemas/SignedDecimalString'
        balanceUsd:
          $ref: '#/components/schemas/DecimalString'
        reason:
          type: string
          enum:
          - topup
          - burn
          - refund
          - dispute_reversal
          - allocate
          - deallocate
          - expiration
      additionalProperties: false
    WebhookDisputeOpenedData:
      type: object
      required:
      - accountId
      - disputeId
      - amountUsd
      - clawbackUsd
      - marginClawbackUsd
      - status
      properties:
        accountId:
          type: string
        disputeId:
          type: string
        amountUsd:
          $ref: '#/components/schemas/DecimalString'
        clawbackUsd:
          $ref: '#/components/schemas/DecimalString'
        marginClawbackUsd:
          $ref: '#/components/schemas/DecimalString'
        bonusClawbackUsd:
          $ref: '#/components/schemas/DecimalString'
          description: Volume-bonus credits clawed alongside the principal. Present only when the disputed top-up had earned a bonus.
        status:
          type: string
      additionalProperties: false
    WebhookDisputeClosedData:
      type: object
      required:
      - accountId
      - disputeId
      - outcome
      properties:
        accountId:
          type:
          - string
          - 'null'
        disputeId:
          type: string
        outcome:
          type: string
      additionalProperties: false
    WebhookAccountFrozenData:
      type: object
      required:
      - accountId
      - disputeId
      - reason
      properties:
        accountId:
          type: string
        disputeId:
          type: string
        reason:
          const: dispute_opened
      additionalProperties: false
    WebhookRefundIssuedData:
      oneOf:
      - type: object
        required:
        - apiCallId
        - reference
        - provider
        - endpoint
        - amountUsd
        - mode
        - externalUserId
        - reason
        properties:
          apiCallId:
            type: string
          reference:
            type: string
          provider:
            type: string
          endpoint:
            type: string
          amountUsd:
            $ref: '#/components/schemas/DecimalString'
          mode:
            type: string
            enum:
            - platform
            - end_user
          externalUserId:
            type:
            - string
            - 'null'
          reason:
            const: upstream_failure
        additionalProperties: false
      - type: object
        required:
        - externalUserId
        - amountUsd
        - reason
        - reference
        properties:
          externalUserId:
            type:
            - string
            - 'null'
          amountUsd:
            $ref: '#/components/schemas/DecimalString'
          reason:
            const: account_frozen
          reference:
            type: string
        additionalProperties: false
      - type: object
        required:
        - accountId
        - chargeId
        - amountUsd
        - marginClawbackUsd
        - cumulativeRefundedCents
        - reason
        - reference
        properties:
          accountId:
            type: string
          chargeId:
            type: string
          amountUsd:
            $ref: '#/components/schemas/DecimalString'
          marginClawbackUsd:
            $ref: '#/components/schemas/DecimalString'
          bonusClawbackUsd:
            $ref: '#/components/schemas/DecimalString'
            description: Volume-bonus credits clawed back alongside the principal. Present only when the refunded top-up had earned a bonus.
          cumulativeRefundedCents:
            type: integer
            minimum: 0
          reason:
            const: stripe_refund
          reference:
            type: string
        additionalProperties: false
      - type: object
        required:
        - externalUserId
        - amountUsd
        - reason
        - reference
        properties:
          externalUserId:
            type:
            - string
            - 'null'
          amountUsd:
            $ref: '#/components/schemas/DecimalString'
          reason:
            const: funding_unavailable
          reference:
            type: string
        additionalProperties: false
    WebhookVerification:
      type: object
      required:
      - id
      - destinationUrl
      - status
      - attempts
      - scheduledAt
      - verifiedAt
      - error
      properties:
        id:
          type: string
          format: uuid
        destinationUrl:
          type: string
          format: uri
        status:
          type: string
          enum:
          - pending
          - verifying
          - verified
          - failed
          - superseded
        attempts:
          type: integer
          minimum: 0
          maximum: 5
        scheduledAt:
          type: string
          format: date-time
        verifiedAt:
          type:
          - string
          - 'null'
          format: date-time
        error:
          type:
          - string
          - 'null'
      additionalProperties: false
    SignedDecimalString:
      type: string
      pattern: ^-?\d+(?:\.\d{1,6})?$
      description: Exact signed USD decimal string with at most six fractional digits.
    WebhookEventEnvelope:
      type: object
      required:
      - id
      - type
      - api_version
      - created_at
      - sequence
      - tenant_id
      - data
      properties:
        id:
          type: string
          format: uuid
        type:
          $ref: '#/components/schemas/WebhookEventType'
        api_version:
          const: '2026-08-13'
        created_at:
          type: string
          format: date-time
        sequence:
          type: string
          pattern: ^\d+$
        tenant_id:
          type: string
          format: uuid
        data:
          oneOf:
          - $ref: '#/components/schemas/WebhookTopupCompletedData'
          - $ref: '#/components/schemas/WebhookTopupFailedData'
          - $ref: '#/components/schemas/WebhookBurnCompletedData'
          - $ref: '#/components/schemas/WebhookBurnFailedData'
          - $ref: '#/components/schemas/WebhookRefundIssuedData'
          - $ref: '#/components/schemas/WebhookDisputeOpenedData'
          - $ref: '#/components/schemas/WebhookDisputeClosedData'
          - $ref: '#/components/schemas/WebhookBalanceChangedData'
          - $ref: '#/components/schemas/WebhookBalanceLowData'
          - $ref: '#/components/schemas/WebhookAccountFrozenData'
    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.
    WebhookEventPage:
      type: object
      required:
      - success
      - data
      - next_cursor
      properties:
        success:
          const: true
        data:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/WebhookEventEnvelope'
            - type: object
              required:
              - retained_until
              - delivery
              properties:
                retained_until:
                  type: string
                  format: date-time
                delivery:
                  oneOf:
                  - $ref: '#/components/schemas/WebhookDelivery'
                  - type: 'null'
        next_cursor:
          type:
          - string
          - 'null'
          format: uuid
    WebhookDelivery:
      type: object
      required:
      - id
      - attempt
      - destination_url
      - status
      - manual_replay
      - scheduled_at
      properties:
        id:
          type: string
          format: uuid
        attempt:
          type: integer
          minimum: 1
        destination_url:
          type: string
          format: uri
        status:
          type: string
          enum:
          - pending
          - delivering
          - delivered
          - failed
        manual_replay:
          type: boolean
        scheduled_at:
          type: string
          format: date-time
        started_at:
          type:
          - string
          - 'null'
          format: date-time
        finished_at:
          type:
          - string
          - 'null'
          format: date-time
        http_status:
          type:
          - integer
          - 'null'
        response_body:
          type:
          - string
          - 'null'
          maxLength: 1024
        error:
          type:
          - string
          - 'null'
    WebhookBalanceLowData:
      type: object
      required:
      - reason
      properties:
        balanceUsd:
          $ref: '#/components/schemas/DecimalString'
        thresholdUsd:
          $ref: '#/components/schemas/DecimalString'
        reason:
          type: string
        paymentIntentId:
          type: string
      additionalProperties: false
    WebhookTopupCompletedData:
      type: object
      required:
      - externalUserId
      - amountUsd
      - balanceUsd
      - reference
      - source
      - metadata
      properties:
        externalUserId:
          type:
          - string
          - 'null'
        amountUsd:
          $ref: '#/components/schemas/DecimalString'
        balanceUsd:
          $ref: '#/components/schemas/DecimalString'
        reference:
          type: string
        source:
          type: string
          enum:
          - checkout_session
          - auto_recharge
          - saved_card
        bonusUsd:
          $ref: '#/components/schemas/DecimalString'
          description: Volume bonus minted alongside this top-up (pool purchases only). Present only when a bonus was actually granted; balanceUsd then reflects the post-bonus balance.
        metadata:
          oneOf:
          - type: object
            additionalProperties:
              type: string
          - type: 'null'
      additionalProperties: false
    WebhookBurnFailedData:
      type: object
      required:
      - apiCallId
      - provider
      - endpoint
      - amountUsd
      - mode
      - externalUserId
      - reason
      properties:
        apiCallId:
          type: string
        provider:
          type: string
        endpoint:
          type: string
        amountUsd:
          $ref: '#/components/schemas/DecimalString'
        mode:
          type: string
          enum:
          - platform
          - end_user
        externalUserId:
          type:
          - string
          - 'null'
        reason:
          type: string
      additionalProperties: false
    WebhookEventDetail:
      type: object
      required:
      - success
      - event
      properties:
        success:
          const: true
        event:
          allOf:
          - $ref: '#/components/schemas/WebhookEventEnvelope'
          - type: object
            required:
            - retained_until
            - deliveries
            properties:
              retained_until:
                type: string
                format: date-time
              deliveries:
                type: array
                items:
                  $ref: '#/components/schemas/WebhookDelivery'
    WebhookBurnCompletedData:
      type: object
      required:
      - apiCallId
      - provider
      - endpoint
      - amountUsd
      - balanceUsd
      - mode
      - externalUserId
      properties:
        apiCallId:
          type: string
        provider:
          type: string
        endpoint:
          type: string
        amountUsd:
          $ref: '#/components/schemas/DecimalString'
        balanceUsd:
          $ref: '#/components/schemas/DecimalString'
        mode:
          type: string
          enum:
          - platform
          - end_user
        externalUserId:
          type:
          - string
          - 'null'
      additionalProperties: false
  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.