PayWithLocus Hosted Workflows API

Tenant-private TypeScript Workflow definitions, immutable versions, bounded runs, artifacts, and recovery

GitHub OpenAPI

Operations 12

POST /credits/workflows/artifacts Upload a tenant-owned source or input artifact #
GET /credits/workflows/artifacts/{artifactId} Read a bounded tenant-owned artifact page #
POST /credits/workflows Create a tenant-private Workflow draft #
GET /credits/workflows/{workflowId} Get a Workflow draft and its recent validation/version history #
PUT /credits/workflows/{workflowId} Update a Workflow draft with optimistic concurrency #
POST /credits/workflows/{workflowId}/validate Structurally check or fixture-test an exact draft revision #
POST /credits/workflows/{workflowId}/versions Save an immutable checked Workflow version #
POST /credits/workflows/{workflowId}/runs Queue a bounded pilot or production run #
GET /credits/workflow-runs List tenant-owned Workflow runs #
GET /credits/workflow-runs/{runId} Inspect durable run state, metering, receipts, and artifact references #
POST /credits/workflow-runs/{runId}/cancel Stop new dispatch and request sandbox termination #
POST /credits/workflow-runs/{runId}/resume Resume eligible unfinished work with current authorization #

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-hosted-workflows-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-hosted-workflows-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Locus Pro Hosted Workflows 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: Hosted Workflows
  description: Tenant-private TypeScript Workflow definitions, immutable versions, bounded runs, artifacts, and recovery
paths:
  /credits/workflows/artifacts:
    post:
      tags:
      - Hosted Workflows
      summary: Upload a tenant-owned source or input artifact
      operationId: postCreditsWorkflowsArtifacts
      description: Accepts authenticated JSON content up to the configured artifact ceiling. It never fetches caller-supplied URLs.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - kind
              - content
              properties:
                kind:
                  type: string
                  enum:
                  - source
                  - input
                content: {}
              additionalProperties: false
      responses:
        '201':
          description: Tenant-scoped artifact metadata
        '400':
          description: Invalid or oversized artifact
        '403':
          description: Hosted Workflows unavailable or unauthorized
  /credits/workflows/artifacts/{artifactId}:
    get:
      tags:
      - Hosted Workflows
      summary: Read a bounded tenant-owned artifact page
      operationId: getCreditsWorkflowsArtifactsByArtifactId
      description: Returns metadata and one bounded content page of an artifact owned by the calling account. Use cursor and max_characters to page through large artifacts. Returns 404 for artifacts owned by another account.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - name: artifactId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: cursor
        in: query
        schema:
          type: string
          maxLength: 500
      - name: max_characters
        in: query
        schema:
          type: integer
          minimum: 1024
          maximum: 20000
          default: 20000
      responses:
        '200':
          description: Artifact metadata and content page
        '404':
          description: Artifact is not owned by this account
  /credits/workflows:
    post:
      tags:
      - Hosted Workflows
      summary: Create a tenant-private Workflow draft
      operationId: postCreditsWorkflows
      description: Creates a private Workflow draft for the calling account from a source bundle. The draft is not runnable until it is checked and saved as an immutable version.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowCreateRequest'
      responses:
        '201':
          $ref: '#/components/responses/WorkflowObject'
        '400':
          description: Invalid source bundle
        '403':
          description: Hosted Workflows unavailable or unauthorized
  /credits/workflows/{workflowId}:
    get:
      tags:
      - Hosted Workflows
      summary: Get a Workflow draft and its recent validation/version history
      operationId: getCreditsWorkflowsByWorkflowId
      description: Returns a Workflow draft owned by the calling account, with its recent validation and version history. Returns 404 for Workflows owned by another account.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowId'
      responses:
        '200':
          $ref: '#/components/responses/WorkflowObject'
        '404':
          description: Workflow not found for this account
    put:
      tags:
      - Hosted Workflows
      summary: Update a Workflow draft with optimistic concurrency
      operationId: putCreditsWorkflowsByWorkflowId
      description: Replaces the source of a Workflow draft. expected_revision must equal the current draft revision; otherwise the update fails with 409 and nothing changes.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - expected_revision
              - source
              properties:
                expected_revision:
                  type: integer
                  minimum: 1
                source:
                  $ref: '#/components/schemas/WorkflowSource'
              additionalProperties: false
      responses:
        '200':
          $ref: '#/components/responses/WorkflowObject'
        '409':
          description: Draft revision conflict
  /credits/workflows/{workflowId}/validate:
    post:
      tags:
      - Hosted Workflows
      summary: Structurally check or fixture-test an exact draft revision
      operationId: postCreditsWorkflowsByWorkflowIdValidate
      description: check does not evaluate user code. fixtures runs in the fixed sandbox without live gateway authority or egress.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - revision
              - mode
              properties:
                revision:
                  type: integer
                  minimum: 1
                mode:
                  type: string
                  enum:
                  - check
                  - fixtures
                fixture_set:
                  type: string
                  maxLength: 120
              additionalProperties: false
      responses:
        '200':
          description: Durable validation evidence
        '409':
          description: Draft revision changed
  /credits/workflows/{workflowId}/versions:
    post:
      tags:
      - Hosted Workflows
      summary: Save an immutable checked Workflow version
      operationId: postCreditsWorkflowsByWorkflowIdVersions
      description: Saves the checked draft revision as an immutable Workflow version and returns its identity and validation evidence. The named revision must have passed its exact-revision check; otherwise the request fails with 409.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - revision
              properties:
                revision:
                  type: integer
                  minimum: 1
              additionalProperties: false
      responses:
        '201':
          description: Immutable version identity and validation evidence
        '409':
          description: Successful exact-revision check required
  /credits/workflows/{workflowId}/runs:
    post:
      tags:
      - Hosted Workflows
      summary: Queue a bounded pilot or production run
      operationId: postCreditsWorkflowsByWorkflowIdRuns
      description: The run is a constrained child of the current connection and does not create another client or reusable credential.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowRunRequest'
      responses:
        '200':
          description: Idempotent replay of the original run
        '202':
          $ref: '#/components/responses/WorkflowRunObject'
        '409':
          description: Idempotency or saved-version conflict
  /credits/workflow-runs:
    get:
      tags:
      - Hosted Workflows
      summary: List tenant-owned Workflow runs
      operationId: getCreditsWorkflowRuns
      description: Lists the calling account's Workflow runs as bounded summaries with a continuation cursor.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - name: limit
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 25
      - name: cursor
        in: query
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Bounded run summaries and continuation cursor
  /credits/workflow-runs/{runId}:
    get:
      tags:
      - Hosted Workflows
      summary: Inspect durable run state, metering, receipts, and artifact references
      operationId: getCreditsWorkflowRunsByRunId
      description: Returns the durable state of one Workflow run, including metering, receipts, and artifact references. Returns 404 for runs owned by another account.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowRunId'
      responses:
        '200':
          $ref: '#/components/responses/WorkflowRunObject'
        '404':
          description: Run not found for this account
  /credits/workflow-runs/{runId}/cancel:
    post:
      tags:
      - Hosted Workflows
      summary: Stop new dispatch and request sandbox termination
      operationId: postCreditsWorkflowRunsByRunIdCancel
      description: Stops dispatching new work for the run and requests termination of its sandbox. Returns the updated run.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowRunId'
      responses:
        '200':
          $ref: '#/components/responses/WorkflowRunObject'
  /credits/workflow-runs/{runId}/resume:
    post:
      tags:
      - Hosted Workflows
      summary: Resume eligible unfinished work with current authorization
      operationId: postCreditsWorkflowRunsByRunIdResume
      description: Resumes a run's eligible unfinished work using the caller's current authorization. Returns 202 with the run, or 409 when the run cannot be resumed.
      security:
      - secretKey: []
      - sandboxKey: []
      - endUserToken: []
      - agentConnection: []
      parameters:
      - $ref: '#/components/parameters/WorkflowRunId'
      responses:
        '202':
          $ref: '#/components/responses/WorkflowRunObject'
        '409':
          description: Run is not resumable
