PayWithLocus Tasks API

Delegate a multi-step outcome to Locus with one goal string. Locus compiles an acceptance contract, discovers and calls enabled catalog capabilities with the caller's own credits and spending controls, checks every returned value against stored provider evidence, and returns structured results, files, requirement statuses, and settled cost. Enabled when the deployment sets LOCUS_TASKS_ENABLED.

GitHub OpenAPI

Operations 2

POST /credits/tasks Run a task from a goal (submit, wait, cancel, respond, resume) #
GET /credits/tasks/artifacts/{token} Download a task artifact #

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-tasks-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-tasks-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Locus Pro Tasks 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: Tasks
  description: Delegate a multi-step outcome to Locus with one goal string. Locus compiles an acceptance contract, discovers and calls enabled catalog capabilities with the caller's own credits and spending controls, checks every returned value against stored provider evidence, and returns structured results, files, requirement statuses, and settled cost. Enabled when the deployment sets LOCUS_TASKS_ENABLED.
paths:
  /credits/tasks:
    post:
      tags:
      - Tasks
      summary: Run a task from a goal (submit, wait, cancel, respond, resume)
      operationId: postCreditsTasks
      description: The single task interface. Without `action`, starts a task from a natural-language goal and waits up to `wait_seconds` for the result. With `action` wait/status/cancel/respond/resume it continues the same task; repeating wait or status never starts or charges anything. Locus discovers capabilities in the caller's enabled catalog, calls them with the caller's credits and spending controls, verifies values against stored provider responses, and computes the terminal state in code. It never sends messages, purchases, writes, or deletes on the caller's behalf. Accepts secret keys and agent connections (MCP OAuth connections use the run_task MCP tool).
      security:
      - secretKey: []
      - agentConnection: []
      parameters:
      - name: Idempotency-Key
        in: header
        required: false
        schema:
          type: string
          maxLength: 200
        description: Alternative to the body idempotency_key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRequest'
            examples:
              goal_only:
                value:
                  goal: Find 10 Series A hardware companies based in Los Angeles, California. Verify their funding, identify the founders and their verified work emails, and return a CSV.
              with_inputs:
                value:
                  goal: Read the supplied pages and compare their stated rate limits. Return a table with source links.
                  inputs:
                    urls:
                    - https://docs.anthropic.com/en/api/rate-limits
                    - https://platform.openai.com/docs/guides/rate-limits
                  output:
                    format: json
                  max_credits: 800
                  idempotency_key: 7d0c1b9e-2f7c-4d0e-9a59-0d6a1c2b3e4f
              wait:
                value:
                  action: wait
                  task_id: 6be8d9cc-e44e-48f9-af6f-fae0aa5bb160
                  wait_seconds: 50
              resume:
                value:
                  action: resume
                  task_id: 6be8d9cc-e44e-48f9-af6f-fae0aa5bb160
                  max_credits: 3000
      responses:
        '200':
          description: Terminal or needs_input envelope (or an idempotent replay of one).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskEnvelope'
        '202':
          description: Still running; call again with action wait and the task_id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskEnvelope'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskError'
        '401':
          description: Missing or invalid credential.
        '403':
          description: Credential cannot delegate tasks (sandbox keys and end-user tokens).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskError'
        '404':
          description: Unknown task for this tenant and account, or tasks are disabled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskError'
        '409':
          description: Idempotency key reused with a different request, or a respond/resume the task is not waiting for.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskError'
        '429':
          description: The account already has 5 tasks queued or running; wait for one to finish or cancel one.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskError'
  /credits/tasks/artifacts/{token}:
    get:
      tags:
      - Tasks
      summary: Download a task artifact
      operationId: getCreditsTasksArtifactsByToken
      description: Signed, short-lived download of one task file (results.csv, results.json, results.md, answer.md, evidence.json). The token binds tenant, account, task, artifact, and exact bytes; use the download_url from the task envelope.
      security: []
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: File bytes with the artifact media type; compare their SHA-256 with the envelope's sha256.
          content:
            text/csv:
              schema:
                type: string
            application/json:
              schema:
                type: object
            text/markdown:
              schema:
                type: string
        '404':
          description: Unknown or tampered link.
        '410':
          description: Link expired; fetch status for a fresh link.
