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

# Eligibility Request

> Initiating an eligibility check for a patient

This call is asynchronous, it initiates an eligibility search and returns a UID assigned to this request. The result will be returned in two ways:

* Via active [webhooks](https://provider.anagram.care/webhooks) once available - preferred. Request UID will be included in payload.
* By calling the "Eligibility Result" endpoint - only to be used as fallback. Request UID is required.

If specifying a UID, ensure it is unique. If omitted, one will be generated automatically and included in the response for this API call.

The response will contain the request UID or a validation error.


## OpenAPI

````yaml POST /api/auth/v1/eligibility/
openapi: 3.0.2
info:
  title: Anagram backend
  version: 1.0.0
servers:
  - url: https://api.anagram.care
    description: Authenticated API
security:
  - ApiToken: []
tags:
  - name: public-auth_Eligibility Request
    x-displayName: Eligibility Request
    description: >-
      Requesting patient's eligibility uses the following parameters:


      - First name (required)

      - Last name (required)

      - Date of birth (required)

      - Last four digits from SSN (optional)

      - Zip code (required)

      - Insurer Member ID (optional)

      - Request UID (optional)


      This call is asynchronous, it initiates an eligibility search and returns
      a UID assigned to this request.

      The result will be returned in two ways:

      - Via active [webhooks](https://provider.anagram.care/webhooks) once
      available - preferred.

      Request UID will be included in payload.

      - By calling the "Eligibility Result" endpoint - only to be used as
      fallback. Request UID is required.


      If specifying a UID, ensure it is unique. If omitted one will be generated
      automatically

      and included in the response for this API call.


      Authentication is required for this endpoint. Access token can be obtained

      in [provider app](https://provider.anagram.care/). Access token must be
      sent in `Authorization` header,

      prefaced with `API `:


      `Authorization: Api <key generated in provider app>`


      The response will contain the request UID or a validation error.


      Error examples:

      ```

      {
          "errors": {"$": ["Wrong insurer code"]}
      }

      ```

      ```

      {
          "errors": {
              "patient": {
                  "first_name": {"$": ["This field cannot be blank."]}
              }
          }
      }

      ```


      For testing purposes, you can include cheat codes in the request. Cheat
      codes can be provided in the fields

      `first_name`, `last_name`, and `member_id`. Here are some examples of
      cheat codes:


      - `mark_used`: This cheat code marks all benefits as used.


      - `dt_exam_used`: This cheat code marks exam benefit as used.


      - `no_oon`: Removes all out-of-network benefits from the plan.


      - `no_inn`: Removes all in-network benefits from the plan. You can use
      both `no_oon` and `no_inn` codes together to

      generate a plan without any benefits.


      - `delay_10`, `delay_30`: These codes introduce a delay in the response,
      causing it to wait for either 10 or 30

      seconds before providing an answer.


      - `big_family`: This cheat code adds multiple persons to the result.


      - `not_found`: Using this cheat code will delete all results.


      - `in_err_int`: This cheat code simulates a problem and triggers the
      `unexpected_error`.
  - name: public-auth_Eligibility Result
    x-displayName: Eligibility Result
    description: >-
      Eligibility search result will be sent to all active webhooks once
      available.

      As a fallback, you may call this endpoint to check result status and
      obtain the result.


      ### Status


      The `status` field in the response can have one of the following values:


      `complete` - Indicates that the search has been completed.


      `processing` - Signifies that the search is currently in progress, and it
      is recommended to retry the request later.


      `error` - Suggests that the search dit not finished successfully, and you
      can find descriptions of error codes

      below.


      ### Error codes


      `insurer_problem` – Insurer not available, please try again later


      `unexpected_error` – Unknown error


      ### Webhooks


      Add webhooks to receive results in the [provider
      app](https://provider.anagram.care/webhooks).

      Webhook payload will be identical to the response of this endpoint.


      When configuring a webhook you can provide a secret to sign the webhook
      payload

      and check the signature on the server side.


      Signature will be sent in `X-Signature` header in request to webhook
      endpoint.


      Signature is a request raw data signed with secret by HMAC SHA256
      algorithm. Python example:


      ```

      import hashlib

      import hmac


      def get_signature(secret_key: str, payload: str) -> str:
          return hmac.new(secret_key.encode(), payload.encode(), hashlib.sha256).hexdigest()
      ```
  - name: public-auth_Eligibility Details Request
    x-displayName: Eligibility Details Request
    description: |-
      Requesting plan for patient's eligibility uses the following parameters:

      - Initial request uid (required)
      - Result id from initial request (required)
      - Person id from initial request (required)
      - Details request UID (optional)
  - name: public-auth_Patient
    x-displayName: Patient
  - name: public-auth_Patient eligibility link
    x-displayName: Patient eligibility link
paths:
  /api/auth/v1/eligibility/:
    post:
      tags:
        - public-auth_Eligibility Request
      summary: Start an Eligibility Check
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - patient
              properties:
                insurer_code:
                  type: string
                  description: >-
                    Required if you don't have access to Universal Search.
                    Allows searching a specific insurer. Example:
                    `insurer:vision:vsp`
                insurer_code_list:
                  type: array
                  items:
                    type: string
                    description: >-
                      Allows searching several insurers at once (Universal
                      Search). When omitted, Anagram will search all insurers
                      available for your account (Recommended). Alternatively,
                      can explicitly list the insurers you want to search.
                      Example: `["insurer:vision:vsp", "insurer:vision:eyemed"]`
                request_uid:
                  type: string
                  description: 'Any string value. Max length: 256'
                patient:
                  type: object
                  required:
                    - first_name
                    - last_name
                    - dob
                    - zip
                  properties:
                    first_name:
                      type: string
                      description: >-
                        The name can only contain alphabetic characters,
                        numerical digits, spaces, and some special symbols. The
                        maximum length of the full name is 46 characters.
                    last_name:
                      type: string
                      description: 'Min length: 2, max length of the full name: 46.'
                    dob:
                      type: string
                      format: date
                      description: Date of birth in ISO format (YYYY-MM-DD)
                    ssn_last_four:
                      type: string
                      description: Last four digits from SSN
                    zip:
                      type: string
                      description: 'Zip code with 5 or 9 digits. Example: 12345-6789.'
                    member_id:
                      type: string
                      description: Insurer specific member identifier
                location_code:
                  type: string
                  description: >-
                    Identifies the location that the eligibility check will be
                    linked to. When this field is empty, the eligibility check
                    will be linked with the default location. Example: LOC4242B
            examples:
              Direct search request:
                value:
                  insurer_code: insurer:demo:vision
                  request_uid: 19850f24-900e-4812-8e99-6faa2397fe57
                  patient:
                    first_name: John
                    last_name: Smith
                    dob: '1990-01-01'
                    zip: '11101'
                summary: Direct search request
              Universal search request:
                value:
                  patient:
                    first_name: John
                    last_name: Smith
                    dob: '1990-01-01'
                    zip: '11101'
                summary: Universal search request
              Universal search for selected insurers:
                value:
                  insurer_code_list:
                    - insurer:vision:vsp
                    - insurer:vision:eyemed
                    - insurer:vision:davis_vision
                  patient:
                    first_name: John
                    last_name: Smith
                    dob: '1990-01-01'
                    zip: '11101'
                summary: Universal search request for specific insurers
      responses:
        '201':
          description: Search started successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - request_uid
                properties:
                  request_uid:
                    type: string
                    description: UID provided during request creation or auto generated
              examples:
                Valid request:
                  value:
                    request_uid: af42aa113b4148ec86f3ed7324f24242
                  summary: Valid request
        '400':
          description: Request validation failed
          content:
            application/json:
              schema:
                type: object
                required:
                  - errors
                properties:
                  errors:
                    type: object
              examples:
                Field error:
                  value:
                    errors:
                      patient:
                        first_name:
                          $:
                            - This field cannot be blank.
                  summary: Field error
                Unknown insurer:
                  value:
                    errors:
                      insurer_code:
                        $:
                          - 'Insurers not found: {''insurer:vision:vsp:invalid''}'
                  summary: Unknown insurer
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              examples:
                Global error:
                  value:
                    detail: Invalid authorization header
                  summary: Global error
components:
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: Authorization
      description: >
        Your API token prefaced with an "Api" prefix. Example value: "Api
        B3F4242424E3FDB4242424242A9C7642"

````