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

# Ingest a radiology study

> Submit a PACS study event to HMIS.

Identical PACS messages are idempotent. Unknown or conflicting study links are accepted for reconciliation rather than silently linked.


## OpenAPI

````yaml POST /radiology/integration/studies
openapi: 3.1.0
info:
  title: HMIS API
  version: 1.0.0
  description: >-
    Versioned API for HMIS foundation resources and laboratory/radiology
    integrations. All operations use Laravel Sanctum bearer tokens with a
    dedicated ability per operation.
servers:
  - url: https://jaliprohmis.derrickmugabwa.dev/api/v1
    description: HMIS staging API
security:
  - bearerAuth: []
tags:
  - name: Foundation
    description: Authenticated HMIS context and reference data.
  - name: Laboratory integration
    description: Analyzer worklists and result ingestion.
  - name: Radiology integration
    description: PACS worklists and study ingestion.
paths:
  /radiology/integration/studies:
    post:
      tags:
        - Radiology integration
      summary: Ingest a PACS study event
      description: >-
        Links a PACS study to an HMIS radiology examination. The message
        identity is `pacs_code + message_id`; identical replays are idempotent
        and changed replays return a conflict. Requires
        `radiology:studies:write`. Rate limited to 120 requests per minute per
        authenticated user and IP.
      operationId: ingestRadiologyStudy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RadiologyStudyRequest'
      responses:
        '200':
          description: Processed or duplicate study event.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RadiologyStudyResponse'
        '202':
          description: Study event accepted for reconciliation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RadiologyStudyResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Message identity was reused with a different payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RadiologyStudyResponse'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    RadiologyStudyRequest:
      type: object
      required:
        - message_id
        - pacs_code
        - external_study_id
        - study_instance_uid
        - accession_number
        - received_at
      properties:
        message_id:
          type: string
          maxLength: 128
        pacs_code:
          type: string
          maxLength: 64
        external_study_id:
          type: string
          maxLength: 128
        study_instance_uid:
          type: string
          maxLength: 128
        accession_number:
          type: string
          maxLength: 32
        modality:
          type:
            - string
            - 'null'
          maxLength: 32
        study_date:
          type:
            - string
            - 'null'
          format: date
        received_at:
          type: string
          format: date-time
        metadata:
          type:
            - object
            - 'null'
          additionalProperties: true
    RadiologyStudyResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - processed
            - duplicate
            - quarantined
            - conflict
        message_id:
          type: string
        outcome:
          type:
            - object
            - 'null'
          additionalProperties: true
        error:
          type:
            - string
            - 'null'
    ErrorResponse:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          example: Unauthenticated.
      additionalProperties: true
    ValidationErrorResponse:
      type: object
      required:
        - message
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      additionalProperties: true
  responses:
    Unauthenticated:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Bearer token is valid but lacks the required ability.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Request validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
    RateLimited:
      description: >-
        Integration endpoints are limited to 120 requests per minute per
        authenticated user and IP.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Sanctum personal access token
      description: >-
        Paste a Sanctum personal access token generated by a HMIS super
        administrator. Use only a token with the ability required by the
        selected operation.

````