> ## 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 related person

> Create a person related to a patient — a guardian, caregiver, or emergency contact — always attached to the patient via the required `patient_id`.



## OpenAPI

````yaml /openapi.json post /related-persons
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:
  /related-persons:
    post:
      tags:
        - Related Persons
      summary: Create related person
      description: >-
        Create a person related to a patient — a guardian, caregiver, or
        emergency contact — always attached to the patient via the required
        `patient_id`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                active:
                  type: boolean
                patient_id:
                  type: string
                  minLength: 1
                  maxLength: 64
                first_name:
                  type:
                    - string
                    - 'null'
                  maxLength: 100
                middle_name:
                  type:
                    - string
                    - 'null'
                  maxLength: 100
                last_name:
                  type:
                    - string
                    - 'null'
                  maxLength: 100
                email:
                  type: string
                  format: email
                  maxLength: 254
                phone:
                  type: string
                  pattern: ^\+[1-9]\d{1,14}$
                gender:
                  type: string
                  enum:
                    - male
                    - female
                    - other
                    - unknown
                birth_date:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                relationships:
                  type: array
                  items:
                    type: object
                    properties:
                      system:
                        type: string
                        format: uri
                      code:
                        type: string
                        minLength: 1
                      display:
                        type: string
                        maxLength: 500
                    required:
                      - code
                  maxItems: 10
                addresses:
                  type: array
                  items:
                    type: object
                    properties:
                      use:
                        type: string
                        enum:
                          - home
                          - work
                          - temp
                          - old
                          - billing
                      type:
                        type: string
                        enum:
                          - postal
                          - physical
                          - both
                      text:
                        type:
                          - string
                          - 'null'
                        maxLength: 500
                      line:
                        type: array
                        items:
                          type: string
                          maxLength: 200
                        maxItems: 5
                      city:
                        type:
                          - string
                          - 'null'
                        maxLength: 100
                      district:
                        type:
                          - string
                          - 'null'
                        maxLength: 100
                      state:
                        type:
                          - string
                          - 'null'
                        maxLength: 100
                      postal_code:
                        type:
                          - string
                          - 'null'
                        maxLength: 20
                      country:
                        type:
                          - string
                          - 'null'
                        maxLength: 100
                  maxItems: 10
                period_start:
                  type: string
                  format: date-time
                period_end:
                  type: string
                  format: date-time
              required:
                - patient_id
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/RelatedPerson'
                  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:
    RelatedPerson:
      type: object
      properties:
        id:
          type: string
        active:
          type: boolean
        patient_id:
          type: string
        first_name:
          type: string
        middle_name:
          type: string
        last_name:
          type: string
        email:
          type: string
        phone:
          type: string
        gender:
          type: string
          enum:
            - male
            - female
            - other
            - unknown
        birth_date:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
        relationships:
          type: array
          items:
            type: object
            properties:
              system:
                type: string
                format: uri
              code:
                type: string
                minLength: 1
              display:
                type: string
                maxLength: 500
            required:
              - code
        addresses:
          type: array
          items:
            type: object
            properties:
              use:
                type: string
                enum:
                  - home
                  - work
                  - temp
                  - old
                  - billing
              type:
                type: string
                enum:
                  - postal
                  - physical
                  - both
              text:
                type: string
              line:
                type: array
                items:
                  type: string
              city:
                type: string
              district:
                type: string
              state:
                type: string
              postal_code:
                type: string
              country:
                type: string
        period_start:
          type: string
          format: date-time
        period_end:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - active
        - patient_id
        - relationships
        - addresses
    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.