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

# Create user insurance

> Create or submit user insurance via the Junction API. Requires authentication with your team API key.

If insurance is covered by Medicare or Medicaid, we have closed beta support for inferring the plan to use based on a patient's address. This endpoint supports `payor_code`s with values of `MEDFED` (Medicare) and
`MAIDFED` (Medicaid) to do this.

For example, supplying a `payor_code` of `MEDFED` for a patient that lives in Arizona will create insurance data using Arizona's Medicare plan payor code.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
       --url {{BASE_URL}}/v2/user/{user_id}/insurance \
       --header 'Accept: application/json' \
       --header 'x-vital-api-key: <API_KEY>' \
       --header 'Content-Type: application/json' \
       --data '
  {
    "payor_code": "UNITE",
    "member_id": "test",
    "group_id": "123",
    "relationship": "Self",
    "insured": {
      "first_name": "John",
      "last_name": "Doe",
      "email": "john@email.com",
      "phone_number": "+1123123123",
      "gender": "Male",
      "dob": "1999-01-01",
      "address": {
        "first_line": "Some Street",
        "second_line": null,
        "zip": "85004",
        "state": "AZ",
        "city": "Phoenix",
        "country": "US"
      }
    }
  }
  '
  ```
</RequestExample>


## OpenAPI

````yaml POST /v2/user/{user_id}/insurance
openapi: 3.1.0
info:
  title: Junction API
  description: https://docs.junction.com/
  version: 0.4.483
servers:
  - url: https://api.us.junction.com
    x-fern-server-name: Production
  - url: https://api.eu.junction.com
    x-fern-server-name: ProductionEU
  - url: https://api.sandbox.us.junction.com
    x-fern-server-name: Sandbox
  - url: https://api.sandbox.eu.junction.com
    x-fern-server-name: SandboxEU
security:
  - apiKeyAuth: []
paths:
  /v2/user/{user_id}/insurance:
    post:
      tags:
        - user
      summary: Create Insurance
      operationId: create_insurance_v2_user__user_id__insurance_post
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            type: string
            title: User Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInsuranceRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientFacingInsurance'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateInsuranceRequest:
      properties:
        payor_code:
          type: string
          title: Payor Code
        member_id:
          type: string
          title: Member Id
        group_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Group Id
        relationship:
          $ref: '#/components/schemas/ResponsibleRelationship'
          description: ℹ️ This enum is non-exhaustive.
        insured:
          $ref: >-
            #/components/schemas/vital_core__schemas__db_schemas__lab_test__insurance__PersonDetails
        guarantor:
          anyOf:
            - $ref: '#/components/schemas/GuarantorDetails'
            - type: 'null'
        is_primary:
          type: boolean
          title: Is Primary
          default: true
      type: object
      required:
        - payor_code
        - member_id
        - relationship
        - insured
      title: CreateInsuranceRequest
    ClientFacingInsurance:
      properties:
        member_id:
          type: string
          title: Member Id
        payor_code:
          type: string
          title: Payor Code
        relationship:
          $ref: '#/components/schemas/ResponsibleRelationship'
          description: ℹ️ This enum is non-exhaustive.
        insured:
          $ref: >-
            #/components/schemas/vital_core__schemas__db_schemas__lab_test__insurance__PersonDetails
        company:
          $ref: '#/components/schemas/CompanyDetails'
        group_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Group Id
        guarantor:
          anyOf:
            - $ref: '#/components/schemas/GuarantorDetails'
            - type: 'null'
        is_primary:
          type: boolean
          title: Is Primary
          default: true
      type: object
      required:
        - member_id
        - payor_code
        - relationship
        - insured
        - company
      title: ClientFacingInsurance
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    ResponsibleRelationship:
      type: string
      enum:
        - Self
        - Spouse
        - Other
      title: ResponsibleRelationship
      description: ℹ️ This enum is non-exhaustive.
    vital_core__schemas__db_schemas__lab_test__insurance__PersonDetails:
      properties:
        first_name:
          type: string
          title: First Name
        last_name:
          type: string
          title: Last Name
        gender:
          $ref: '#/components/schemas/Gender'
          description: ℹ️ This enum is non-exhaustive.
        address:
          $ref: '#/components/schemas/Address'
        dob:
          type: string
          format: date
          title: Dob
        email:
          type: string
          title: Email
        phone_number:
          type: string
          title: Phone Number
      type: object
      required:
        - first_name
        - last_name
        - gender
        - address
        - dob
        - email
        - phone_number
      title: PersonDetails
    GuarantorDetails:
      properties:
        first_name:
          type: string
          title: First Name
        last_name:
          type: string
          title: Last Name
        address:
          $ref: '#/components/schemas/Address'
        phone_number:
          type: string
          title: Phone Number
        household_income:
          anyOf:
            - type: integer
            - type: 'null'
          title: Household Income
        household_size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Household Size
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
      type: object
      required:
        - first_name
        - last_name
        - address
        - phone_number
      title: GuarantorDetails
    CompanyDetails:
      properties:
        name:
          type: string
          title: Name
        address:
          $ref: '#/components/schemas/Address'
      type: object
      required:
        - name
        - address
      title: CompanyDetails
    Gender:
      type: string
      enum:
        - female
        - male
        - other
        - unknown
      title: Gender
      description: ℹ️ This enum is non-exhaustive.
    Address:
      properties:
        first_line:
          type: string
          title: First Line
        second_line:
          anyOf:
            - type: string
            - type: 'null'
          title: Second Line
          default: ''
        country:
          type: string
          title: Country
        zip:
          type: string
          title: Zip
        city:
          type: string
          title: City
        state:
          type: string
          title: State
        access_notes:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Access Notes
      type: object
      required:
        - first_line
        - country
        - zip
        - city
        - state
      title: Address
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````