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

# Create allergy intolerance

> Record an allergy or intolerance for a patient.



## OpenAPI

````yaml /openapi.json post /allergy-intolerances
openapi: 3.1.0
info:
  title: OpenLoop API
  version: 0.1.0
  description: >-
    Unified reference for the OpenLoop Patient (clinical) and Payments & Revenue
    APIs.
servers:
  - url: https://api.openloophealth.com/v0.1
    description: Production partner edge
  - url: https://api-staging.openloophealth.com/v0.1
    description: Staging partner edge (sandbox credentials)
security: []
paths:
  /allergy-intolerances:
    post:
      tags:
        - Allergy Intolerances
      summary: Create allergy intolerance
      description: Record an allergy or intolerance for a patient.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                clinical_status:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      maxLength: 128
                    display:
                      type:
                        - string
                        - 'null'
                      maxLength: 500
                  required:
                    - code
                verification_status:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      maxLength: 128
                    display:
                      type:
                        - string
                        - 'null'
                      maxLength: 500
                  required:
                    - code
                type:
                  type: string
                  enum:
                    - allergy
                    - intolerance
                category:
                  type: array
                  items:
                    type: string
                    enum:
                      - food
                      - medication
                      - environment
                      - biologic
                  maxItems: 4
                criticality:
                  type: string
                  enum:
                    - low
                    - high
                    - unable-to-assess
                code:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      maxLength: 128
                    display:
                      type:
                        - string
                        - 'null'
                      maxLength: 500
                  required:
                    - code
                patient_id:
                  type: string
                  minLength: 1
                  maxLength: 64
                encounter_id:
                  type: string
                  minLength: 1
                  maxLength: 64
                onset_at:
                  type: string
                  format: date-time
                recorded_date:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                last_occurrence:
                  type: string
                  format: date-time
                reactions:
                  type: array
                  items:
                    type: object
                    properties:
                      substance:
                        type: array
                        items:
                          type: object
                          properties:
                            system:
                              type: string
                              format: uri
                            code:
                              type: string
                              maxLength: 128
                            display:
                              type:
                                - string
                                - 'null'
                              maxLength: 500
                          required:
                            - code
                        maxItems: 20
                      manifestation:
                        type: array
                        items:
                          type: object
                          properties:
                            system:
                              type: string
                              format: uri
                            code:
                              type: string
                              maxLength: 128
                            display:
                              type:
                                - string
                                - 'null'
                              maxLength: 500
                          required:
                            - code
                        minItems: 1
                        maxItems: 20
                      description:
                        type:
                          - string
                          - 'null'
                        maxLength: 4000
                      onset_at:
                        type: string
                        format: date-time
                      severity:
                        type: string
                        enum:
                          - mild
                          - moderate
                          - severe
                      exposure_route:
                        type: array
                        items:
                          type: object
                          properties:
                            system:
                              type: string
                              format: uri
                            code:
                              type: string
                              maxLength: 128
                            display:
                              type:
                                - string
                                - 'null'
                              maxLength: 500
                          required:
                            - code
                        maxItems: 20
                      notes:
                        type: array
                        items:
                          type: string
                          maxLength: 4000
                        maxItems: 20
                    required:
                      - manifestation
                  maxItems: 20
                notes:
                  type: array
                  items:
                    type: string
                    maxLength: 4000
                  maxItems: 20
              required:
                - code
                - patient_id
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/AllergyIntolerance'
                  request_id:
                    type: string
                required:
                  - data
                  - request_id
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - serviceToken: []
        - userToken: []
components:
  schemas:
    AllergyIntolerance:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[A-Za-z0-9\-.]{1,64}$
        clinical_status:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        verification_status:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        type:
          type: string
          enum:
            - allergy
            - intolerance
        category:
          type: array
          items:
            type: string
            enum:
              - food
              - medication
              - environment
              - biologic
        criticality:
          type: string
          enum:
            - low
            - high
            - unable-to-assess
        code:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        patient_id:
          type: string
          minLength: 1
          maxLength: 64
        encounter_id:
          type: string
          minLength: 1
          maxLength: 64
        onset_at:
          type: string
          pattern: >-
            ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
        recorded_date:
          type: string
          pattern: >-
            ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
        last_occurrence:
          type: string
          pattern: >-
            ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
        reactions:
          type: array
          items:
            type: object
            properties:
              substance:
                type: array
                items:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      minLength: 1
                    display:
                      type: string
                      maxLength: 500
                  required:
                    - code
              manifestation:
                type: array
                items:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      minLength: 1
                    display:
                      type: string
                      maxLength: 500
                  required:
                    - code
              description:
                type: string
              onset_at:
                type: string
                pattern: >-
                  ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
              severity:
                type: string
                enum:
                  - mild
                  - moderate
                  - severe
              exposure_route:
                type: array
                items:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      minLength: 1
                    display:
                      type: string
                      maxLength: 500
                  required:
                    - code
              notes:
                type: array
                items:
                  type: string
            required:
              - manifestation
        notes:
          type: array
          items:
            type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - category
        - code
        - patient_id
        - reactions
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            error_code:
              type: string
          required:
            - message
            - error_code
        request_id:
          type: string
      required:
        - error
        - request_id
  securitySchemes:
    serviceToken:
      type: oauth2
      description: >-
        Service (M2M) access token issued by POST /auth/token using the
        client_credentials grant. Required scopes, where known, are listed on
        each operation below.
      flows:
        clientCredentials:
          tokenUrl: https://api.openloophealth.com/v0.1/auth/token
          scopes: {}
    userToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        User access token issued by POST /auth/token via the verification-code
        grant (after Verify a one-time code) or the refresh_token grant.

````

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