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

# Get a chat

> Returns one chat in full: the complete AI answer (Markdown) together with every source it cited.

Each source includes the cited URL, its clean domain, and a 1-based `position`. `position` is a stable citation index — identical on every request — but not necessarily the order the links appear in the answer text.



## OpenAPI

````yaml /api/openapi.json get /chats/{id}
openapi: 3.1.0
info:
  title: ZeroRank REST API
  version: 1.0.0
  description: >-
    The public ZeroRank REST API. Every request uses a workspace API key (Bearer
    `zr_live_…`) and only ever sees that one workspace. Use it to read your
    results and manage your prompts, brands, tags, and topics from your own
    scripts and tools.
servers:
  - url: https://api.zerorank.ai/api/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Workspace
    description: The workspace, plan, and key behind your request.
  - name: Prompts
    description: The questions ZeroRank asks AI engines for you.
  - name: Brands
    description: The brands you track, including competitors.
  - name: Tags
    description: Labels you put on prompts.
  - name: Topics
    description: Groups you sort prompts into.
  - name: Analytics
    description: 'Read-only results: sources, chats, and rankings.'
paths:
  /chats/{id}:
    parameters:
      - $ref: '#/components/parameters/ChatIdPath'
    get:
      tags:
        - Analytics
      summary: Get a chat
      description: >-
        Returns one chat in full: the complete AI answer (Markdown) together
        with every source it cited.


        Each source includes the cited URL, its clean domain, and a 1-based
        `position`. `position` is a stable citation index — identical on every
        request — but not necessarily the order the links appear in the answer
        text.
      operationId: getChat
      responses:
        '200':
          description: The chat, its full answer, and its cited sources.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/ChatDetail'
                  message:
                    type: string
                    example: Chat retrieved successfully
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    ChatIdPath:
      name: id
      in: path
      required: true
      description: The chat's UUID. Get chat ids from `GET /chats`.
      schema:
        type: string
        format: uuid
  schemas:
    ChatDetail:
      type: object
      properties:
        id:
          type: string
          format: uuid
        promptId:
          type: integer
          example: 101
        question:
          type: string
          example: What is the best CRM for small teams?
        answer:
          type: string
          description: The full AI answer, in Markdown.
        aiModel:
          type: string
          example: chatgpt
        location:
          type: string
          example: United States
        status:
          type: string
          example: completed
        sourceCount:
          type: integer
          example: 6
        citationCount:
          type: integer
          example: 6
        webSearchTriggered:
          type: boolean
          example: true
        createdAt:
          type: string
          format: date-time
        sources:
          type: array
          description: Every URL the answer cited, in stable citation order.
          items:
            $ref: '#/components/schemas/ChatSource'
    ChatSource:
      type: object
      properties:
        position:
          type: integer
          description: >-
            1-based stable citation index. Identical on every request, but not
            necessarily the order the links appear in the answer text.
          example: 1
        url:
          type: string
          example: https://www.reddit.com/r/CRM/comments/best_crm_small_teams
        domain:
          type: string
          description: The clean host of the cited URL.
          example: reddit.com
        domainType:
          type: string
          description: >-
            Corporate, Editorial, Institutional, UGC, Reference, Competitor, or
            Other.
          example: UGC
        urlType:
          type: string
          description: >-
            Homepage, Category, Product, Listicle, Comparison, Profile,
            Alternative, Discussion, HowToGuide, Article, or Other.
          example: Discussion
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          description: A human-readable explanation.
        code:
          type: string
          description: A short error code, when one applies.
        errors:
          description: Field-level details, on validation errors.
  responses:
    Unauthorized:
      description: The API key is missing, invalid, revoked, or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Invalid, revoked, or expired API key
            code: API_KEY_INVALID
    NotFound:
      description: The item was not found in your workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Prompt not found
    RateLimited:
      description: >-
        Too many requests. Slow down and retry after the time in the
        `Retry-After` header.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait before retrying.
        X-RateLimit-Limit:
          schema:
            type: integer
          description: Your per-minute limit.
        X-RateLimit-Remaining:
          schema:
            type: integer
          description: Requests left in this window.
        X-RateLimit-Reset:
          schema:
            type: integer
          description: Unix time when the window resets.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: API rate limit exceeded. Please slow down.
            code: RATE_LIMIT_EXCEEDED
            retryAfter: 30
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Send your workspace API key as `Authorization: Bearer zr_live_…`.'

````