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

# Start a saved agent run

> Queue durable execution using the identical invocation contract. Poll Location, honoring Retry-After.

Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.

### Authorization

Requires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.

### Messages and conversation history

Send one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional message IDs follow native LangGraph replacement semantics, not request idempotency; retrying an invocation may run the agent again.

Conversations are stored in Omni sessions and checkpoints and isolated by organization, caller, credential, agent and audience. Uploaded HTTP(S) images belong on the latest user message.

audience=customer uses the public storefront tool boundary and accepts user/assistant messages. It does not establish a verified customer identity. audience=member is the default. Saved agents accept user/assistant messages and reject configuration overrides; general/invoke accepts config.

### Approvals

Send decisions instead of messages with the same thread_id and audience to resume approvals. Resolve pending approvals before sending new messages.



## OpenAPI

````yaml /openapi.json post /api/v1/agents/{agentId}/runs
openapi: 3.1.0
info:
  title: OmniCommerce API
  version: 1.0.0
  license:
    name: Proprietary
    url: https://omnicommerce.sg/terms
  description: >-
    OmniCommerce API surface for agents and developer integrations. Includes
    public endpoints (merchant discovery, product search, compare, catalog, ACO
    retrieval) and authenticated endpoints (product management via API key
    Bearer tokens).
servers:
  - url: https://omnicommerce.ai
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: ads
    description: ads
    x-group: Ads
  - name: agentic-checkout
    description: Merchant-fulfilled agentic checkout
    x-group: Agentic Checkout
  - name: agents
    description: agents
    x-group: Agents
  - name: analytics
    description: Sales performance across marketplaces
    x-group: Analytics
  - name: aops
    description: Agent operating procedures
    x-group: AOPs
  - name: bots
    description: bots
    x-group: Bots
  - name: branding
    description: branding
    x-group: Branding
  - name: campaigns
    description: Campaign briefs, offer windows, and marketplace runs
    x-group: Campaigns
  - name: catalog
    description: catalog
    x-group: Catalog
  - name: commerce
    description: commerce
    x-group: Commerce
  - name: developer-platform
    description: Authenticated developer platform APIs
    x-group: Developer Platform
  - name: documents
    description: Knowledge base document uploads
    x-group: Knowledge Base
  - name: email
    description: email
    x-group: Email
  - name: follow-ups
    description: follow-ups
    x-group: Follow Ups
  - name: inventory
    description: Inventory quantities, planning signals, and marketplace listing absence
    x-group: Inventory
  - name: looks
    description: AI-styled product looks
    x-group: Looks
  - name: oauth
    description: OAuth token endpoints
    x-group: OAuth
  - name: orders
    description: Workspace and agentic orders
    x-group: Orders
  - name: organizations
    description: Organization management
    x-group: Organizations
  - name: price-books
    description: Marketplace list-price markup rules
    x-group: Price Books
  - name: products
    description: Product CRUD, bulk import, enrichment, publish, and delist
    x-group: Products
  - name: promotions
    description: Central promotions and marketplace sync
    x-group: Promotions
  - name: public-agent
    description: Public agent discovery and catalog APIs
    x-group: Public Agent
  - name: returns
    description: returns
    x-group: Returns
  - name: review-queue
    description: review-queue
    x-group: Review Queue
  - name: reviews
    description: Marketplace product reviews and seller replies
    x-group: Reviews
  - name: scripts
    description: scripts
    x-group: Scripts
  - name: settlements
    description: settlements
    x-group: Settlements
  - name: ucp
    description: Universal Commerce Protocol
    x-group: UCP
  - name: wiki
    description: wiki
    x-group: Wiki