components:
  responses:
    WorkflowObject:
      description: Tenant-scoped Workflow definition envelope
      content:
        application/json:
          schema:
            type: object
            required:
            - success
            - workflow
            properties:
              success:
                const: true
              workflow:
                type: object
                additionalProperties: true
            additionalProperties: false
    WorkflowRunObject:
      description: Tenant-scoped durable Workflow run envelope
      content:
        application/json:
          schema:
            type: object
            required:
            - success
            - run
            properties:
              success:
                const: true
              replay:
                type: boolean
              run:
                type: object
                additionalProperties: true
            additionalProperties: false
  parameters:
    WorkflowId:
      name: workflowId
      in: path
      required: true
      schema:
        type: string
        format: uuid
    WorkflowRunId:
      name: runId
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    WorkflowSource:
      oneOf:
      - type: object
        required:
        - files
        properties:
          files:
            type: array
            minItems: 1
            maxItems: 64
            items:
              $ref: '#/components/schemas/WorkflowFile'
        additionalProperties: false
      - type: object
        required:
        - artifact_id
        properties:
          artifact_id:
            type: string
            format: uuid
        additionalProperties: false
    WorkflowRunRequest:
      type: object
      required:
      - version
      - mode
      - max_charge_credits
      - idempotency_key
      properties:
        version:
          type: integer
          minimum: 1
        input:
          type: object
          additionalProperties: true
        input_artifact_id:
          type: string
          format: uuid
        mode:
          type: string
          enum:
          - pilot
          - run
        max_charge_credits:
          $ref: '#/components/schemas/DecimalString'
        max_rows:
          type: integer
          minimum: 1
          maximum: 10000
        idempotency_key:
          type: string
          minLength: 1
          maxLength: 200
      additionalProperties: false
    WorkflowFile:
      type: object
      required:
      - path
      - content
      properties:
        path:
          type: string
          minLength: 1
        content:
          type: string
      additionalProperties: false
    WorkflowCreateRequest:
      type: object
      required:
      - source
      properties:
        source:
          $ref: '#/components/schemas/WorkflowSource'
        idempotency_key:
          type: string
          minLength: 1
          maxLength: 200
      additionalProperties: false
    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.
  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.