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

> Record an observation — a measurement, lab value, vital sign, or survey answer — for a patient. Survey observations may also be generated automatically from completed questionnaire responses.



## OpenAPI

````yaml /openapi.json post /observations
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:
  /observations:
    post:
      tags:
        - Observations
      summary: Create observation
      description: >-
        Record an observation — a measurement, lab value, vital sign, or survey
        answer — for a patient. Survey observations may also be generated
        automatically from completed questionnaire responses.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum:
                    - registered
                    - preliminary
                    - final
                    - amended
                    - corrected
                    - cancelled
                    - entered-in-error
                    - unknown
                category:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      maxLength: 128
                    display:
                      type:
                        - string
                        - 'null'
                      maxLength: 500
                  required:
                    - code
                code:
                  type: object
                  properties:
                    system:
                      type: string
                      format: uri
                    code:
                      type: string
                      maxLength: 128
                    display:
                      type:
                        - string
                        - 'null'
                      maxLength: 500
                  required:
                    - code
                subject_id:
                  type: string
                  minLength: 1
                  maxLength: 64
                subject_type:
                  type: string
                  enum:
                    - Patient
                    - Group
                    - Device
                    - Location
                encounter_id:
                  type: string
                  minLength: 1
                  maxLength: 64
                effective_at:
                  type: string
                  format: date-time
                effective_period:
                  type: object
                  properties:
                    start_at:
                      type: string
                      format: date-time
                    end_at:
                      type: string
                      format: date-time
                issued_at:
                  type: string
                  format: date-time
                performers:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - CareTeam
                          - Device
                          - HealthcareService
                          - Organization
                          - Patient
                          - Practitioner
                          - PractitionerRole
                          - RelatedPerson
                      id:
                        type: string
                        maxLength: 64
                        pattern: ^[A-Za-z0-9\-.]{1,64}$
                    required:
                      - type
                      - id
                  maxItems: 20
                value:
                  oneOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - quantity
                        value:
                          type: number
                        unit:
                          type:
                            - string
                            - 'null'
                          maxLength: 64
                        system:
                          type: string
                          format: uri
                        code:
                          type:
                            - string
                            - 'null'
                          maxLength: 64
                      required:
                        - type
                        - value
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - string
                        value:
                          type: string
                          maxLength: 4000
                      required:
                        - type
                        - value
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - boolean
                        value:
                          type: boolean
                      required:
                        - type
                        - value
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - integer
                        value:
                          type: integer
                      required:
                        - type
                        - value
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - datetime
                        value:
                          type: string
                          format: date-time
                      required:
                        - type
                        - value
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - codeable_concept
                        value:
                          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
                      required:
                        - type
                        - value
                interpretation:
                  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
                body_site:
                  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
                method:
                  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
                note:
                  type: array
                  items:
                    type: string
                    maxLength: 4000
                  maxItems: 20
              required:
                - status
                - code
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Observation'
                  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:
    Observation:
      type: object
      properties:
        id:
          type: string
          maxLength: 64
          pattern: ^[A-Za-z0-9\-.]{1,64}$
        status:
          type: string
          enum:
            - registered
            - preliminary
            - final
            - amended
            - corrected
            - cancelled
            - entered-in-error
            - unknown
        category:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        code:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        subject:
          type: object
          properties:
            id:
              type: string
              maxLength: 64
              pattern: ^[A-Za-z0-9\-.]{1,64}$
            type:
              type: string
              minLength: 1
              maxLength: 64
              pattern: ^[A-Z][A-Za-z]+$
          required:
            - id
            - type
        encounter_id:
          type: string
          maxLength: 64
        effective_at:
          type: string
          pattern: >-
            ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
        effective_period:
          type: object
          properties:
            start_at:
              type: string
              pattern: >-
                ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
            end_at:
              type: string
              pattern: >-
                ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
        issued_at:
          type: string
          format: date-time
        performers:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                maxLength: 64
                pattern: ^[A-Za-z0-9\-.]{1,64}$
              type:
                type: string
                minLength: 1
                maxLength: 64
                pattern: ^[A-Z][A-Za-z]+$
            required:
              - id
              - type
        value:
          anyOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - quantity
                value:
                  type: number
                unit:
                  type: string
                  maxLength: 64
                system:
                  type: string
                  format: uri
                code:
                  type: string
                  maxLength: 64
              required:
                - type
                - value
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - string
                value:
                  type: string
                  maxLength: 4000
              required:
                - type
                - value
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - boolean
                value:
                  type: boolean
              required:
                - type
                - value
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - integer
                value:
                  type: integer
              required:
                - type
                - value
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - datetime
                value:
                  type: string
                  pattern: >-
                    ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
              required:
                - type
                - value
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - codeable_concept
                value:
                  type: array
                  items:
                    type: object
                    properties:
                      system:
                        type: string
                        format: uri
                      code:
                        type: string
                        minLength: 1
                      display:
                        type: string
                        maxLength: 500
                    required:
                      - code
                  minItems: 1
                  maxItems: 20
              required:
                - type
                - value
        interpretation:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        body_site:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        method:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        note:
          type: array
          items:
            type: string
            maxLength: 4000
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - status
        - category
        - code
        - performers
        - interpretation
    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.