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

# Rerun an interaction

> Regenerate ``interaction_id`` on the thread against the agent's live
version, then replay ``text`` onto the resulting new thread. The response's
``thread_id`` is the new thread's id, not the original.



## OpenAPI

````yaml https://api-v3.aui.io/apollo-api/openapi.json post /messaging/v1/threads/{threadId}/rerun
openapi: 3.1.0
info:
  title: Apollo API
  description: >-
    Build conversational experiences on your agents and manage them
    programmatically.


    The API has two surfaces:


    - **Messaging** (`/messaging/v1`) — send end-user messages to your agent and
    read conversations back. Replies are available as a single JSON response, a
    Server-Sent Events token stream (`POST /messaging/v1/messages/stream`), or a
    bidirectional WebSocket session (see the companion AsyncAPI document at
    `/asyncapi.yaml`).

    - **Management** (`/management/v1`) — manage agents, their versions,
    projects, and conversation threads.


    **Authentication** — exchange your publishable key for a short-lived access
    token at `POST /management/v1/auth/token`, then send it as `Authorization:
    Bearer <access_token>`. Management endpoints also accept an organization API
    key via the `x-organization-api-key` header.


    **Errors** — every failure returns `{"error": {"code", "message",
    "request_id", "details"}}`. Branch on the stable `code`; include
    `request_id` when contacting support.
  version: 0.1.0
servers:
  - url: https://api-v3.aui.io/apollo-api
security: []
tags:
  - name: Auth
    description: >-
      Exchange a credential for a short-lived access token — start here. Send
      the token as `Authorization: Bearer <access_token>` on every other
      endpoint (management endpoints also accept an organization API key via the
      `x-organization-api-key` header).
  - name: Messaging
    description: >-
      Talk to your agent: send end-user messages (JSON reply or SSE token
      stream), rerun an interaction, and read a conversation's messages and
      reasoning traces. Threads are created automatically on the first message —
      pass the returned `thread_id` to continue a conversation.
  - name: Channels
    description: >-
      Reach end users on WhatsApp and SMS: send the opening message and bind the
      recipient's phone number to a conversation thread; replies flow through
      the same thread.
  - name: Threads
    description: >-
      Conversation threads: list and filter them, fetch one with its transcript
      and traces, and update its title.
  - name: Agents
    description: Create and manage the agents in a project.
  - name: Agent Versions
    description: >-
      An agent's configuration versions: list and inspect them, and publish a
      new live version.
  - name: Projects
    description: Projects group your agents within an organization.
  - name: Health
    description: Service liveness.
paths:
  /messaging/v1/threads/{threadId}/rerun:
    post:
      tags:
        - Messaging
      summary: Rerun an interaction
      description: >-
        Regenerate ``interaction_id`` on the thread against the agent's live

        version, then replay ``text`` onto the resulting new thread. The
        response's

        ``thread_id`` is the new thread's id, not the original.
      operationId: rerun
      parameters:
        - name: threadId
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
            title: Threadid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerunMessageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  schemas:
    RerunMessageRequest:
      properties:
        interaction_id:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          title: Interaction Id
        text:
          type: string
          minLength: 1
          title: Text
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: >-
            End user to attribute the rerun to; omitted, the thread's original
            user is kept.
        image_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Url
          description: Signed image URL on the replayed message.
        version_id:
          anyOf:
            - type: string
              pattern: ^[0-9a-fA-F]{24}$
            - type: 'null'
          title: Version Id
        version_tag:
          anyOf:
            - type: string
            - type: 'null'
          title: Version Tag
      additionalProperties: false
      type: object
      required:
        - interaction_id
        - text
      title: RerunMessageRequest
      description: >-
        Rerun an interaction: regenerate it on the thread against the agent's

        live version, then replay ``text`` onto the resulting new thread.

        ``version_id``/``version_tag`` optionally pin a specific version instead
        of

        the live one.
    SendMessageResponse:
      properties:
        thread_id:
          type: string
          title: Thread Id
          description: Thread the interaction belongs to
        message:
          $ref: '#/components/schemas/Message'
      type: object
      required:
        - thread_id
        - message
      title: SendMessageResponse
      description: >-
        Send/rerun reply plus the resolved thread id — the one the interaction
        landed

        on (newly created when the request omitted ``thread_id``).
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
      description: The single envelope every Apollo error response conforms to.
    Message:
      properties:
        id:
          type: string
          title: Id
          description: Interaction id, or message id for interaction-less messages
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: Creation timestamp (ISO-8601)
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
          description: Message text
        sender:
          anyOf:
            - $ref: '#/components/schemas/MessageParty'
            - type: 'null'
        receiver:
          anyOf:
            - $ref: '#/components/schemas/MessageParty'
            - type: 'null'
        cards:
          items:
            $ref: '#/components/schemas/MessageCard'
          type: array
          title: Cards
          description: Rendered cards
        welcome_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Welcome Message
          description: Agent's opening message, if this is one
        followup_suggestions:
          items:
            type: string
          type: array
          title: Followup Suggestions
          description: Suggested follow-up prompts
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: Originating page URL
        input_tokens:
          type: integer
          title: Input Tokens
          description: Prompt tokens
          default: 0
        output_tokens:
          type: integer
          title: Output Tokens
          description: Completion tokens
          default: 0
      type: object
      required:
        - id
      title: Message
      description: One message in a thread transcript.
    ErrorBody:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable, namespaced machine code clients branch on (e.g. "not_found"
            or "agents.not_found"). THE branch point -- open/extensible,
            append-only.
        message:
          type: string
          title: Message
          description: >-
            Human-readable explanation. NOT part of the contract; may change
            anytime. Clients must never parse or branch on this.
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
          description: Trace id for support correlation.
        details:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            - type: 'null'
          title: Details
          description: Optional structured sub-errors (e.g. per-field validation failures).
      type: object
      required:
        - code
        - message
      title: ErrorBody
      description: |-
        The error body an end user receives when interacting with Apollo.

        ``code`` is the stable, machine-readable branch point clients switch on.
        ``message`` is human-readable and explicitly NOT part of the contract --
        it may change at any time and must never be parsed.
    MessageParty:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
      type: object
      title: MessageParty
    MessageCard:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        rendered_jsx:
          anyOf:
            - type: string
            - type: 'null'
          title: Rendered Jsx
        is_recommended:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Recommended
        index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Index
      type: object
      title: MessageCard
    ErrorDetail:
      properties:
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
        message:
          type: string
          title: Message
      type: object
      required:
        - message
      title: ErrorDetail
      description: A single structured sub-error (e.g. one field's validation failure).
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Access token from `POST /management/v1/auth/token` (publishable-key
        exchange) or a login session. Publishable-key tokens are agent-scoped
        and serve the messaging surface; login tokens also serve management.

````