> ## 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 by Decimal ID

> Returns a ticket and its messages by its Decimal ID.




## OpenAPI

````yaml /openapi-v0.yaml get /v0/tickets/{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 keys.

    Every endpoint except `GET /v0/me` requires a scope, and a token without it
    gets `403` with code `forbidden`. Scopes: `chat:read`, `chat:write`,
    `chat:escalate`, `tickets:read`, `tickets:write`, `tickets:notes`,
    `tickets:reply`, `tickets:update`, `tickets:delete`, `knowledge:read`,
    `knowledge:delete`, `audit_logs:read`, `pull_requests:read`, `gaps:read`,
    `gaps:write`, `automations:read`, `customers:read`, `customers:write`.


    ## 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", "message_id": "xyz789", "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"}'
    # → 202 { "conversation_id": "abc123", "message_id": "def456", "status":
    "processing" }

    ```


    A conversation keeps its `conversation_id` across turns. Each answer has its
    own `message_id`.


    ### Stream the answer

    ```bash

    curl -N -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?", "stream": true}'
    # event: message.started

    # data: { "conversation_id": "abc123", "message_id": "xyz789", "status":
    "processing" }

    #

    # event: tool_call.started

    # data: { "id": "call_1", "name": "searchPublicKB", "status": "incomplete",
    "input": { "query": "configure SSO" }, "refs": [] }

    #

    # event: tool_call.completed

    # data: { "id": "call_1", "name": "searchPublicKB", "status": "completed",
    "input": { "query": "configure SSO" }, "refs": [...] }

    #

    # event: message.completed

    # data: { "conversation_id": "abc123", "message": { "role": "assistant",
    "content": "...", "message_id": "xyz789" } }

    ```


    ## 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.


    ## Idempotency


    Endpoints that create something accept an `Idempotency-Key` header. Retrying
    with the

    same key within 24 hours returns the original response instead of running
    the request

    again, with an `Idempotent-Replayed: true` header. Only successful responses
    are saved,

    so a request that failed can be retried with the same key. Reusing a key for
    a

    different path or request body returns `409 Conflict`.


    ## Request IDs


    Every response includes a `Request-Id` header. Include it when you contact
    support.
  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: Pull requests
    description: Read pull requests from your connected repositories.
  - name: Knowledge gaps
    description: Read changes Decimal proposes to your knowledge base, docs, and code.
  - name: Automations
    description: >-
      Read your automations: what starts them, what they do, and how their runs
      went.
  - name: Audit logs
    description: Read who did what in your organization. Requires audit logs on your plan.
  - name: Knowledge
    description: Read and delete the articles your AI agent answers from.
  - name: Customers
    description: >-
      Manage the companies you support. Requires customers to be enabled for
      your organization.
  - name: Utility
    description: Token introspection.
paths:
  /v0/tickets/{id}:
    parameters:
      - $ref: '#/components/parameters/TicketId'
    get:
      tags:
        - Tickets
      summary: Get a ticket by Decimal ID
      description: |
        Returns a ticket and its messages by its Decimal ID.
      operationId: getTicketById
      responses:
        '200':
          description: The ticket.
          headers:
            Request-Id:
              $ref: '#/components/headers/Request-Id'
            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:
    TicketId:
      name: id
      in: path
      required: true
      schema:
        type: integer
      description: Decimal ticket ID (`id` on the ticket).
  headers:
    Request-Id:
      description: Unique ID for this request. Include it when you contact support.
      schema:
        type: string
    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.
        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
          description: Status as the helpdesk names it. Not normalized across helpdesks.
        priority:
          type:
            - string
            - 'null'
        type:
          type: string
        url:
          description: Link to the ticket in the helpdesk.
          type:
            - string
            - 'null'
        decimal_url:
          type: string
          description: Link to the ticket in Decimal.
          format: uri
        tags:
          type: array
          items:
            type: string
        requester:
          anyOf:
            - $ref: '#/components/schemas/Requester'
            - type: 'null'
        account:
          anyOf:
            - $ref: '#/components/schemas/Account'
            - type: 'null'
        assignee:
          anyOf:
            - $ref: '#/components/schemas/Assignee'
            - type: 'null'
        team:
          anyOf:
            - $ref: '#/components/schemas/Team'
            - type: 'null'
        custom_fields:
          description: As returned by the helpdesk. Shape varies by helpdesk.
          type:
            - object
            - 'null'
          additionalProperties: {}
        created_at:
          format: date-time
          description: >-
            When the ticket entered Decimal. For older tickets, when it was
            created in the helpdesk.
          type:
            - string
            - 'null'
        external_created_at:
          format: date-time
          description: Created in the helpdesk.
          type:
            - string
            - 'null'
        external_updated_at:
          format: date-time
          description: Last updated in the helpdesk.
          type:
            - string
            - 'null'
        attachments:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              url:
                format: uri
                description: Download link. `null` when Decimal has no copy of the file.
                type:
                  - string
                  - 'null'
              size:
                description: Size in bytes.
                type:
                  - integer
                  - 'null'
              filename:
                type: string
              content_type:
                type: string
              inline:
                type: boolean
                description: Shown inside the message body.
            required:
              - id
              - url
              - size
              - filename
              - content_type
              - inline
          description: Attachments on the original post.
        messages:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              author:
                type: object
                properties:
                  id:
                    description: User ID in the helpdesk.
                    type:
                      - string
                      - 'null'
                  name:
                    type:
                      - string
                      - 'null'
                  email:
                    type:
                      - string
                      - 'null'
                  avatar_url:
                    type:
                      - string
                      - 'null'
                  user_type:
                    type:
                      - string
                      - 'null'
                required:
                  - id
                  - name
                  - email
                  - avatar_url
                  - user_type
              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:
                      format: uri
                      description: >-
                        Download link. `null` when Decimal has no copy of the
                        file.
                      type:
                        - string
                        - 'null'
                    size:
                      description: Size in bytes.
                      type:
                        - integer
                        - 'null'
                    filename:
                      type: string
                    content_type:
                      type: string
                    inline:
                      type: boolean
                      description: Shown inside the message body.
                  required:
                    - id
                    - url
                    - size
                    - filename
                    - content_type
                    - inline
            required:
              - id
              - author
              - timestamp
              - is_private
              - message_html
              - attachments
          description: Replies and notes after the original post, oldest first.
        latest_response:
          anyOf:
            - $ref: '#/components/schemas/LatestResponse'
            - type: 'null'
          description: >-
            The agent's most recent answer. Skipped and declined runs are
            ignored.
      required:
        - id
        - external_id
        - source
        - number
        - display_id
        - title
        - body_html
        - state
        - priority
        - type
        - url
        - decimal_url
        - tags
        - requester
        - account
        - assignee
        - team
        - custom_fields
        - created_at
        - external_created_at
        - external_updated_at
        - attachments
        - messages
        - latest_response
    Requester:
      type: object
      properties:
        id:
          type: string
          description: ID in the helpdesk.
        name:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
      required:
        - id
        - name
        - email
      additionalProperties: {}
      description: Other fields are as returned by the helpdesk and vary by helpdesk.
    Account:
      type: object
      properties:
        id:
          type: string
          description: ID in the helpdesk.
        name:
          type:
            - string
            - 'null'
      required:
        - id
        - name
      additionalProperties: {}
      description: Other fields are as returned by the helpdesk and vary by helpdesk.
    Assignee:
      type: object
      properties:
        id:
          type: string
          description: ID in the helpdesk.
        name:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
      required:
        - id
        - name
        - email
      additionalProperties: {}
      description: Other fields are as returned by the helpdesk and vary by helpdesk.
    Team:
      type: object
      properties:
        id:
          type: string
          description: ID in the helpdesk.
        name:
          type:
            - string
            - 'null'
      required:
        - id
        - name
      additionalProperties: {}
      description: Other fields are as returned by the helpdesk and vary by helpdesk.
    LatestResponse:
      type: object
      properties:
        agent:
          type: string
          enum:
            - private
            - public
        completed_at:
          format: date-time
          type:
            - string
            - 'null'
        text:
          type: string
          description: >-
            The agent's answer, in Markdown. Citations are superscript links,
            such as `[¹](https://...)`.
        held_reason:
          description: Why the answer was held as a draft instead of sent.
          type:
            - string
            - 'null'
        sources:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              title:
                type: string
              url:
                type:
                  - string
                  - 'null'
              is_public:
                type: boolean
            required:
              - type
              - title
              - url
              - is_public
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ToolCall'
          description: Oldest first.
        internal_investigation:
          description: >-
            The private agent's findings for the support team, alongside its
            answer. Null for the public agent.
          type:
            - object
            - 'null'
          properties:
            text:
              type: string
              description: The whole investigation, in Markdown.
            sections:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  content:
                    type: string
                required:
                  - name
                  - content
              description: >-
                The investigation split into the organization's configured
                sections.
          required:
            - text
            - sections
        routing:
          type:
            - object
            - 'null'
          properties:
            category:
              type:
                - string
                - 'null'
            reasoning:
              type:
                - string
                - 'null'
            auto_routed:
              type: boolean
            category_overridden:
              type: boolean
          required:
            - category
            - reasoning
            - auto_routed
            - category_overridden
        delivery:
          description: Null until posted to the helpdesk.
          type:
            - object
            - 'null'
          properties:
            visibility:
              type: string
              enum:
                - public
                - internal
              description: Sent to the customer, or posted as an internal note.
            posted_at:
              type: string
              format: date-time
          required:
            - visibility
            - posted_at
      required:
        - agent
        - completed_at
        - text
        - held_reason
        - sources
        - tool_calls
        - internal_investigation
        - routing
        - delivery
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - bad_request
                - unauthorized
                - forbidden
                - not_found
                - conflict
                - payment_required
                - rate_limited
                - internal_error
              description: Machine-readable error code.
            message:
              type: string
              description: Human-readable error message.
            retryable:
              description: Whether the client should retry the request.
              type: boolean
          required:
            - code
            - message
      required:
        - error
    ToolCall:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - completed
            - error
            - incomplete
        input:
          description: >-
            The tool's arguments, such as a search query or file path. Not all
            arguments are exposed.
          type:
            - object
            - 'null'
          additionalProperties: {}
        refs:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - code_file
                  repository:
                    type: string
                  path:
                    type: string
                  start_line:
                    type:
                      - integer
                      - 'null'
                  end_line:
                    type:
                      - integer
                      - 'null'
                required:
                  - type
                  - repository
                  - path
                  - start_line
                  - end_line
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - kb_article
                  id:
                    type: integer
                    description: Knowledge article ID.
                  title:
                    type: string
                  url:
                    type:
                      - string
                      - 'null'
                required:
                  - type
                  - id
                  - title
                  - url
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - log_query
                  provider:
                    type: string
                  url:
                    type: string
                    description: Link to the query in the provider's log explorer.
                required:
                  - type
                  - provider
                  - url
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - ticket
                  id:
                    type: integer
                    description: Decimal ticket ID.
                required:
                  - type
                  - id
          description: Files, articles, tickets, or log queries the tool returned.
      required:
        - id
        - name
        - status
        - input
        - refs
  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:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        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.