PayWithLocus Customers API

Names for the customers a tenant attributes spend to, and every customer's spend

GitHub OpenAPI

Operations 4

GET /credits/analytics/customers Every customer with spend in a window #
GET /credits/customers List the customer directory #
PUT /credits/customers Name up to 50 customers #
POST /credits/customers/remove Forget up to 50 customers' names #

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-customers-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-customers-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Locus Pro Customers 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: Customers
  description: Names for the customers a tenant attributes spend to, and every customer's spend
paths:
  /credits/analytics/customers:
    get:
      tags:
      - Customers
      summary: Every customer with spend in a window
      operationId: getCreditsAnalyticsCustomers
      description: Each (attribution.source, customerId) pair the tenant's charges were attributed to in the window, counted exactly as analytics counts customer spend, named from the customer directory, filterable by product, searchable, and paged past the analytics row cap. sources totals every product with customer spend in the window and ignores source and q. Enterprise workspaces only.
      security:
      - dashboardSession: []
      - secretKey: []
      x-required-scopes:
      - tenant:read
      parameters:
      - name: days
        in: query
        schema:
          type: integer
          enum:
          - 7
          - 30
          - 90
          default: 30
        description: Legacy form, as analytics. Cannot be combined with from/to.
      - name: from
        in: query
        schema:
          type: string
          format: date-time
        description: Window start, inclusive. Strict ISO-8601. Requires to.
      - name: to
        in: query
        schema:
          type: string
          format: date-time
        description: Window end, EXCLUSIVE. Strict ISO-8601. Requires from.
      - name: source
        in: query
        schema:
          type: string
          maxLength: 128
        description: Only this product's customers (attribution.source), exactly as tagged. Send it empty (source=) for customers with no product tag; omit it for every product.
      - name: q
        in: query
        schema:
          type: string
          maxLength: 120
        description: Case-insensitive literal substring of the directory name, the link, or the customer id.
      - name: offset
        in: query
        schema:
          type: integer
          minimum: 0
          maximum: 2147483647
          default: 0
      - name: limit
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 50
      responses:
        '200':
          description: One page of customers, the matching total, and per-product totals
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                - success
                - periodStart
                - periodEndExclusive
                - total
                - customers
                - sources
                properties:
                  success:
                    type: boolean
                    const: true
                  periodStart:
                    type: string
                    format: date-time
                  periodEndExclusive:
                    type: string
                    format: date-time
                  total:
                    type: integer
                    description: Customers matching source and q, across all pages.
                  customers:
                    type: array
                    items:
                      $ref: '#/components/schemas/CustomerSpend'
                  sources:
                    type: array
                    items:
                      $ref: '#/components/schemas/AnalyticsCustomerSource'
        '400':
          description: Invalid window, page, source, or search
        '401':
          $ref: '#/components/responses/UnauthorizedManagement'
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '503':
          description: Too many analytics reads in flight; retry after Retry-After seconds
  /credits/customers:
    get:
      tags:
      - Customers
      summary: List the customer directory
      operationId: getCreditsCustomers
      description: Display data a tenant registered for the customers it attributes charges to (X-Locus-Attribution source and customerId), in creation order. Enterprise workspaces only.
      security:
      - dashboardSession: []
      - secretKey: []
      x-required-scopes:
      - tenant:read
      parameters:
      - name: source
        in: query
        schema:
          type: string
          maxLength: 128
        description: Only this product's entries, exactly as stored. Send it empty (source=) for entries with no product; omit it for every product.
      - name: cursor
        in: query
        schema:
          type: string
        description: nextCursor from the previous page.
      - name: limit
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 200
          default: 100
      responses:
        '200':
          description: Directory entries
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                - success
                - customers
                - nextCursor
                properties:
                  success:
                    type: boolean
                    const: true
                  customers:
                    type: array
                    items:
                      $ref: '#/components/schemas/CustomerDirectoryEntry'
                  nextCursor:
                    type:
                    - string
                    - 'null'
        '400':
          description: Invalid cursor, limit, or source
        '401':
          $ref: '#/components/responses/UnauthorizedManagement'
        '403':
          $ref: '#/components/responses/InsufficientScope'
    put:
      tags:
      - Customers
      summary: Name up to 50 customers
      operationId: putCreditsCustomers
      description: Upserts display data per (source, customerId). Charges keep only the ids, so a name can be corrected or removed later; the security audit records how many entries a write carried, never the entries themselves. The production edge rejects request bodies over 8 KiB, so send fewer entries when names or links are long. Enterprise workspaces only.
      security:
      - dashboardSession: []
      - secretKey: []
      x-required-scopes:
      - tenant:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - customers
              properties:
                customers:
                  type: array
                  minItems: 1
                  maxItems: 50
                  items:
                    $ref: '#/components/schemas/CustomerUpsert'
      responses:
        '200':
          description: Every entry was written
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                - success
                - upserted
                properties:
                  success:
                    type: boolean
                    const: true
                  upserted:
                    type: integer
        '400':
          description: An invalid entry, a duplicate (source, customerId), an unexpected key, or an empty or oversized batch; nothing is written
        '401':
          $ref: '#/components/responses/UnauthorizedManagement'
        '403':
          $ref: '#/components/responses/InsufficientScope'
  /credits/customers/remove:
    post:
      tags:
      - Customers
      summary: Forget up to 50 customers' names
      operationId: postCreditsCustomersRemove
      description: Deletes directory entries by (source, customerId). Charges are untouched; the dashboard shows the ids again. Enterprise workspaces only.
      security:
      - dashboardSession: []
      - secretKey: []
      x-required-scopes:
      - tenant:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - customers
              properties:
                customers:
                  type: array
                  minItems: 1
                  maxItems: 50
                  items:
                    $ref: '#/components/schemas/CustomerRef'
      responses:
        '200':
          description: How many of the named entries existed
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                - success
                - removed
                properties:
                  success:
                    type: boolean
                    const: true
                  removed:
                    type: integer
        '400':
          description: An invalid or duplicate entry, or an empty or oversized batch
        '401':
          $ref: '#/components/responses/UnauthorizedManagement'
        '403':
          $ref: '#/components/responses/InsufficientScope'
