# Unrecognized Emails

**Base URL:** `https://api.welkinhealth.com/{tenantName}/{instanceName}/unrecognized-emails`

Unrecognized emails are inbound messages from email addresses not associated with any known patient.

***

## Get All Unrecognized Emails

**GET** `/unrecognized-emails`

Returns a paginated list of unrecognized inbound email messages.

### Query Parameters

| Parameter   | Type              | Required | Description              |
| ----------- | ----------------- | -------- | ------------------------ |
| `startDate` | string (ISO 8601) | No       | Filter from date         |
| `endDate`   | string (ISO 8601) | No       | Filter to date           |
| `status`    | string            | No       | `PENDING` or `RESOLVED`  |
| `page`      | integer           | No       | Page number (default: 0) |
| `size`      | integer           | No       | Page size (default: 20)  |

### Example Request

```bash
curl -X GET "https://api.welkinhealth.com/acme/live/unrecognized-emails?status=PENDING" \
  -H "Authorization: Bearer {access_token}"
```

### Example Response

```json
{
  "content": [
    {
      "id": "uemail_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "fromEmail": "unknown@example.com",
      "subject": "Question about my prescription",
      "receivedAt": "2026-03-19T08:00:00Z",
      "status": "PENDING",
      "resolvedBy": null,
      "patientId": null,
      "hasAttachment": true
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "page": 0,
  "size": 20
}
```

***

## Get Unrecognized Email by ID

**GET** `/unrecognized-emails/{emailId}`

Returns a single unrecognized email record including the full body.

### Path Parameters

| Parameter | Type   | Required | Description                  |
| --------- | ------ | -------- | ---------------------------- |
| `emailId` | string | Yes      | ID of the unrecognized email |

### Example Request

```bash
curl -X GET "https://api.welkinhealth.com/acme/live/unrecognized-emails/uemail_a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  -H "Authorization: Bearer {access_token}"
```

### Example Response

```json
{
  "id": "uemail_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "fromEmail": "unknown@example.com",
  "subject": "Question about my prescription",
  "body": "Hello, I have a question about my recent prescription refill...",
  "receivedAt": "2026-03-19T08:00:00Z",
  "status": "PENDING",
  "resolvedBy": null,
  "patientId": null,
  "hasAttachment": true
}
```

***

## Get Email Attachment

**GET** `/unrecognized-emails/{emailId}/attachment`

Returns the email attachment file.

### Example Request

```bash
curl -X GET "https://api.welkinhealth.com/acme/live/unrecognized-emails/uemail_a1b2c3d4-e5f6-7890-abcd-ef1234567890/attachment" \
  -H "Authorization: Bearer {access_token}" \
  --output attachment.pdf
```

Returns binary file data with appropriate `Content-Type` header.

***

## Resolve Unrecognized Email

**PATCH** `/unrecognized-emails/{emailId}`

Links the email to a known patient and marks it as resolved.

### Path Parameters

| Parameter | Type   | Required | Description                  |
| --------- | ------ | -------- | ---------------------------- |
| `emailId` | string | Yes      | ID of the unrecognized email |

### Request Body

| Field       | Type   | Required | Description               |
| ----------- | ------ | -------- | ------------------------- |
| `patientId` | string | Yes      | ID of the patient to link |
| `status`    | string | Yes      | Must be `RESOLVED`        |

### Example Request

```bash
curl -X PATCH "https://api.welkinhealth.com/acme/live/unrecognized-emails/uemail_a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{"patientId": "pt_7f3a9b2c-1d4e-4f8a-b5c6-d7e8f9a0b1c2", "status": "RESOLVED"}'
```

### Example Response

```json
{
  "id": "uemail_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "fromEmail": "unknown@example.com",
  "subject": "Question about my prescription",
  "receivedAt": "2026-03-19T08:00:00Z",
  "status": "RESOLVED",
  "resolvedBy": "usr_1a2b3c4d-5e6f-7890-abcd-ef1234567890",
  "patientId": "pt_7f3a9b2c-1d4e-4f8a-b5c6-d7e8f9a0b1c2",
  "hasAttachment": true
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.welkinhealth.com/developer-and-integration-guide/api-reference/unrecognized-emails.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