paths:
  /api/v1/agents/{agentId}/runs:
    post:
      tags:
        - agents
      summary: Start a saved agent run
      description: >-
        Queue durable execution using the identical invocation contract. Poll
        Location, honoring Retry-After.


        Invoke the exact built-in or custom agent in the URL using its saved
        configuration and Programmatic starting mode. Uses the same invocation
        request and run response as the general agent and MCP.


        ### Authorization


        Requires agents:invoke and current organization membership and agent
        access. Organization-owned keys use their recorded creator; no alternate
        organization member is substituted. Session requests include
        organizationId.


        ### Messages and conversation history


        Send one or more new messages (at most 50 and 100000 text characters)
        ending with a user message. Omit thread_id to create a conversation, or
        reuse the returned thread_id to continue its stored history. An initial
        batch can import external history, including human replies. Do not
        resend history on subsequent turns. Optional message IDs follow native
        LangGraph replacement semantics, not request idempotency; retrying an
        invocation may run the agent again.


        Conversations are stored in Omni sessions and checkpoints and isolated
        by organization, caller, credential, agent and audience. Uploaded
        HTTP(S) images belong on the latest user message.


        audience=customer uses the public storefront tool boundary and accepts
        user/assistant messages. It does not establish a verified customer
        identity. audience=member is the default. Saved agents accept
        user/assistant messages and reject configuration overrides;
        general/invoke accepts config.


        ### Approvals


        Send decisions instead of messages with the same thread_id and audience
        to resume approvals. Resolve pending approvals before sending new
        messages.
      operationId: post_v1_agents_by_agentid_runs
      parameters:
        - name: agentId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organizationId:
                  type: string
                  maxLength: 120
                thread_id:
                  anyOf:
                    - type: string
                      minLength: 1
                      maxLength: 200
                    - type: 'null'
                channel:
                  type: string
                  minLength: 1
                  maxLength: 64
                audience:
                  type: string
                  enum:
                    - member
                    - customer
                messages:
                  maxItems: 50
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                          - system
                      content:
                        anyOf:
                          - type: string
                            minLength: 1
                            maxLength: 100000
                          - minItems: 1
                            maxItems: 20
                            type: array
                            items:
                              oneOf:
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: text
                                    text:
                                      type: string
                                      minLength: 1
                                      maxLength: 100000
                                  required:
                                    - type
                                    - text
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: image
                                    url:
                                      type: string
                                      minLength: 1
                                      maxLength: 2048
                                    filename:
                                      type: string
                                      minLength: 1
                                      maxLength: 200
                                  required:
                                    - type
                                    - url
                                  additionalProperties: false
                      id:
                        type: string
                        maxLength: 200
                      name:
                        type: string
                        maxLength: 200
                    required:
                      - content
                    additionalProperties: false
                config:
                  type: object
                  properties:
                    enabled_tools:
                      maxItems: 100
                      type: array
                      items:
                        type: string
                        minLength: 1
                        maxLength: 128
                    model:
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 200
                        - type: 'null'
                    system_prompt:
                      type: string
                      maxLength: 20000
                    structured_output:
                      anyOf:
                        - type: object
                          propertyNames:
                            type: string
                          additionalProperties: {}
                        - type: 'null'
                  additionalProperties: false
                decisions:
                  maxItems: 20
                  type: array
                  items:
                    type: object
                    properties:
                      action:
                        type: string
                        enum:
                          - approve
                          - reject
                      reason:
                        type: string
                        maxLength: 2000
                    required:
                      - action
                    additionalProperties: false
              additionalProperties: false
            example:
              thread_id: whatsapp-123
              channel: whatsapp
              audience: customer
              messages:
                - id: wamid.123
                  role: user
                  content: Can you deliver tomorrow?
      responses:
        '202':
          description: Queued for durable execution.
          content:
            application/json:
              schema:
                type: object
                properties:
                  run_id:
                    type: string
                  thread_id:
                    type: string
                  status:
                    type: string
                    enum:
                      - queued
                      - running
                      - completed
                      - awaiting_approval
                      - failed
                  messages:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - human
                            - ai
                            - tool
                            - system
                        role:
                          type: string
                          enum:
                            - user
                            - assistant
                            - tool
                            - system
                        content:
                          type: string
                        id:
                          type: string
                        name:
                          type: string
                        tool_calls:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                              args: {}
                            required:
                              - name
                              - args
                            additionalProperties: false
                        tool_call_id:
                          type: string
                        memory_sources:
                          maxItems: 3
                          type: array
                          items:
                            type: object
                            properties:
                              title:
                                type: string
                                minLength: 1
                                maxLength: 160
                              href:
                                type: string
                                format: starts_with
                                pattern: ^\/app\/.*
                              stale:
                                type: boolean
                            required:
                              - title
                              - href
                              - stale
                            additionalProperties: false
                      required:
                        - type
                        - role
                        - content
                      additionalProperties: false
                  structured_output:
                    anyOf:
                      - type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      - type: 'null'
                  approvals:
                    anyOf:
                      - type: array
                        items:
                          type: object
                          properties:
                            interrupt_instance_id:
                              type: string
                            tool_name:
                              type:
                                - string
                                - 'null'
                            tool_args: {}
                            message:
                              type: string
                          required:
                            - interrupt_instance_id
                            - tool_name
                            - tool_args
                            - message
                          additionalProperties: false
                      - type: 'null'
                  error:
                    type:
                      - string
                      - 'null'
                required:
                  - run_id
                  - thread_id
                  - status
                  - messages
                  - structured_output
                  - approvals
                  - error
                additionalProperties: false
          headers:
            Retry-After:
              description: Seconds before polling again.
              schema:
                type: integer
                minimum: 1
            Location:
              description: Caller-scoped run status URL.
              schema:
                type: string
                format: uri-reference
        '400':
          description: >-
            Invalid invocation, configuration override for a saved agent, or
            organization mismatch.
        '401':
          description: Authentication required.
        '402':
          description: Insufficient AI credits.
        '403':
          description: >-
            Missing agents:invoke scope, inactive agent or credential, or
            missing membership or agent access.
        '404':
          description: The conversation or run is not available to this caller and agent.
        '409':
          description: The thread has an active run or an unresolved approval.
        '500':
          description: The agent run failed.
        '504':
          description: The waiting request timed out. The error includes the stored run ID.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer API key for server-to-server access. Session auth is also
        supported in first-party UI flows.

````

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