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

# Get a ticket

> Returns a ticket and its messages by its ID in the source helpdesk.




## OpenAPI

````yaml /openapi-v0.yaml get /v0/tickets/{source}/{external_id}
openapi: 3.1.0
info:
  title: Decimal Chat API
  version: v0
  description: >
    ## Authentication


    All endpoints require a Bearer token:


    ```

    Authorization: Bearer sk-de-...

    ```


    API tokens are created in the Decimal dashboard under Settings → API Tokens.

    Each token has scopes that control access: `chat:read`, `chat:write`,
    `chat:escalate`, `tickets:read`, `tickets:delete`.


    ## Quick Start


    ```bash

    # 1. Send a message

    curl -X POST https://api.getdecimal.ai/v0/chat \
      -H "Authorization: Bearer sk-de-..." \
      -H "Content-Type: application/json" \
      -d '{"message": "How do I configure SSO?"}'
    # → 202 { "conversation_id": "abc123", "status": "processing" }


    # 2. Poll until complete

    curl https://api.getdecimal.ai/v0/chat/abc123 \
      -H "Authorization: Bearer sk-de-..."
    # → 200 { "status": "completed", "messages": [...] }

    ```


    ### Continue a conversation

    ```bash

    curl -X POST https://api.getdecimal.ai/v0/chat \
      -H "Authorization: Bearer sk-de-..." \
      -H "Content-Type: application/json" \
      -d '{"message": "Can you show me the SAML setup?", "conversation_id": "abc123"}'
    ```


    ## Rate Limiting


    Every response includes rate limit headers:

    - `X-RateLimit-Limit`: Requests allowed per minute

    - `X-RateLimit-Remaining`: Requests remaining in current window

    - `X-RateLimit-Reset`: Unix timestamp when the window resets


    Rate limits apply at two levels:

    - **Per API token:** 120 requests/min

    - **Per organization:** 600 requests/min across all tokens


    Some endpoints also have a lower per-organization limit of their own.

    The stricter limit applies. Headers report the limit with the fewest
    requests remaining.

    Contact support for higher limits.
  contact:
    name: Decimal Support
    url: https://getdecimal.ai
servers:
  - url: https://api.getdecimal.ai
    description: Production
  - url: http://localhost:3000
    description: Local development
security:
  - BearerAuth: []
tags:
  - name: Chat
    description: >-
      Send messages and get AI-powered answers from your public knowledge base
      and code.
  - name: Escalation
    description: Escalate conversations to external ticketing integrations.
  - name: Tickets
    description: Manage tickets synced from your helpdesk.
  - name: Utility
    description: Token introspection.
paths:
  /v0/tickets/{source}/{external_id}:
    parameters:
      - $ref: '#/components/parameters/TicketSource'
      - $ref: '#/components/parameters/TicketExternalId'
    get:
      tags:
        - Tickets
      summary: Get a ticket
      description: |
        Returns a ticket and its messages by its ID in the source helpdesk.
      operationId: getTicket
      responses:
        '200':
          description: The ticket.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - BearerAuth:
            - tickets:read
