> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mercora.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Answer a run that waits for your system

> Hands a run whose Wait for step waits on another system what it waited for; the run carries on from there. 202 the run carries on, 404 no such run of this automation in this workspace, 409 the run isn't waiting for a callback (already answered, or past its time limit).

Scope: `automations`.



## OpenAPI

````yaml /api-reference/openapi.json post /agents/{id}/runs/{runId}/callback
openapi: 3.1.0
info:
  title: Mercora API
  version: v1
  description: >-
    Your own systems call Mercora with a workspace API key. Bodies are JSON with
    a fixed schema; unknown fields are refused. Errors are `{ error }`, plus
    `issues` on a 422. A create carries your own `external_id`: sending it again
    returns what was created the first time.
servers:
  - url: https://{workspace}.mercora.io/api/v1
    description: Your Mercora workspace
    variables:
      workspace:
        default: your-company
        description: Your workspace subdomain
security: []
tags:
  - name: Hedge requests
    description: >-
      Read the hedge books and positions, push hedge requests into the Inbox,
      read where they stand.
  - name: Automations
    description: >-
      Start runs of automations set to run from the API. What a run would change
      still waits for a person in Mercora.
paths:
  /agents/{id}/runs/{runId}/callback:
    post:
      tags:
        - Automations
      summary: Answer a run that waits for your system
      description: >-
        Hands a run whose Wait for step waits on another system what it waited
        for; the run carries on from there. 202 the run carries on, 404 no such
        run of this automation in this workspace, 409 the run isn't waiting for
        a callback (already answered, or past its time limit).


        Scope: `automations`.
      operationId: answerAutomationRun
      parameters:
        - schema:
            type: string
            description: The automation's id.
          required: true
          description: The automation's id.
          name: id
          in: path
        - schema:
            type: string
            description: The run's id, as the run request returned it.
          required: true
          description: The run's id, as the run request returned it.
          name: runId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationCallbackRequest'
            example:
              payload:
                fill_price: 2450
                lots: 10
      responses:
        '202':
          description: The run carries on.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationCallbackAccepted'
              example:
                id: 1c9e2f3a-4b5d-4e6f-9a0b-1c2d3e4f5a6b
        '400':
          description: Body is not JSON.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Key missing, unknown or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The key lacks the `automations` scope, or the resource's module is
            off for the workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such run of this automation in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The run isn't waiting for a callback.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Body failed its schema; `issues` lists each field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Ours, logged with the workspace and key. Retrying is safe.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    AutomationCallbackRequest:
      type: object
      properties:
        payload:
          type: object
          additionalProperties: {}
          description: >-
            What the run waited for. Its fields become the waiting step's
            values, which later steps pick by name.
      required:
        - payload
      additionalProperties: false
    AutomationCallbackAccepted:
      type: object
      properties:
        id:
          type: string
          description: The run's id.
      required:
        - id
    Error:
      type: object
      properties:
        error:
          type: string
        issues:
          type: array
          items:
            type: object
            properties:
              field:
                type:
                  - string
                  - 'null'
              message:
                type: string
            required:
              - field
              - message
          description: 'On a 422: one entry per field that failed.'
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A workspace API key (mk_…), made under Settings → Administration → API.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.