# SMS

The SMS API provides read access to SMS message records associated with patients.

**Base path:** `/{tenantName}/{instanceName}/patients/{patientId}/sms`

***

## Endpoints

### GET Get All SMS

**GET** `/{tenantName}/{instanceName}/patients/{patientId}/sms`

Returns all SMS messages associated with a patient.

#### Query Parameters

| Parameter   | Type    | Default | Description                       |
| ----------- | ------- | ------- | --------------------------------- |
| `page`      | integer | `0`     | Page number                       |
| `size`      | integer | `20`    | Results per page                  |
| `direction` | string  | —       | Filter by `INBOUND` or `OUTBOUND` |
| `startDate` | string  | —       | Start of date range (ISO 8601)    |
| `endDate`   | string  | —       | End of date range (ISO 8601)      |

#### Example Response `200 OK`

```json
{
  "data": [
    {
      "id": "sms-uuid",
      "patientId": "a1b2c3d4",
      "direction": "OUTBOUND",
      "body": "Your appointment is confirmed for March 20 at 2:00 PM.",
      "sentAt": "2026-03-19T09:15:00Z",
      "status": "DELIVERED",
      "hasAttachment": false
    }
  ]
}
```

***

### GET Get SMS by ID

**GET** `/{tenantName}/{instanceName}/patients/{patientId}/sms/{smsId}`

Returns a single SMS record with full message metadata.

***

### GET Download SMS Attachment

**GET** `/{tenantName}/{instanceName}/patients/{patientId}/sms/{smsId}/attachment`

Downloads the file attachment from an SMS message.

#### Response

| Header                | Value                                                               |
| --------------------- | ------------------------------------------------------------------- |
| `Content-Type`        | MIME type of the attachment (e.g., `image/jpeg`, `application/pdf`) |
| `Content-Disposition` | `attachment; filename="{originalFilename}"`                         |

> Only available for messages where `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/sms.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.