components:
  schemas:
    CustomerUpsert:
      type: object
      additionalProperties: false
      required:
      - customerId
      - name
      properties:
        source:
          type: string
          maxLength: 128
          default: ''
        customerId:
          type: string
          minLength: 1
          maxLength: 256
        name:
          type: string
          minLength: 1
          maxLength: 120
          description: Trimmed; no control characters.
        url:
          type:
          - string
          - 'null'
          maxLength: 512
          format: uri
          description: Absolute http(s) URL, stored exactly as sent.
        adminUrl:
          type:
          - string
          - 'null'
          maxLength: 512
          format: uri
          description: Absolute http(s) URL, stored exactly as sent.
    CustomerSpend:
      type: object
      additionalProperties: false
      required:
      - spenderId
      - source
      - customerId
      - name
      - url
      - adminUrl
      - usageUsdc
      - calls
      - providers
      - firstChargeAt
      - lastChargeAt
      properties:
        spenderId:
          type: string
          description: <URL-encoded source>/<customerId>; focuses analytics as initiator=customer:<spenderId>.
        source:
          type: string
        customerId:
          type: string
        name:
          type:
          - string
          - 'null'
        url:
          type:
          - string
          - 'null'
        adminUrl:
          type:
          - string
          - 'null'
        usageUsdc:
          type: string
        calls:
          type: integer
        providers:
          type: integer
        firstChargeAt:
          type: string
          format: date-time
        lastChargeAt:
          type: string
          format: date-time
    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
    CustomerRef:
      type: object
      additionalProperties: false
      required:
      - customerId
      properties:
        source:
          type: string
          maxLength: 128
          default: ''
          description: attribution.source; '' or omitted for charges tagged without one.
        customerId:
          type: string
          minLength: 1
          maxLength: 256
    CreditsTenantScope:
      type: string
      enum:
      - tenant:read
      - tenant:write
      - catalog:write
      - credits:move
      - credentials:manage
      - tokens:manage
      - payouts:manage
      - members:manage
      - widget:read
    CustomerDirectoryEntry:
      type: object
      additionalProperties: false
      required:
      - source
      - customerId
      - name
      - url
      - adminUrl
      - updatedAt
      properties:
        source:
          type: string
        customerId:
          type: string
        name:
          type: string
        url:
          type:
          - string
          - 'null'
        adminUrl:
          type:
          - string
          - 'null'
        updatedAt:
          type: string
          format: date-time
    AnalyticsCustomerSource:
      type: object
      additionalProperties: false
      required:
      - source
      - customers
      - usageUsdc
      - calls
      properties:
        source:
          type: string
        customers:
          type: integer
        usageUsdc:
          type: string
        calls:
          type: integer
  responses:
    InsufficientScope:
      description: The authenticated management credential lacks one or more required scopes
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InsufficientScopeError'
    UnauthorizedManagement:
      description: Missing, invalid, expired, or revoked management credential
  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.