# Attach PCP Referral

> Perform Attach PCP Referral through eClinicalWorks.

Source: [https://genhealth.ai/docs/workflows/integrations/eclinicalworks/ecw_attach_pcp_referral](https://genhealth.ai/docs/workflows/integrations/eclinicalworks/ecw_attach_pcp_referral)

Integration: [eClinicalWorks](https://genhealth.ai/docs/workflows/integrations/eclinicalworks.md)

- Handler: `ecw_attach_pcp_referral`

- Connection type: `eclinicalworks`

## Inputs

- `patient_id` — Patient Id (text, required)
  Required text value.
- `encounter_id` — Encounter Id (text)
  Optional text value.
- `encounter_ids` — Encounter Ids (json)
  Optional JSON value.
- `dos` — Dos (date, required)
  Required date in YYYY-MM-DD format.
- `referring_provider_last_name` — Referring Provider Last Name (text, required)
  Required text value.
- `auth_ukey` — Auth Ukey (text, required)
  Required text value.
- `dx_codes` — Dx Codes (json)
  Optional JSON value.
- `auth_pdf_document_id` — Auth Pdf Document Id (text, required)
  Required text value.
- `eligibility_pdf_document_id` — Eligibility Pdf Document Id (text, required)
  Required text value.
- `auth_start_date` — Auth Start Date (date, required)
  Required date in YYYY-MM-DD format.
- `auth_end_date` — Auth End Date (date, required)
  Required date in YYYY-MM-DD format.
- `folder_name` — Folder Name (text)
  Optional text value.
- `supplemental_auth_pdf_document_id` — Supplemental Auth Pdf Document Id (text)
  Optional text value.
- `supplemental_procedure_codes` — Supplemental Procedure Codes (json)
  Optional JSON value.
- `supplemental_auth_ukey` — Supplemental Auth Ukey (text)
  Optional text value.
- `supplemental_auth_end_date` — Supplemental Auth End Date (text)
  Optional text value.

## Outputs

- `success` — Success
- `referral_id` — Referral Id

Output schema completeness: `best_effort_declared`

## Safety

- External effect: `write`
- Confirmation recommended: no
- Retry safe: no
- Dry run supported: no

## Schemas

These schemas are first-pass authoring guidance. Runtime validation remains authoritative.

### Input schema

```json
{
  "type": "object",
  "required": [
    "patient_id",
    "dos",
    "referring_provider_last_name",
    "auth_ukey",
    "auth_pdf_document_id",
    "eligibility_pdf_document_id",
    "auth_start_date",
    "auth_end_date"
  ],
  "properties": {
    "dos": {
      "type": "string",
      "format": "date",
      "description": "Required date in YYYY-MM-DD format.",
      "x-workflow-field-type": "date"
    },
    "dx_codes": {
      "description": "Optional JSON value.",
      "x-workflow-field-type": "json"
    },
    "auth_ukey": {
      "type": "string",
      "description": "Required text value.",
      "x-workflow-field-type": "text"
    },
    "patient_id": {
      "type": "string",
      "description": "Required text value.",
      "x-workflow-field-type": "text"
    },
    "folder_name": {
      "type": "string",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    },
    "encounter_id": {
      "type": "string",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    },
    "auth_end_date": {
      "type": "string",
      "format": "date",
      "description": "Required date in YYYY-MM-DD format.",
      "x-workflow-field-type": "date"
    },
    "encounter_ids": {
      "description": "Optional JSON value.",
      "x-workflow-field-type": "json"
    },
    "auth_start_date": {
      "type": "string",
      "format": "date",
      "description": "Required date in YYYY-MM-DD format.",
      "x-workflow-field-type": "date"
    },
    "auth_pdf_document_id": {
      "type": "string",
      "description": "Required text value.",
      "x-workflow-field-type": "text"
    },
    "supplemental_auth_ukey": {
      "type": "string",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    },
    "supplemental_auth_end_date": {
      "type": "string",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    },
    "eligibility_pdf_document_id": {
      "type": "string",
      "description": "Required text value.",
      "x-workflow-field-type": "text"
    },
    "referring_provider_last_name": {
      "type": "string",
      "description": "Required text value.",
      "x-workflow-field-type": "text"
    },
    "supplemental_procedure_codes": {
      "description": "Optional JSON value.",
      "x-workflow-field-type": "json"
    },
    "supplemental_auth_pdf_document_id": {
      "type": "string",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "success": {},
    "referral_id": {}
  },
  "additionalProperties": true
}
```
