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

# Create Patient



## OpenAPI

````yaml POST /v1/patient
openapi: 3.1.0
info:
  title: Mira API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/patient:
    post:
      summary: Create a new patient
      operationId: create_patient
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePatientRequest'
      responses:
        '201':
          description: Patient created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: UUID of the created patient
                    example: 123e4567-e89b-12d3-a456-426614174001
              example:
                id: 123e4567-e89b-12d3-a456-426614174001
        '400':
          description: Bad request - missing required fields
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Missing required fields
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Invalid API key
      x-codeSamples:
        - lang: Python
          source: |-
            import requests

            url = 'https://api.miramace.com/v1/patient'
            headers = {
                'Authorization': 'Bearer YOUR_API_KEY',
                'Content-Type': 'application/json'
            }
            payload = {
                'project_id': '123e4567-e89b-12d3-a456-426614174000',
                'phone_number': '+15555555555',
                'email': 'patient@example.com',
                'first_name': 'Jane',
                'last_name': 'Doe',
                'date_of_birth': '1990-01-15',
                'address': {
                    'street_name': '123 Market Street',
                    'city': 'San Francisco',
                    'state': 'CA',
                    'postal_code': '94105',
                    'country_code': 'US'
                },
                'primary_care_provider': {
                    'name': 'Dr. Sarah Smith',
                    'practice': 'SF Medical Group'
                },
                'insurance': {
                    'medical': [
                        {
                            'company_name': 'Blue Cross Blue Shield',
                            'member_id': 'BCB123456789',
                            'group_number': 'GRP987654',
                            'plan_name': 'PPO Gold',
                            'phone_number': '+18005551234',
                            'relationship_to_subscriber': 'SELF',primary_subscriber: {
                                'first_name': 'Jane',
                                'last_name': 'Doe'
                            }
                        },
                        {
                            'company_name': 'Aetna',
                            'member_id': 'AET987654321',
                            'group_number': 'GRP456789',
                            'plan_name': 'HMO Silver',
                            'phone_number': '+18005559876',
                            'relationship_to_subscriber': 'DEPENDENT',primary_subscriber: {
                                'first_name': 'John',
                                'last_name': 'Doe'
                            }
                        }
                    ],
                    'dental': [
                        {
                            'company_name': 'Delta Dental',
                            'member_id': 'DDB123456789',
                            'group_number': 'GRPD123',
                            'plan_name': 'Premier Plan',
                            'phone_number': '+18005553456',
                            'relationship_to_subscriber': 'SELF'
                        }
                    ],
                    'vision': [
                        {
                            'company_name': 'VSP',
                            'member_id': 'VSP123456789',
                            'group_number': 'GRPV123',
                            'plan_name': 'Vision Care',
                            'phone_number': '+18005554567',
                            'relationship_to_subscriber': 'SELF'
                        }
                    ]
                }
            }

            response = requests.post(url, json=payload, headers=headers)
            print(response.json())
        - lang: JavaScript
          source: >-
            const response = await fetch('https://api.miramace.com/v1/patient',
            {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer YOUR_API_KEY',
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({
                project_id: '123e4567-e89b-12d3-a456-426614174000',phone_number: '+15555555555',email: 'patient@example.com',first_name: 'Jane',last_name: 'Doe',date_of_birth: '1990-01-15',address: {
                  street_name: '123 Market Street',
                  city: 'San Francisco',
                  state: 'CA',
                  postal_code: '94105',
                  country_code: 'US'
                },primary_care_provider: {
                  name: 'Dr. Sarah Smith',
                  practice: 'SF Medical Group'
                },insurance: {
                  medical: [
                    {
                      company_name: 'Blue Cross Blue Shield',
                      member_id: 'BCB123456789',
                      group_number: 'GRP987654',
                      plan_name: 'PPO Gold',
                      phone_number: '+18005551234',
                      relationship_to_subscriber: 'SELF',primary_subscriber: {
                        first_name: 'Jane',
                        last_name: 'Doe'
                      }
                    },
                    {
                      company_name: 'Aetna',
                      member_id: 'AET987654321',
                      group_number: 'GRP456789',
                      plan_name: 'HMO Silver',
                      phone_number: '+18005559876',
                      relationship_to_subscriber: 'DEPENDENT',primary_subscriber: {
                        first_name: 'John',
                        last_name: 'Doe'
                      }
                    }
                  ],dental: [
                    {
                      company_name: 'Delta Dental',
                      member_id: 'DDB123456789',
                      group_number: 'GRPD123',
                      plan_name: 'Premier Plan',
                      phone_number: '+18005553456',
                      relationship_to_subscriber: 'SELF'
                    }
                  ],vision: [
                    {
                      company_name: 'VSP',
                      member_id: 'VSP123456789',
                      group_number: 'GRPV123',
                      plan_name: 'Vision Care',
                      phone_number: '+18005554567',
                      relationship_to_subscriber: 'SELF'
                    }
                  ]
                }
              })
            });


            const data = await response.json();

            console.log(data);
        - lang: cURL
          source: |-
            curl --request POST \
              --url https://api.miramace.com/v1/patient \
              --header 'Authorization: Bearer YOUR_API_KEY' \
              --header 'Content-Type: application/json' \
              --data '{
                "project_id": "123e4567-e89b-12d3-a456-426614174000","phone_number": "+15555555555","email": "patient@example.com","first_name": "Jane","last_name": "Doe","date_of_birth": "1990-01-15","address": {"street_name": "123 Market Street","city": "San Francisco","state": "CA","postal_code": "94105","country_code": "US"},"primary_care_provider": {"name": "Dr. Sarah Smith","practice": "SF Medical Group"},"insurance": {"medical": [{"company_name": "Blue Cross Blue Shield","member_id": "BCB123456789","group_number": "GRP987654","plan_name": "PPO Gold","phone_number": "+18005551234","relationship_to_subscriber": "SELF","primary_subscriber": {"first_name": "Jane","last_name": "Doe"}},{"company_name": "Aetna","member_id": "AET987654321","group_number": "GRP456789","plan_name": "HMO Silver","phone_number": "+18005559876","relationship_to_subscriber": "DEPENDENT","primary_subscriber": {"first_name": "John","last_name": "Doe"}}],"dental": [{"company_name": "Delta Dental","member_id": "DDB123456789","group_number": "GRPD123","plan_name": "Premier Plan","phone_number": "+18005553456","relationship_to_subscriber": "SELF"}],"vision": [{"company_name": "VSP","member_id": "VSP123456789","group_number": "GRPV123","plan_name": "Vision Care","phone_number": "+18005554567","relationship_to_subscriber": "SELF"}]}}'
