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

# Page the messages of a thread

> By `seq`: `before` for older pages, `after` for only what is newer (not both).



## OpenAPI

````yaml GET /v1/workspaces/{wid}/threads/{tid}/messages
openapi: 3.0.0
info:
  title: Devic.ai Public API
  description: >-
    Devic.ai is an AI platform that allows you to create, manage, and use AI
    agents for various tasks.
  version: 1.0.0
  contact:
    name: Devic.ai Support
    url: https://devic.ai
  x-logo:
    url: https://devic.ai/logo.png
    altText: Devic.ai Logo
  x-summary: Public API for interacting with Devic.ai platform
servers:
  - url: https://api.devic.ai
    description: Production server
  - url: https://staging-api.devic.ai
    description: Staging server
security:
  - bearerAuth: []
tags:
  - name: Environments
    description: >-
      The machine an agent works on and everything it may reach: sandbox,
      snapshot, knowledge, tools and encrypted variables
  - name: Sandboxes
    description: >-
      Start a real Linux machine on an environment, run commands and files on
      it, and save its snapshot
  - name: Projects
    description: Group agents, assistants, documents and costs into projects
  - name: Documents
    description: >-
      Knowledge base documents: create, version, attach and index markdown
      content for RAG
  - name: Document Folders
    description: Organise knowledge base documents into folders and attach them in bulk
  - name: Files
    description: Upload files and obtain shareable download URLs to attach to messages
  - name: Agents
    description: Endpoints related to AI agents and their operations
  - name: Assistants
    description: Endpoints for interacting with assistants and their specializations
  - name: Tool Servers
    description: Endpoints for managing tool servers and their tool definitions
  - name: Health
    description: API health check endpoints
  - name: Documentation
    description: Endpoints for retrieving markdown documentation
  - name: Integrations
    description: Connect third-party apps and turn them into tools
  - name: Triggers
    description: Start an agent or an assistant from an app event
  - name: Tenant Integrations
    description: Apps that each end user connects for themselves
  - name: Memory
    description: What an assistant remembers between conversations
  - name: Skills
    description: Reusable instruction packs for agents and assistants
  - name: Speech to Text
    description: Audio transcription
  - name: Tenants
    description: Tenants, subtenants and their usage
  - name: MCP Gateway
    description: One MCP endpoint over many servers, with visibility per user
  - name: Tenant Sessions
    description: Tokens that prove which end user is calling
  - name: Workspaces
    description: Shared spaces where people and assistants work in threads
  - name: Workspace Threads
    description: Threads, messages, read state and assistant runs
  - name: Workspace Files
    description: Files and documents of workspaces and threads
  - name: Workspace Configuration
    description: Members, assistants, knowledge, skills and rules
  - name: Workspace Memory
    description: Core memory of the assistants of a workspace
  - name: Workspace Automations
    description: Scheduled and triggered work of a workspace
  - name: Workspace Integrations
    description: >-
      App accounts a workspace can use, and connecting a new one through an
      authorization link.
paths:
  /v1/workspaces/{wid}/threads/{tid}/messages:
    get:
      tags:
        - Workspace Threads
      summary: Page the messages of a thread
      description: >-
        By `seq`: `before` for older pages, `after` for only what is newer (not
        both).
      operationId: pageWorkspaceMessages
      parameters:
        - $ref: '#/components/parameters/XDevicUser'
        - name: wid
          in: path
          required: true
          description: Workspace id
          schema:
            type: string
        - name: tid
          in: path
          required: true
          description: Thread id
          schema:
            type: string
        - name: before
          in: query
          required: false
          description: Messages with a lower `seq`
          schema:
            type: integer
        - name: after
          in: query
          required: false
          description: Messages with a higher `seq`
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          description: Messages per page (at most 200)
          schema:
            type: integer
            default: 50
      responses:
        '200':
          description: 'Success — wrapped as `{ success: true, data }`'
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/WorkspaceMessagePage'
        '400':
          description: Bad request — invalid or inconsistent payload
        '401':
          description: Unauthorized — missing or invalid credential
        '403':
          description: >-
            Forbidden — not a member, not enough workspace permission, or acting
            for someone the credential cannot act for
        '404':
          description: Not found
      security:
        - bearerAuth: []
components:
  parameters:
    XDevicUser:
      name: X-Devic-User
      in: header
      required: false
      schema:
        type: string
      description: >-
        Only with an **API key**: the userUID or email of a person of the key's
        account to act as, with that person's permissions. Without it, an API
        key acts as the account integration ("API"), which sees shared
        workspaces only. A person's token cannot name someone else.
  schemas:
    WorkspaceMessagePage:
      type: object
      properties:
        thread:
          type: object
          additionalProperties: true
          description: The thread; `GET …/threads/{tid}` adds its `readState`.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceMessage'
        invocations:
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceInvocation'
          description: >-
            Runs answering the messages of the page, plus every run still in
            progress.
        hasMore:
          type: boolean
        before:
          type: integer
          nullable: true
          description: Pass as `before` for the previous page.
        after:
          type: integer
          nullable: true
          description: Pass as `after` to get only what is newer.
        cursor:
          type: integer
    WorkspaceMessage:
      type: object
      properties:
        id:
          type: string
        seq:
          type: integer
        role:
          type: string
          enum:
            - user
            - assistant
            - system
        authorId:
          type: string
          description: >-
            userUID, assistant id, or `api-key:<id>` for the account
            integration.
        authorName:
          type: string
        text:
          type: string
        createdAt:
          type: string
          format: date-time
        mentions:
          type: array
          items:
            type: object
            additionalProperties: true
        replyToMessageId:
          type: string
        directedAssistantId:
          type: string
        attachmentIds:
          type: array
          items:
            type: string
        origin:
          $ref: '#/components/schemas/WorkspaceMessageOrigin'
    WorkspaceInvocation:
      type: object
      description: A run of an assistant answering a message.
      properties:
        id:
          type: string
        assistantId:
          type: string
        replyToMessageId:
          type: string
        status:
          type: string
          enum:
            - queued
            - running
            - paused
            - waiting_connection
            - waiting_approval
            - waiting_input
            - awaiting_publication
            - completed
            - failed
            - cancelled
            - outcome_unknown
        revision:
          type: integer
          description: Send it back with `answer` and `approve`.
        requestedInput:
          type: object
          description: >-
            Questions the run is waiting on (`waiting_input`): `{ id, title,
            questions: [{ id, question, type: single|multiple, options: [{
            value, label }], allowOther, required }] }`.
          additionalProperties: true
        requestedAction:
          type: object
          description: >-
            The tool call waiting for approval (`waiting_approval`). Its `id` is
            the `actionId` to approve.
          additionalProperties: true
        error:
          type: string
    WorkspaceMessageOrigin:
      type: object
      description: >-
        Set by the server on messages written through the public API, the CLI or
        the SDK. Absent on messages written in the apps. Cannot be set by the
        client.
      properties:
        channel:
          type: string
          enum:
            - api
            - cli
            - sdk
        credential:
          type: string
          enum:
            - api_key
            - oauth
            - session
        apiKeyId:
          type: string
        oauthClientId:
          type: string
        onBehalfOf:
          type: boolean
          description: An API key wrote it naming the author with `X-Devic-User`.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key from your Devic console, sent as `Authorization: Bearer
        <key>`. An embedded front end sends a tenant-session token instead, so
        no API key reaches the browser, and an OAuth integration sends its
        access token. Missing, invalid or expired credentials get a `401`. See
        [Authentication](/api-reference/introduction#authentication).

````

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