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

# Create or Update Patient

## Behavior Overview

This API has two flows: update and create. We trigger the update flow if we find a patient with a matching `source_id`
or we determine the requested patient to be a duplicate (for example, they have the same first name, last name, and dob as an existing patient).
Else we trigger the create flow.


## OpenAPI

````yaml put /public/v1/patients/
openapi: 3.0.2
info:
  title: Silna Public API
  version: '1.0'
servers:
  - url: https://app.silnahealth.com/api
security:
  - bearerAuth: []
paths:
  /public/v1/patients/:
    put:
      tags:
        - V1PatientsResource
      summary: Create or Update Patient
      operationId: V1PatientsResource.put
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V1PatientPut'
        description: ''
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1PatientPutResponse'
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
                description: The maximum number of requests allowed in the time window
            X-RateLimit-Remaining:
              schema:
                type: integer
                description: The number of requests remaining in the current time window
            X-RateLimit-Reset:
              schema:
                type: integer
                description: The time when the rate limit will reset, in Unix timestamp
            Retry-After:
              schema:
                type: number
                description: The number of seconds to wait before making another request
        '201':
          description: |2-

                Patient Create Response Schema
                
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1PatientCreateResponse'
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
                description: The maximum number of requests allowed in the time window
            X-RateLimit-Remaining:
              schema:
                type: integer
                description: The number of requests remaining in the current time window
            X-RateLimit-Reset:
              schema:
                type: integer
                description: The time when the rate limit will reset, in Unix timestamp
            Retry-After:
              schema:
                type: number
                description: The number of seconds to wait before making another request
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
                description: The maximum number of requests allowed in the time window
            X-RateLimit-Remaining:
              schema:
                type: integer
                description: The number of requests remaining in the current time window
            X-RateLimit-Reset:
              schema:
                type: integer
                description: The time when the rate limit will reset, in Unix timestamp
            Retry-After:
              schema:
                type: number
                description: The number of seconds to wait before making another request
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
                description: The maximum number of requests allowed in the time window
            X-RateLimit-Remaining:
              schema:
                type: integer
                description: The number of requests remaining in the current time window
            X-RateLimit-Reset:
              schema:
                type: integer
                description: The time when the rate limit will reset, in Unix timestamp
            Retry-After:
              schema:
                type: number
                description: The number of seconds to wait before making another request
        '429':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsError'
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
                description: The maximum number of requests allowed in the time window
            X-RateLimit-Remaining:
              schema:
                type: integer
                description: The number of requests remaining in the current time window
            X-RateLimit-Reset:
              schema:
                type: integer
                description: The time when the rate limit will reset, in Unix timestamp
            Retry-After:
              schema:
                type: number
                description: The number of seconds to wait before making another request
components:
  schemas:
    V1PatientPut:
      properties:
        first_name:
          description: Patient's first name
          title: First Name
          type: string
        last_name:
          description: Patient's last name
          title: Last Name
          type: string
        date_of_birth:
          description: Patient's date of birth
          format: date
          title: Date Of Birth
          type: string
        source_id:
          description: >-
            Patient's EHR ID (or other unique identifier) that you have in your
            system
          title: Source Id
          type: string
        address_line_1:
          default: null
          description: Patient's street address
          title: Address Line 1
          nullable: true
          maxLength: 255
          type: string
        address_line_2:
          default: null
          description: Patient's apartment, suite, unit, etc.
          title: Address Line 2
          nullable: true
          maxLength: 255
          type: string
        city:
          default: null
          description: Patient's city
          title: City
          nullable: true
          maxLength: 255
          type: string
        state:
          default: null
          description: Patient's state
          title: State
          nullable: true
          maxLength: 255
          type: string
        zip_code:
          default: null
          description: Patient's zip code. Empty strings are not allowed
          title: Zip Code
          nullable: true
          type: string
        sex:
          $ref: '#/components/schemas/PatientSex'
          default: null
          description: Patient's sex
          nullable: true
        patient_specialties:
          description: Patient's specialties. A patient can have multiple
          items:
            $ref: '#/components/schemas/PublicSpecialty'
          title: Patient Specialties
          type: array
        status:
          $ref: '#/components/schemas/PatientStatus'
          description: Patient's status
        provider_service_location_id:
          description: Provider Service Location ID (where the patient receives service)
          format: uuid
          title: Provider Service Location Id
          type: string
        provider_id:
          format: uuid
          title: Provider Id
          type: string
      required:
        - first_name
        - last_name
        - date_of_birth
        - source_id
        - patient_specialties
        - status
        - provider_service_location_id
        - provider_id
      title: V1PatientPut
      type: object
      x-folder: public_api
    V1PatientPutResponse:
      properties:
        patient_id:
          format: uuid
          title: Patient Id
          type: string
      required:
        - patient_id
      title: V1PatientPutResponse
      type: object
      x-folder: public_api
    V1PatientCreateResponse:
      description: Patient Create Response Schema
      properties:
        patient_id:
          format: uuid
          title: Patient Id
          type: string
      required:
        - patient_id
      title: V1PatientCreateResponse
      type: object
      x-folder: public_api
    ValidationError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human readable error message
      x-folder: null
    AuthenticationError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human readable error message
        type:
          $ref: '#/components/schemas/PublicApiErrorType'
      x-folder: null
    TooManyRequestsError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human readable error message
      x-folder: null
    PatientSex:
      type: string
      enum:
        - MALE
        - FEMALE
      x-folder: patient
    PublicSpecialty:
      type: string
      enum:
        - PHYSICAL_THERAPY
        - ABA_THERAPY
        - SPEECH_THERAPY
        - OCCUPATIONAL_THERAPY
        - PSYCHOLOGICAL_TESTING
        - HOME_HEALTH_CARE
        - HOSPICE
        - CARDIAC_REHABILITATION
        - INTENSIVE_CARDIAC_REHABILITATION
        - MENTAL_HEALTH
        - PRINCIPAL_ILLNESS_NAVIGATION
        - PRINCIPAL_CARE_MANAGEMENT
        - ADVANCED_PRIMARY_CARE_MODELS
        - PREVENTATIVE_HEALTH
        - PARTIAL_HOSPITALIZATION_PROGRAM
        - INTENSIVE_OUTPATIENT_PROGRAM
        - INTERVENTIONAL_RADIOLOGY
        - VASCULAR_SURGERY
        - INTERVENTIONAL_CARDIOLOGY
        - ORTHOPEDICS
        - CHIROPRACTIC
        - GYNECOLOGY
        - LONG_TERM_CARE
        - NUTRITIONAL_COUNSELING
        - PHYSICAL_MEDICINE
        - PULMONARY_REHABILITATION
        - INJECTABLE_SPECIALTY_MEDICATIONS
        - ALLERGY_TESTING
        - SKILLED_NURSING
        - RADIOLOGY
        - OTOLARYNGOLOGY
        - DURABLE_MEDICAL_EQUIPMENT
        - DERMATOLOGY
        - PROFESSIONAL_OFFICE_VISIT
        - PSYCHIATRY
      x-folder: specialty
    PatientStatus:
      type: string
      enum:
        - INTAKE
        - ACTIVE
        - DISCHARGED
        - ON_HOLD
      x-folder: patient
    PublicApiErrorType:
      type: string
      enum:
        - AUTH_INVALID_REQUEST_HEADER
        - AUTH_INVALID_CREDENTIALS
      x-folder: null
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````