components:
  schemas:
    CreatePatientRequest:
      allOf:
        - $ref: '#/components/schemas/PatientBase'
        - type: object
          required:
            - project_id
            - phone_number
          properties:
            project_id:
              type: string
              format: uuid
              description: UUID of the project this patient belongs to
              example: 123e4567-e89b-12d3-a456-426614174000
    PatientBase:
      type: object
      required:
        - first_name
        - last_name
        - address
      properties:
        email:
          type: string
          format: email
          description: Email address of the patient
        first_name:
          type: string
          description: First name of the patient
          example: Jane
        last_name:
          type: string
          description: Last name of the patient
          example: Doe
        date_of_birth:
          $ref: '#/components/schemas/Date'
        phone_number:
          $ref: '#/components/schemas/PhoneNumber'
        address:
          $ref: '#/components/schemas/Address'
        primary_care_provider:
          type: object
          properties:
            name:
              type: string
              description: Name of the patient's primary care provider
            practice:
              type: string
              description: Practice name of the patient's primary care provider
        insurance:
          type: object
          properties:
            medical:
              type: array
              items:
                $ref: '#/components/schemas/MemberInsurance'
            dental:
              type: array
              items:
                $ref: '#/components/schemas/MemberInsurance'
            vision:
              type: array
              items:
                $ref: '#/components/schemas/MemberInsurance'
    Date:
      type: string
      format: date
      description: Date in ISO 8601 format (YYYY-MM-DD)
      example: '1990-01-01'
    PhoneNumber:
      type: string
      description: The phone number in E.164 format (e.g., +15555555555)
      pattern: ^\+[1-9]\d{1,14}$
      example: '+15555555555'
    Address:
      type: object
      required:
        - street_name
        - city
        - state
        - postal_code
        - country_code
      properties:
        street_name:
          type: string
          description: Street address
          example: 123 Main St
        city:
          type: string
          description: City
          example: San Francisco
        state:
          type: string
          description: State/province
          example: CA
        postal_code:
          type: string
          description: Postal/ZIP code
          example: '94105'
        country_code:
          type: string
          description: Two-letter country code
          example: US
    MemberInsurance:
      type: object
      properties:
        company_name:
          type: string
          description: The name of the insurance company
          example: Blue Cross Blue Shield
        member_id:
          type: string
          description: The member ID
          example: XYZ1234567
        group_number:
          type: string
          description: The group number
          example: GRP123456
        plan_name:
          type: string
          description: The plan name
          example: PPO Gold
        phone_number:
          $ref: '#/components/schemas/PhoneNumber'
          nullable: true
        relationship_to_subscriber:
          $ref: '#/components/schemas/RelationshipToSubscriber'
        primary_subscriber:
          $ref: '#/components/schemas/PrimarySubscriber'
    RelationshipToSubscriber:
      type: string
      enum:
        - RELATIONSHIP_TO_SUBSCRIBER_UNSPECIFIED
        - SELF
        - SPOUSE
        - DEPENDENT
      description: The relationship of the member to the primary subscriber
      example: SELF
    PrimarySubscriber:
      type: object
      properties:
        first_name:
          type: string
          description: The first name of the primary subscriber
          example: John
        last_name:
          type: string
          description: The last name of the primary subscriber
          example: Doe

````