components:
  schemas:
    TaskSubmitRequest:
      type: object
      additionalProperties: false
      required:
      - goal
      properties:
        action:
          type: string
          enum:
          - submit
          description: Optional; omitted means submit.
        goal:
          type: string
          minLength: 1
          maxLength: 8000
          description: The outcome you want, in natural language.
        inputs:
          type: object
          additionalProperties: true
          description: Optional caller data or references (for example urls, ids, rows). Treated as data, never as instructions. Max 256 KiB.
        output:
          type: object
          additionalProperties: false
          properties:
            format:
              type: string
              enum:
              - csv
              - json
              - markdown
            columns:
              type: array
              maxItems: 60
              items:
                type: string
                maxLength: 80
              description: Required column names, in order.
            instructions:
              type: string
              maxLength: 2000
        max_credits:
          oneOf:
          - type: string
          - type: number
          description: 'Credit ceiling for the whole task, including model reasoning and verification. In credits, not USD. It is not a price: the task is charged only for what it uses, and most tasks use well under 1 USD worth. Leave unset for the default 5 USD worth of credits. A low cap stops the task early, since part of it is held back to check the result; min 0.10 USD worth, max 200 USD worth; never above the account''s own spending controls. A task that stops with stop_reason budget_exhausted can be resumed with a higher max_credits.'
        deadline_seconds:
          type: integer
          minimum: 180
          maximum: 3600
          description: Seconds from submission (time queued counts) until the task stops and delivers what it verified. Leave unset for the default 900, which suits most tasks. This is not how long the request waits (see wait_seconds). The last two minutes or so go to delivering and checking the result, so a short deadline leaves the task little time to work.
        idempotency_key:
          type: string
          maxLength: 200
          description: Reuse to retry a submission safely; the same key with the same request returns the original task, with a different request it returns 409. The Idempotency-Key header is accepted too. Without a key every submission starts a new task, even with identical text.
        wait_seconds:
          type: integer
          minimum: 0
          maximum: 50
          description: Seconds to hold the request open for a result (default 45). The task keeps running after the response.
    TaskRequirement:
      type: object
      required:
      - id
      - text
      - status
      - mandatory
      - detail
      properties:
        id:
          type: string
        text:
          type: string
        status:
          type: string
          enum:
          - met
          - unmet
          - not_checked
        mandatory:
          type: boolean
        detail:
          type: string
    TaskControlRequest:
      oneOf:
      - type: object
        additionalProperties: false
        required:
        - action
        - task_id
        properties:
          action:
            type: string
            enum:
            - wait
          task_id:
            type: string
            format: uuid
          wait_seconds:
            type: integer
            minimum: 0
            maximum: 50
            description: Seconds to hold the request open for a result (default 45). The task keeps running after the response.
      - type: object
        additionalProperties: false
        required:
        - action
        - task_id
        properties:
          action:
            type: string
            enum:
            - status
          task_id:
            type: string
            format: uuid
      - type: object
        additionalProperties: false
        required:
        - action
        - task_id
        properties:
          action:
            type: string
            enum:
            - cancel
          task_id:
            type: string
            format: uuid
      - type: object
        additionalProperties: false
        required:
        - action
        - task_id
        - answer
        properties:
          action:
            type: string
            enum:
            - respond
          task_id:
            type: string
            format: uuid
          answer:
            type: string
            maxLength: 4000
          wait_seconds:
            type: integer
            minimum: 0
            maximum: 50
            description: Seconds to hold the request open for a result (default 45). The task keeps running after the response.
      - type: object
        additionalProperties: false
        required:
        - action
        - task_id
        properties:
          action:
            type: string
            enum:
            - resume
          task_id:
            type: string
            format: uuid
          max_credits:
            oneOf:
            - type: string
            - type: number
            description: Credit ceiling for the whole task, including model reasoning and verification. In credits, not USD. Default 5 USD worth of credits, min 0.10 USD worth, max 200 USD worth; never above the account's own spending controls.
          wait_seconds:
            type: integer
            minimum: 0
            maximum: 50
            description: Seconds to hold the request open for a result (default 45). The task keeps running after the response.
      discriminator:
        propertyName: action
    TaskError:
      type: object
      required:
      - success
      - code
      - message
      properties:
        success:
          type: boolean
          enum:
          - false
        code:
          type: string
          examples:
          - TASK_REQUEST_INVALID
          - TASKS_DISABLED
          - TASK_AUTH_UNSUPPORTED
          - TASK_NOT_FOUND
          - TASK_IDEMPOTENCY_CONFLICT
          - TASK_BUDGET_INVALID
          - TASK_INPUTS_TOO_LARGE
          - TASK_NOT_WAITING_FOR_INPUT
          - TASK_NOT_RESUMABLE
          - TASK_CONCURRENCY_LIMIT
        message:
          type: string
    TaskArtifact:
      type: object
      required:
      - artifact_id
      - name
      - kind
      - media_type
      - sha256
      - expires_at
      - download_url
      - link_expires_at
      properties:
        artifact_id:
          type: string
          format: uuid
        name:
          type: string
          examples:
          - results.csv
          - results.json
          - results.md
          - answer.md
          - evidence.json
        kind:
          type: string
          enum:
          - result
          - evidence
        media_type:
          type: string
        size_bytes:
          type:
          - integer
          - 'null'
        sha256:
          type: string
        expires_at:
          type: string
          format: date-time
          description: When the stored file is deleted (7 days).
        download_url:
          type: string
          format: uri
          description: Signed link bound to this tenant, account, task, and exact bytes; no Authorization header needed.
        link_expires_at:
          type: string
          format: date-time
          description: Link lifetime (1 hour); call status again for a fresh link.
    TaskEnvelope:
      type: object
      required:
      - object
      - version
      - task_id
      - status
      - terminal
      - cost
      properties:
        object:
          type: string
          enum:
          - task
        version:
          type: string
          enum:
          - locus.task.v1
        task_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
          - queued
          - running
          - needs_input
          - completed
          - partial
          - unsupported
          - failed
          - canceled
          description: completed = every mandatory requirement met by checks; partial = useful verified subset; needs_input = answer `question` with action respond; unsupported = no enabled capability can do it; failed = nothing usable; canceled = caller canceled.
        terminal:
          type: boolean
        stop_reason:
          type:
          - string
          - 'null'
          enum:
          - completed
          - count_shortfall
          - requirements_unmet
          - budget_exhausted
          - insufficient_credits
          - deadline
          - canceled
          - needs_input
          - no_capability
          - no_progress
          - step_limit
          - authorization_revoked
          - execution_error
          - null
        goal:
          type: string
        question:
          type: string
          description: Present when status is needs_input.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        completed_at:
          type:
          - string
          - 'null'
          format: date-time
        deadline_at:
          type: string
          format: date-time
        progress:
          type: object
          properties:
            phase:
              type: string
            turns:
              type: integer
            paid_calls:
              type: integer
            last_event:
              type:
              - object
              - 'null'
              properties:
                type:
                  type: string
                at:
                  type: string
                  format: date-time
        result:
          type:
          - object
          - 'null'
          properties:
            summary:
              type:
              - string
              - 'null'
              description: States only what Locus's checks established (verified counts, unmet requirements, stop reason).
            executor_summary:
              type:
              - string
              - 'null'
              description: The executor's own account of the work; not verified.
            data:
              type:
              - object
              - 'null'
              properties:
                columns:
                  type: array
                  items:
                    type: string
                rows:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                row_count:
                  type: integer
                group_count:
                  type: integer
                truncated:
                  type: boolean
            answer:
              type:
              - string
              - 'null'
              description: Markdown answer for answer-type goals (every claim is cited), or, when the goal asks for a Markdown table, the delivered table as one Markdown table under the caller's column headers (first 200 rows; results.md has all).
            unverified_rows:
              type: array
              description: Table rows the executor recorded as qualified that failed verification, with their recorded values and why each was withheld (up to 25). Not part of data and not counted as delivered.
              items:
                type: object
                properties:
                  values:
                    type: object
                    additionalProperties: true
                  reasons:
                    type: array
                    items:
                      type: string
        artifacts:
          type: array
          items:
            $ref: '#/components/schemas/TaskArtifact'
        requirements:
          type: array
          items:
            $ref: '#/components/schemas/TaskRequirement'
        assumptions:
          type: array
          items:
            type: string
        limitations:
          type: array
          items:
            type: string
        cost:
          type: object
          required:
          - unit
          - max_credits
          - charged_credits
          - reserved_credits
          - accounting_state
          properties:
            unit:
              type: string
              enum:
              - credits
            max_credits:
              type: string
            charged_credits:
              type: string
              description: Settled charges so far, net of refunds. A task whose first outcome delivers nothing gets its model credits back above a 0.01 USD base charge, up to a monthly limit per account; limitations says what was refunded.
            reserved_credits:
              type: string
              description: Held for in-flight or unknown-outcome calls; released or captured on reconciliation.
            tool_credits:
              type: string
            model_credits:
              type: string
            paid_calls:
              type: integer
            accounting_state:
              type: string
              enum:
              - in_progress
              - settled
              - pending_reconciliation
        error:
          type: object
          description: Present when the run recorded an execution error.
          properties:
            code:
              type: string
            message:
              type:
              - string
              - 'null'
        continuation:
          type:
          - object
          - 'null'
          properties:
            action:
              type: string
              enum:
              - wait
              - respond
              - resume
            task_id:
              type: string
              format: uuid
            hint:
              type: string
    TaskRequest:
      oneOf:
      - $ref: '#/components/schemas/TaskSubmitRequest'
      - $ref: '#/components/schemas/TaskControlRequest'
  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.