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

# Submit a DRG batch job

> 
Submit up to 1000 cases in one call; classification runs asynchronously.
Returns a job id immediately — poll `GET /api/v1/drg/batch/{job_id}/` for
status and progressive per-case results.

**Idempotency-Key header is required.** Retrying a submission with the same
key returns the same job (HTTP 200 instead of 201) and never re-processes or
re-bills — safe to retry on any network failure.

Each case: `case_ref` (your identifier, unique within the batch), `dx_codes`
(ICD-10-CM, primary first), optional `pr_codes` (ICD-10-PCS), `gender`,
`is_alive`. `source_dialect` currently accepts `icd10cm` only — WHO ICD-10 /
ICD-11 batches are refused up front rather than mis-grouped.

Billing: one ledger row per case (`service_type="drg_batch"`), written exactly
once even across worker retries. A spend-capped organization's submission is
refused at enqueue with a 429 and costs nothing.
    



## OpenAPI

````yaml /api/openapi-commercial.yaml post /api/v1/drg/batch/
openapi: 3.0.3
info:
  title: Healthproximate API
  version: 1.0.0
  description: >-
    DRG classification, OMOP vocabulary services and a PHI-safe LLM gateway.


    Generated by `manage.py export_commercial_openapi` from an explicit
    operation allowlist (`app/openapi_commercial.py`). An endpoint appears here
    because someone published it, never because it exists.
  contact:
    email: admin@valiancehealth.ai
servers:
  - url: https://api.v2.healthproximate.com
security: []
tags:
  - name: DRG
    description: MS-DRG classification from coded input, free clinical text, or FHIR.
  - name: Vocabulary
    description: OMOP concept search, coding, translation and hierarchy resolution.
  - name: Gateway
    description: >-
      PHI-safe LLM access. Text is redacted before any model sees it and
      re-hydrated in the answer, and every response carries a receipt.
paths:
  /api/v1/drg/batch/:
    post:
      tags:
        - DRG
      summary: Submit a DRG batch job
      description: >-

        Submit up to 1000 cases in one call; classification runs asynchronously.

        Returns a job id immediately — poll `GET /api/v1/drg/batch/{job_id}/`
        for

        status and progressive per-case results.


        **Idempotency-Key header is required.** Retrying a submission with the
        same

        key returns the same job (HTTP 200 instead of 201) and never
        re-processes or

        re-bills — safe to retry on any network failure.


        Each case: `case_ref` (your identifier, unique within the batch),
        `dx_codes`

        (ICD-10-CM, primary first), optional `pr_codes` (ICD-10-PCS), `gender`,

        `is_alive`. `source_dialect` currently accepts `icd10cm` only — WHO
        ICD-10 /

        ICD-11 batches are refused up front rather than mis-grouped.


        Billing: one ledger row per case (`service_type="drg_batch"`), written
        exactly

        once even across worker retries. A spend-capped organization's
        submission is

        refused at enqueue with a 429 and costs nothing.
            
      operationId: v1_drg_batch_create
      parameters:
        - in: header
          name: Idempotency-Key
          schema:
            type: string
          description: Caller-chosen key (8-128 chars) making the submission retry-safe.
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DRGBatchRequestRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/DRGBatchRequestRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DRGBatchRequestRequest'
        required: true
      responses:
        '200':
          description: Idempotent replay — existing job returned
        '201':
          description: Job created
        '400':
          description: Invalid request, unsupported dialect, or missing Idempotency-Key
        '401':
          description: Authentication required
        '429':
          description: Batch rate limit, monthly limit, or spend cap reached
      security:
        - api_key_auth: []
        - jwt_auth: []
components:
  schemas:
    DRGBatchRequestRequest:
      type: object
      description: Request serializer for the async batch classification endpoint.
      properties:
        cases:
          type: array
          items:
            $ref: '#/components/schemas/DRGBatchCaseRequest'
          description: Up to 1000 cases per submission.
          maxItems: 1000
          minItems: 1
        source_dialect:
          allOf:
            - $ref: '#/components/schemas/SourceDialectEnum'
          default: icd10cm
          description: >-
            Code dialect of the submitted cases. Only icd10cm is accepted today;
            WHO ICD-10 / ICD-11 batches are refused up front rather than
            mis-grouped.


            * `icd10cm` - icd10cm
        version:
          allOf:
            - $ref: '#/components/schemas/VersionEnum'
          default: v40
          description: |-
            MS-DRG version (default: v40, FY 2023)

            * `v36` - v36
            * `v37` - v37
            * `v38` - v38
            * `v39` - v39
            * `v40` - v40
            * `v43` - v43
      required:
        - cases
    DRGBatchCaseRequest:
      type: object
      description: One case inside a batch submission.
      properties:
        case_ref:
          type: string
          minLength: 1
          description: >-
            Your identifier for this case; unique within the batch — results are
            returned keyed on it.
          maxLength: 128
        dx_codes:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 10
          description: ICD-10-CM diagnosis codes. First code is principal diagnosis.
          minItems: 1
        pr_codes:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 10
          default: []
          description: ICD-10-PCS procedure codes (7 characters each).
        gender:
          allOf:
            - $ref: '#/components/schemas/GenderEnum'
          default: F
        is_alive:
          type: boolean
          default: true
      required:
        - case_ref
        - dx_codes
    SourceDialectEnum:
      enum:
        - icd10cm
      type: string
      description: '* `icd10cm` - icd10cm'
    VersionEnum:
      enum:
        - v36
        - v37
        - v38
        - v39
        - v40
        - v43
      type: string
      description: |-
        * `v36` - v36
        * `v37` - v37
        * `v38` - v38
        * `v39` - v39
        * `v40` - v40
        * `v43` - v43
    GenderEnum:
      enum:
        - F
        - M
      type: string
      description: |-
        * `F` - F
        * `M` - M
  securitySchemes:
    api_key_auth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for organization authentication. Obtain from the organization
        settings or API key management endpoint.
    jwt_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT access token obtained from /login/ endpoint

````