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

# Retrieve a previously-issued inference message by id

> Returns the message's metadata and content, scoped to the caller's org.



## OpenAPI

````yaml /openapi/v1.json get /ai/messages/{id}
openapi: 3.1.0
info:
  title: HASP AI API
  version: '2026-07-12'
  description: >-
    The HASP Public AI API is the regulated-AI substrate for healthcare and
    other

    regulated industries — identity, policy, audit, compliance, and PHI handling

    for AI inference, exposed via two surfaces:


    - **Native (`/v1/ai/*`)**: HASP-native chat with full event taxonomy, run
    lifecycle,
      and PHI metadata.
    - **Anthropic-compat (`/v1/messages`)**: Drop-in replacement for
    `@anthropic-ai/sdk` —
      change only `baseURL`. All Gateway compliance checks (BAA, credits, PHI policy) apply.

    All requests require an API key (`Authorization: Bearer
    hasp_api_live_<key>`). See

    [Authentication](https://docs.usehasp.com/ai-api/authentication) for key
    management.
servers:
  - url: https://api.usehasp.com/v1
    description: Production
security:
  - http: []
paths:
  /ai/messages/{id}:
    get:
      tags:
        - AiMessages
      summary: Retrieve a previously-issued inference message by id
      description: Returns the message's metadata and content, scoped to the caller's org.
      operationId: v1.ai.messages.show
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      request_id:
                        type:
                          - string
                          - 'null'
                      org_id:
                        type:
                          - string
                          - 'null'
                      conversation_id:
                        type:
                          - string
                          - 'null'
                      model:
                        type:
                          - string
                          - 'null'
                      role:
                        type: string
                      usage:
                        type: object
                        properties:
                          input_tokens:
                            type: integer
                          output_tokens:
                            type: integer
                          cache_read_input_tokens:
                            type:
                              - integer
                              - 'null'
                          cache_write_input_tokens:
                            type:
                              - integer
                              - 'null'
                        required:
                          - input_tokens
                          - output_tokens
                          - cache_read_input_tokens
                          - cache_write_input_tokens
                      credits_consumed:
                        type: integer
                      content:
                        type:
                          - string
                          - 'null'
                      created_at:
                        type: string
                    required:
                      - id
                      - request_id
                      - org_id
                      - conversation_id
                      - model
                      - role
                      - usage
                      - credits_consumed
                      - content
                      - created_at
                  meta:
                    type: object
                    properties:
                      request_id:
                        type:
                          - string
                          - 'null'
                    required:
                      - request_id
                required:
                  - success
                  - data
                  - meta
        '401':
          description: Bearer token is missing, malformed, or revoked.
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  error:
                    type: authentication
                    code: INVALID_API_KEY
                    message: Bearer token is missing, malformed, or revoked.
                    param: null
                    details: null
                    retryable: false
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
                  meta:
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
components:
  securitySchemes:
    http:
      type: http
      scheme: bearer

````