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

# Create an agent run

> Starts an asynchronous run with uploaded files, a user message, or both.
OAuth tokens require the runs:write scope. In addition to the credential
limit, this operation is limited to 30 requests per 60 seconds per agent.




## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v1/agents/{agent_id}/run
openapi: 3.1.0
info:
  title: Fluent API
  version: 1.0.0
  summary: Run Fluent agents and access connected data.
  description: |
    The public Fluent API powers the CLI and customer integrations.
    Most successful responses wrap their payload in a data property. Errors
    contain detail and status properties without that envelope.
servers:
  - url: https://www.fluenterp.com
    description: Production
security:
  - ApiKey: []
  - BearerCredential: []
tags:
  - name: Discovery
    description: Find the API, its scopes, and its policies without a credential.
  - name: Agents
    description: Discover agents and prepare their input files.
  - name: Runs
    description: Start and monitor asynchronous agent runs.
  - name: Documents
    description: Read, process, and delete documents produced by agents.
  - name: Connections
    description: Discover connected systems and read their records.
  - name: Databases
    description: Discover queryable databases and schemas.
  - name: Tables
    description: Read records from a queryable table.
  - name: Queries
    description: Run queries against accessible databases.
  - name: Utilities
    description: Search the web and manage conversation resources.
  - name: MCP
    x-group: Model Context Protocol
    description: Connect an external MCP client to an agent's tools.
paths:
  /api/v1/agents/{agent_id}/run:
    post:
      tags:
        - Runs
      summary: Create an agent run
      description: >
        Starts an asynchronous run with uploaded files, a user message, or both.

        OAuth tokens require the runs:write scope. In addition to the credential

        limit, this operation is limited to 30 requests per 60 seconds per
        agent.
      operationId: createAgentRun
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRunRequest'
            examples:
              document:
                value:
                  files:
                    - file_key: agents/example/invoice.pdf
                      file_name: invoice.pdf
                      content_type: application/pdf
                  process_together: false
              text:
                value:
                  files: []
                  user_message: Summarize our open issues
      responses:
        '200':
          description: Run queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateRunEnvelope'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - ApiKey: []
        - BearerCredential: []
        - OAuth2:
            - runs:write
components:
  parameters:
    AgentId:
      name: agent_id
      in: path
      required: true
      description: Fluent agent ID.
      schema:
        type: string
        format: uuid
  schemas:
    CreateRunRequest:
      type: object
      additionalProperties: false
      properties:
        files:
          type: array
          maxItems: 50
          default: []
          items:
            $ref: '#/components/schemas/RunFile'
        user_message:
          type: string
          description: Instruction or text input for the agent.
        process_together:
          type: boolean
          default: false
          description: Process foreground files in one agent conversation.
        notification_email:
          type: string
          format: email
          description: Email to notify when processing finishes.
        background_files:
          type: array
          maxItems: 10
          description: Files available to tools but not read directly by the agent.
          items:
            $ref: '#/components/schemas/BackgroundFile'
      anyOf:
        - required:
            - files
          properties:
            files:
              minItems: 1
        - required:
            - user_message
          properties:
            user_message:
              minLength: 1
      if:
        required:
          - process_together
        properties:
          process_together:
            const: true
      then:
        properties:
          files:
            maxItems: 10
    CreateRunEnvelope:
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/CreateRun'
    RunFile:
      type: object
      additionalProperties: false
      required:
        - file_key
        - file_name
        - content_type
      properties:
        file_key:
          type: string
          minLength: 1
        file_name:
          type: string
          minLength: 1
        content_type:
          type: string
          minLength: 1
    BackgroundFile:
      type: object
      additionalProperties: false
      required:
        - file_key
        - file_name
      properties:
        file_key:
          type: string
          minLength: 1
        file_name:
          type: string
          minLength: 1
    CreateRun:
      type: object
      additionalProperties: false
      required:
        - run_id
        - workflow_run_id
        - status
        - status_url
        - message
      properties:
        run_id:
          type: string
          format: uuid
          description: Stable public run ID.
        workflow_run_id:
          type: string
          format: uuid
          deprecated: true
          description: Deprecated alias for run_id.
        status:
          $ref: '#/components/schemas/RunStatus'
        status_url:
          type: string
          format: uri
        message:
          type: string
    Error:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Human-readable failure detail.
        status:
          type: integer
          description: HTTP status code.
      additionalProperties: true
      example:
        detail: Agent not found
        status: 404
    RunStatus:
      type: string
      enum:
        - queued
        - running
        - completed
        - failed
        - cancelled
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, invalid, expired, or unsupported credential
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The credential lacks access or a required scope
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found or not visible to the caller
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded
      headers:
        RateLimit-Limit:
          description: Requests allowed in the current window.
          schema:
            type: integer
        RateLimit-Remaining:
          description: Requests remaining in the current window.
          schema:
            type: integer
        RateLimit-Reset:
          description: Seconds until the current window resets.
          schema:
            type: integer
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
        x-ratelimit-limit:
          description: Legacy alias of RateLimit-Limit.
          schema:
            type: integer
        x-ratelimit-remaining:
          description: Legacy alias of RateLimit-Remaining.
          schema:
            type: integer
        x-ratelimit-reset:
          description: |
            Unix timestamp (seconds) at which the current window resets. Unlike
            RateLimit-Reset, which is a delta.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: A Fluent API key beginning with fl-.
    BearerCredential:
      type: http
      scheme: bearer
      bearerFormat: Fluent API key or OAuth access token
      description: |
        A Fluent API key beginning with fl-, or an OAuth access token beginning
        with flpt_ on operations that support OAuth.
    OAuth2:
      type: oauth2
      description: |
        A Fluent OAuth access token beginning with flpt_, sent as a bearer
        credential. Tokens are granted only the scopes they request, and each
        operation below lists the scopes it requires.
      flows:
        authorizationCode:
          authorizationUrl: https://www.fluenterp.com/oauth/authorize
          tokenUrl: https://www.fluenterp.com/oauth/token
          refreshUrl: https://www.fluenterp.com/oauth/token
          scopes:
            agents:read: List the agents the credential's user can see.
            runs:read: Read agent runs and the documents they produce.
            runs:write: >-
              Upload files, create runs, process documents, and delete
              documents.

````