components:
  parameters:
    TicketSource:
      name: source
      in: path
      required: true
      schema:
        type: string
      description: >-
        Helpdesk the ticket was synced from, lowercase (e.g. `plain`,
        `zendesk`).
    TicketExternalId:
      name: external_id
      in: path
      required: true
      schema:
        type: string
      description: Ticket ID in the source helpdesk (for Plain, the thread ID).
  headers:
    X-RateLimit-Limit:
      description: Maximum requests allowed per minute.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests remaining in the current window.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Unix timestamp when the rate limit window resets.
      schema:
        type: integer
  schemas:
    Ticket:
      type: object
      properties:
        id:
          type: integer
          description: Decimal ticket ID.
        external_id:
          type: string
          description: Ticket ID in the source helpdesk.
        external_source:
          type: string
          description: Helpdesk the ticket was synced from.
        number:
          type:
            - integer
            - 'null'
        display_id:
          type:
            - string
            - 'null'
        title:
          type: string
        body_html:
          type: string
          description: The original post.
        state:
          type: string
        priority:
          type:
            - string
            - 'null'
        source:
          type: string
          description: Channel the ticket came in on.
        type:
          type: string
        link:
          type:
            - string
            - 'null'
          description: Link to the ticket in the helpdesk.
        tags:
          type: array
          items:
            type: string
        requester_id:
          type:
            - string
            - 'null'
        requester:
          type:
            - object
            - 'null'
          additionalProperties: {}
          description: As returned by the helpdesk. Shape varies by helpdesk.
        account_id:
          type:
            - string
            - 'null'
        account:
          type:
            - object
            - 'null'
          additionalProperties: {}
          description: As returned by the helpdesk. Shape varies by helpdesk.
        assignee_id:
          type:
            - string
            - 'null'
        assignee:
          type:
            - object
            - 'null'
          additionalProperties: {}
          description: As returned by the helpdesk. Shape varies by helpdesk.
        team_id:
          type:
            - string
            - 'null'
        team:
          type:
            - object
            - 'null'
          additionalProperties: {}
          description: As returned by the helpdesk. Shape varies by helpdesk.
        custom_fields:
          type:
            - object
            - 'null'
          additionalProperties: {}
          description: As returned by the helpdesk. Shape varies by helpdesk.
        attachments:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              url:
                type: string
                format: uri
              size:
                type: integer
                description: Size in bytes.
              filename:
                type: string
              content_type:
                type: string
            required:
              - id
              - url
              - size
              - filename
              - content_type
          description: Attachments on the original post.
        messages:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              author:
                type: object
                properties:
                  name:
                    type: string
                  user:
                    type: object
                    properties:
                      id:
                        type: string
                    required:
                      - id
                  user_type:
                    type: string
                  email:
                    type:
                      - string
                      - 'null'
                  avatar_url:
                    type:
                      - string
                      - 'null'
                required:
                  - name
                  - user
              source:
                type: string
              timestamp:
                type: string
                format: date-time
              is_private:
                type: boolean
                description: Internal note rather than a reply.
              message_html:
                type: string
              attachments:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    url:
                      type: string
                      format: uri
                    size:
                      type: integer
                      description: Size in bytes.
                    filename:
                      type: string
                    content_type:
                      type: string
                  required:
                    - id
                    - url
                    - size
                    - filename
                    - content_type
            required:
              - id
              - author
              - source
              - timestamp
              - is_private
              - message_html
              - attachments
          description: Replies and notes after the original post, oldest first.
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When Decimal first synced the ticket.
        resolution_time:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Last updated in the helpdesk.
      required:
        - id
        - external_id
        - external_source
        - number
        - display_id
        - title
        - body_html
        - state
        - priority
        - source
        - type
        - link
        - tags
        - requester_id
        - requester
        - account_id
        - account
        - assignee_id
        - assignee
        - team_id
        - team
        - custom_fields
        - attachments
        - messages
        - created_at
        - resolution_time
        - updated_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - bad_request
                - unauthorized
                - forbidden
                - not_found
                - conflict
                - rate_limited
                - internal_error
              description: Machine-readable error code.
            message:
              type: string
              description: Human-readable error message.
            retryable:
              type: boolean
              description: Whether the client should retry the request.
          required:
            - code
            - message
      required:
        - error
  responses:
    Unauthorized:
      description: >-
        Missing or invalid API key. Correct the Authorization header before
        retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Invalid or expired API token
    Forbidden:
      description: Valid API key but insufficient scope.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: forbidden
              message: Insufficient permissions
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Resource not found
    RateLimited:
      description: Rate limit exceeded.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        Retry-After:
          description: Seconds until the rate limit resets.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Too many requests
              retryable: true
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: internal_error
              message: An internal error occurred
              retryable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        API token with `sk-de-` prefix.
        Created in the Decimal dashboard under Settings → API Tokens.

````

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