> For the complete documentation index, see [llms.txt](https://docs.welkinhealth.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.welkinhealth.com/api-reference/export.md).

# Export

This is URL structure for export:

`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`

When working with the API, the `resourceName` parameter must be in uppercase.

This parameter specifies the type of resource you want to work with and can have one of the following values:

| Name                   | Description                                               |
| ---------------------- | --------------------------------------------------------- |
| ASSESSMENT             | Exports all assessments stored in the database            |
| CALENDAR\_EVENT        | Exports all calendar events stored in the database        |
| CDT\_RECORD            | Exports all cdt records stored in the database            |
| CHAT                   | Exports all chat messages records stored in the database  |
| EMAIL                  | Exports all emails stored in the database                 |
| ENCOUNTER              | Exports all encounters stored in the database             |
| ENCOUNTER\_COMMENT     | Exports all encounter comments stored in the database     |
| ENCOUNTER\_DISPOSITION | Exports all encounter dispositions stored in the database |
| PATIENT                | Exports all patients stored in the database               |
| PFA                    | Exports all assessments sent to the patient               |
| SMS                    | Exports all sms records stored in the database            |
| TASK                   | Exports all tasks stored in the database                  |
| VOICE\_CALL            | Exports all voice calls stored in the database            |
| WHATS\_APP             | Exports all WhatsApp messages stored in the database      |

**Response Body**

The response body contains a `cursor` object with the following properties:

* `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.
* `end:` The date the selection ended for the current request.
* `hasNext:` A boolean indicating whether there are more records left to retrieve.
* `pageSize:` The maximum number of records in the `data` field for the current request.

**Note:**\
To fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a "less than or equal" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.

**Permission**\
The export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.

To perform exports, the API client needs to have the appropriate export permissions

## Export Formation Version

> The endpoint for retrieving Formation versions.\
> \
> This will return a list of all available Formation versions.

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/formation_version":{"get":{"summary":"Export Formation Version","tags":["Export"],"operationId":"Export_Formation_Version","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"pageSize","in":"query","required":false,"description":"","schema":{"type":"string"}}],"responses":{"200":{"description":"Cursor-paginated export data (generic placeholder).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"The endpoint for retrieving Formation versions.\n\nThis will return a list of all available Formation versions."}}}}
```

## Export Assessment Formation

> Endpoint to obtain the Assessment Formation for a selected version.\
> \
> The \`{{version}}\` parameter should be either a version number, "current," or "draft" ("-1").\
> \
> The response will be provided in a ZIP file. To save it, click on "Save response to file." The ZIP file contains a JSON file with the Assessment formation for the selected version.

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}},"Version":{"name":"version","in":"path","required":true,"description":"Formation version identifier (e.g. `current`, `draft`, or a version number)","schema":{"type":"string"}}},"schemas":{"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/formations/{version}/assessments":{"get":{"summary":"Export Assessment Formation","tags":["Export"],"operationId":"Export_Assessment_Formation","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"$ref":"#/components/parameters/Version"}],"responses":{"200":{"description":"Cursor-paginated export data (generic placeholder).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Endpoint to obtain the Assessment Formation for a selected version.\n\nThe `{{version}}` parameter should be either a version number, \"current,\" or \"draft\" (\"-1\").\n\nThe response will be provided in a ZIP file. To save it, click on \"Save response to file.\" The ZIP file contains a JSON file with the Assessment formation for the selected version."}}}}
```

## Export CDT Records

> Exports all cdt records stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"CdtRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"patientId":{"type":"string","format":"uuid"},"cdtId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"cdtName":{"type":"string"},"jsonBody":{"type":"object","additionalProperties":true,"description":"Fields defined by the CDT schema, plus system fields (id, created_at, created_by, etc)."}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/CDT_RECORD":{"get":{"summary":"Export CDT Records","tags":["Export"],"operationId":"Export_CDT_Records","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all CDT records for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CdtRecord"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all cdt records stored in database"}}}}
```

## Export PDT Records

> Exports all pdt records stored in database. To export, the API client needs to have permissions to export PDT Records (permissions are configured in Designer under Security Policies).

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"PdtRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"fullValue":{"type":"string","nullable":true},"deleted":{"type":"boolean"},"pdtName":{"type":"string"},"jsonBody":{"type":"object","additionalProperties":true}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/PDT_RECORD":{"get":{"summary":"Export PDT Records","tags":["Export"],"operationId":"Export_PDT_Records","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PdtRecord"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all pdt records stored in database. To export, the API client needs to have permissions to export PDT Records (permissions are configured in Designer under Security Policies)."}}}}
```

## Export Care Plans

> Exports all care plans stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"CarePlanExportRecord":{"allOf":[{"$ref":"#/components/schemas/CarePlan"},{"type":"object","properties":{"goals":{"type":"array","items":{"$ref":"#/components/schemas/Goal"}}}}]},"CarePlan":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdByName":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedByName":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"},"patientId":{"type":"string","format":"uuid"},"patientOverview":{"$ref":"#/components/schemas/PatientOverview","nullable":true}}},"PatientOverview":{"type":"object","properties":{"createdByName":{"type":"string","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedByName":{"type":"string","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"overview":{"type":"string","nullable":true}}},"Goal":{"type":"object","properties":{"details":{"$ref":"#/components/schemas/GoalDetails"},"tasks":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"comments":{"type":"array","items":{"$ref":"#/components/schemas/GoalComment"}}}},"GoalDetails":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdByName":{"type":"string","readOnly":true},"createdAt":{"type":"string","readOnly":true},"updatedByName":{"type":"string","readOnly":true},"updatedAt":{"type":"string","readOnly":true},"name":{"type":"string","nullable":true},"type":{"type":"string","nullable":true},"priority":{"$ref":"#/components/schemas/GoalPriority"},"status":{"$ref":"#/components/schemas/GoalStatus"},"templateName":{"type":"string","nullable":true}}},"GoalPriority":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"GoalStatus":{"type":"string","enum":["ACTIVE","COMPLETED","REMOVED"]},"Task":{"type":"object","required":["name","status","priority","assignee"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdBy":{"type":"string","format":"uuid","readOnly":true},"updatedBy":{"type":"string","format":"uuid","readOnly":true},"createdByName":{"type":"string","readOnly":true},"updatedByName":{"type":"string","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"dueDate":{"type":"string","format":"date-time","nullable":true},"status":{"$ref":"#/components/schemas/TaskStatus"},"priority":{"$ref":"#/components/schemas/TaskPriority"},"patient":{"$ref":"#/components/schemas/IndexedNamed","description":"Set automatically from the path patientId when created via the Goal Task endpoint."},"assignee":{"$ref":"#/components/schemas/TaskUser"},"watchers":{"type":"array","items":{"$ref":"#/components/schemas/TaskUser"}},"comments":{"type":"array","items":{"$ref":"#/components/schemas/TaskComment"}},"goalId":{"type":"string","format":"uuid","nullable":true,"readOnly":true},"templateName":{"type":"string","nullable":true},"createdType":{"$ref":"#/components/schemas/TaskCreatedType"},"sourceId":{"type":"string","format":"uuid","nullable":true},"sourceType":{"$ref":"#/components/schemas/TaskSourceType"},"hiddenPhi":{"type":"boolean"},"watchersType":{"$ref":"#/components/schemas/WatchersType","default":"POINT_OF_CONTACT"}}},"TaskStatus":{"type":"string","enum":["TODO","IN_PROGRESS","COMPLETED","CANCELED"]},"TaskPriority":{"type":"string","enum":["LOW","MEDIUM","HIGH","URGENT"]},"IndexedNamed":{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true}}},"TaskUser":{"allOf":[{"$ref":"#/components/schemas/IndexedNamed"},{"type":"object","properties":{"enabled":{"type":"boolean","nullable":true}}}]},"TaskComment":{"type":"object","required":["text"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"author":{"$ref":"#/components/schemas/TaskUser"},"text":{"type":"string"},"patient":{"$ref":"#/components/schemas/IndexedNamed"},"user":{"$ref":"#/components/schemas/IndexedNamed"}}},"TaskCreatedType":{"type":"string","enum":["AUTOMATION","USER"]},"TaskSourceType":{"type":"string","enum":["ASSESSMENT"]},"WatchersType":{"type":"string","enum":["POINT_OF_CONTACT","CARE_TEAM"]},"GoalComment":{"type":"object","required":["text"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true,"nullable":true},"createdByName":{"type":"string","readOnly":true,"nullable":true},"createdAt":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"updatedByName":{"type":"string","readOnly":true,"nullable":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"text":{"type":"string"}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/CARE_PLAN":{"get":{"summary":"Export Care Plans","tags":["Export"],"operationId":"Export_Care_Plans","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CarePlanExportRecord"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all care plans stored in database"}}}}
```

## Export Voice Calls

> Exports all voices calls stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"VoiceCall":{"type":"object","required":["sender"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"createdBy":{"type":"string","format":"uuid","readOnly":true},"updatedBy":{"type":"string","format":"uuid","readOnly":true},"createdByName":{"type":"string","readOnly":true},"updatedByName":{"type":"string","readOnly":true},"sendNow":{"type":"boolean"},"sentAt":{"type":"string","format":"date-time","nullable":true},"receivedAt":{"type":"string","format":"date-time","nullable":true},"deletedAt":{"type":"string","format":"date-time","nullable":true},"date":{"type":"string","format":"date-time","nullable":true},"careTeam":{"type":"string","nullable":true},"patientInfo":{"type":"string","nullable":true},"sender":{"type":"string","format":"uuid"},"senderType":{"$ref":"#/components/schemas/ActorType"},"senderName":{"type":"string","nullable":true},"from":{"type":"string","nullable":true},"receiver":{"type":"string","format":"uuid","nullable":true},"receiverType":{"$ref":"#/components/schemas/ActorType"},"receiverName":{"type":"string","nullable":true},"to":{"type":"string","nullable":true},"direction":{"$ref":"#/components/schemas/Direction"},"externalId":{"type":"string","nullable":true},"starred":{"type":"boolean"},"errorMessage":{"type":"string","nullable":true},"assignedBy":{"type":"string","format":"uuid","readOnly":true,"nullable":true},"assignedByName":{"type":"string","readOnly":true,"nullable":true},"hasHistory":{"type":"boolean","readOnly":true},"unrecognized":{"type":"boolean","readOnly":true},"childCallSid":{"type":"string","nullable":true},"parentCallStatus":{"$ref":"#/components/schemas/VoiceCallStatus"},"childCallStatus":{"$ref":"#/components/schemas/VoiceCallStatus"},"userPhone":{"type":"string","nullable":true},"parentCallDuration":{"type":"integer","nullable":true},"childCallDuration":{"type":"integer","nullable":true},"recorded":{"type":"boolean"},"recordingDuration":{"type":"integer","nullable":true},"recordingSid":{"type":"string","nullable":true},"recordingUrl":{"type":"string","nullable":true},"recordingFile":{"$ref":"#/components/schemas/File","nullable":true},"phoneId":{"type":"string","format":"uuid","nullable":true}}},"ActorType":{"type":"string","enum":["CS_TOOL_CLIENT","USER","API_CLIENT","PATIENT","CONTACT","SYSTEM","WEBHOOK","INTERNAL_SERVICE","ANONYMOUS","UNRECOGNISED"]},"Direction":{"type":"string","enum":["OUT","IN"]},"VoiceCallStatus":{"type":"string","enum":["QUEUED","INITIATED","RINGING","IN_PROGRESS","COMPLETED","BUSY","NO_ANSWER","CANCELED","FAILED"]},"File":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"originalName":{"type":"string"},"size":{"type":"integer","description":"Bytes"},"contentType":{"type":"string"},"storageKey":{"type":"string"}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/VOICE_CALL":{"get":{"summary":"Export Voice Calls","tags":["Export"],"operationId":"Export_Voice_Calls","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all Voice calls for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/VoiceCall"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all voices calls stored in database"}}}}
```

## Export  Patients

> Exports all patients stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"PatientResponse":{"type":"object","description":"Patient record. Response is extensible — tenant-configured custom attributes appear as additional top-level properties beyond those listed here.","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"externalGuid":{"type":"string","format":"uuid","nullable":true},"externalId":{"type":"string","nullable":true},"mrn":{"type":"string","nullable":true},"nric":{"type":"string","nullable":true},"accessCode":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdByName":{"type":"string"},"updatedByName":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"middleName":{"type":"string","nullable":true},"birthDate":{"type":"string","format":"date-time","nullable":true},"gender":{"$ref":"#/components/schemas/PatientGender"},"maritalStatus":{"$ref":"#/components/schemas/MaritalStatus"},"primaryLanguage":{"$ref":"#/components/schemas/PatientLanguage"},"secondaryLanguage":{"$ref":"#/components/schemas/PatientLanguage"},"email":{"type":"string","format":"email","nullable":true},"secondaryEmail":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"phoneLabel":{"type":"string","nullable":true},"primaryPhoneCapabilities":{"type":"array","items":{"$ref":"#/components/schemas/PhoneCapability"}},"secondaryPhone":{"type":"string","nullable":true},"secondaryPhoneLabel":{"type":"string","nullable":true},"secondaryPhoneCapabilities":{"type":"array","items":{"$ref":"#/components/schemas/PhoneCapability"}},"preferableInstancePhoneId":{"type":"string","format":"uuid","nullable":true},"country":{"type":"string","nullable":true},"state":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"addressLine1":{"type":"string","nullable":true},"addressLine2":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true},"patientType":{"$ref":"#/components/schemas/PatientType"},"notes":{"type":"string","nullable":true},"careTeamMembers":{"type":"array","items":{"$ref":"#/components/schemas/CareTeamMember"},"readOnly":true,"description":"Deprecated — use careTeam."},"patientPrograms":{"type":"array","items":{"$ref":"#/components/schemas/PatientProgram"},"readOnly":true},"careTeam":{"type":"array","items":{"$ref":"#/components/schemas/PatientTeamMember"}},"territorialTeam":{"type":"array","items":{"$ref":"#/components/schemas/PatientTeamMember"},"readOnly":true,"description":"Only populated when the `expand=true` query param is set."},"cadence":{"type":"array","items":{"$ref":"#/components/schemas/PatientCadence"}},"patientRegion":{"type":"string","nullable":true},"patientRegionTitle":{"type":"string","readOnly":true,"nullable":true},"patientTerritory":{"type":"string","nullable":true},"pointOfContact":{"$ref":"#/components/schemas/PatientTeamMember","nullable":true}}},"PatientGender":{"type":"string","enum":["MALE","FEMALE","OTHER","UNKNOWN"]},"MaritalStatus":{"type":"string","enum":["A","D","I","L","M","P","S","T","U","W","UKN"],"description":"A = Annulled, D = Divorced, I = Interlocutory, L = Legally Separated, M = Married, P = Polygamous, S = Never Married, T = Domestic partner, U = Unmarried, W = Widowed, UKN = Unknown"},"PatientLanguage":{"type":"string","enum":["ENGLISH","SPANISH","FRENCH","PORTUGUESE","GERMAN","ITALIAN","ARABIC","CHINESE","MANDARIN","VIETNAMESE","JAPANESE","RUSSIAN","ALBANIAN","OTHER"]},"PhoneCapability":{"type":"string","enum":["VOICE_CALL","SMS","WHATS_APP"]},"PatientType":{"type":"string","enum":["ADULT","MINOR","COUPLE"]},"CareTeamMember":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"User UUID"},"pointOfContact":{"type":"boolean","description":"Whether this member is the point of contact"}},"required":["id"]},"PatientProgram":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdByName":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedByName":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"},"programName":{"type":"string"},"programTitle":{"type":"string"},"programDescription":{"type":"string","nullable":true},"assigned":{"type":"boolean","default":true},"patientId":{"type":"string","format":"uuid"},"currentPhase":{"$ref":"#/components/schemas/PatientPhase"},"status":{"$ref":"#/components/schemas/PatientProgramStatus"},"compatibleWithCurrentVersion":{"type":"boolean"},"pathHistory":{"type":"array","items":{"$ref":"#/components/schemas/PatientPhase"}}}},"PatientPhase":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"createdBy":{"type":"string","format":"uuid","nullable":true},"createdByName":{"type":"string"},"name":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"currentVersion":{"type":"string"},"deleted":{"type":"boolean"}}},"PatientProgramStatus":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","INTERRUPTED","FINISHED"]},"PatientTeamMember":{"type":"object","description":"Full care team member representation returned on Patient reads.","properties":{"id":{"type":"string","format":"uuid"},"username":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/SimpleRole"}},"pointOfContact":{"type":"boolean"},"enabled":{"type":"boolean"}}},"SimpleRole":{"type":"object","properties":{"name":{"type":"string"},"primaryRole":{"type":"boolean"},"description":{"type":"string","nullable":true},"instanceId":{"type":"string","format":"uuid","nullable":true}}},"PatientCadence":{"type":"object","required":["priority"],"properties":{"schedules":{"type":"array","items":{"$ref":"#/components/schemas/CadenceSchedule"}},"priority":{"$ref":"#/components/schemas/PatientCadencePriority"}}},"CadenceSchedule":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":23},"minute":{"type":"integer","minimum":0,"maximum":59},"days":{"type":"array","items":{"$ref":"#/components/schemas/DayOfWeek"}},"weekNumbers":{"type":"array","items":{"type":"integer"}}}},"DayOfWeek":{"type":"string","enum":["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"]},"PatientCadencePriority":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/PATIENT":{"get":{"summary":"Export  Patients","tags":["Export"],"operationId":"Export_Patients","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PatientResponse"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all patients stored in database"}}}}
```

## Export Chat Messages

> Exports all chat messages stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"ChatMessage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"sender":{"$ref":"#/components/schemas/ChatUser","nullable":true,"readOnly":true},"receiver":{"$ref":"#/components/schemas/ChatUser","nullable":true,"readOnly":true},"message":{"type":"string","description":"Required if attachmentAsFiles is empty."},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/File"}},"skipEvent":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true,"readOnly":true}}},"ChatUser":{"type":"object","properties":{"clientType":{"$ref":"#/components/schemas/ClientType"},"id":{"type":"string","format":"uuid"},"titleName":{"type":"string","nullable":true},"patientFullName":{"type":"string","nullable":true}}},"ClientType":{"type":"string","enum":["CS_TOOL_CLIENT","USER","API_CLIENT","PATIENT","CONTACT","WEBHOOK","INTERNAL_SERVICE","ANONYMOUS"]},"File":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"originalName":{"type":"string"},"size":{"type":"integer","description":"Bytes"},"contentType":{"type":"string"},"storageKey":{"type":"string"}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/CHAT":{"get":{"summary":"Export Chat Messages","tags":["Export"],"operationId":"Export_Chat_Messages","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"}},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20}}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessage"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all chat messages stored in database"}}}}
```

## Export  Programs

> Exports all programs stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"PatientProgram":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdByName":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedByName":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"},"programName":{"type":"string"},"programTitle":{"type":"string"},"programDescription":{"type":"string","nullable":true},"assigned":{"type":"boolean","default":true},"patientId":{"type":"string","format":"uuid"},"currentPhase":{"$ref":"#/components/schemas/PatientPhase"},"status":{"$ref":"#/components/schemas/PatientProgramStatus"},"compatibleWithCurrentVersion":{"type":"boolean"},"pathHistory":{"type":"array","items":{"$ref":"#/components/schemas/PatientPhase"}}}},"PatientPhase":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"createdBy":{"type":"string","format":"uuid","nullable":true},"createdByName":{"type":"string"},"name":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"currentVersion":{"type":"string"},"deleted":{"type":"boolean"}}},"PatientProgramStatus":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","INTERRUPTED","FINISHED"]},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/PATIENT_PROGRAM":{"get":{"summary":"Export  Programs","tags":["Export"],"operationId":"Export_Programs","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all programs for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PatientProgram"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all programs stored in database"}}}}
```

## Export SMS

> Exports all sms records stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"Sms":{"type":"object","required":["sender","message"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"createdBy":{"type":"string","format":"uuid","readOnly":true},"updatedBy":{"type":"string","format":"uuid","readOnly":true},"createdByName":{"type":"string","readOnly":true},"updatedByName":{"type":"string","readOnly":true},"sendNow":{"type":"boolean"},"sentAt":{"type":"string","format":"date-time","nullable":true},"receivedAt":{"type":"string","format":"date-time","nullable":true},"deletedAt":{"type":"string","format":"date-time","nullable":true},"date":{"type":"string","format":"date-time","nullable":true},"careTeam":{"type":"string","nullable":true},"patientInfo":{"type":"string","nullable":true},"sender":{"type":"string","format":"uuid"},"senderType":{"$ref":"#/components/schemas/ActorType"},"senderName":{"type":"string","nullable":true},"from":{"type":"string","nullable":true},"receiver":{"type":"string","format":"uuid","nullable":true},"receiverType":{"$ref":"#/components/schemas/ActorType"},"receiverName":{"type":"string","nullable":true},"to":{"type":"string","nullable":true},"direction":{"$ref":"#/components/schemas/Direction"},"externalId":{"type":"string","nullable":true},"starred":{"type":"boolean"},"errorMessage":{"type":"string","nullable":true},"assignedBy":{"type":"string","format":"uuid","readOnly":true,"nullable":true},"assignedByName":{"type":"string","readOnly":true,"nullable":true},"hasHistory":{"type":"boolean","readOnly":true},"unrecognized":{"type":"boolean","readOnly":true},"message":{"type":"string","maxLength":1600},"parts":{"type":"integer","readOnly":true},"status":{"$ref":"#/components/schemas/SmsStatus"},"messageType":{"$ref":"#/components/schemas/MessageType","default":"CARE_TEAM"},"phoneId":{"type":"string","format":"uuid"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/File"},"readOnly":true},"attachmentsFromTemplate":{"type":"array","items":{"$ref":"#/components/schemas/File"}},"skipEvent":{"type":"boolean"}}},"ActorType":{"type":"string","enum":["CS_TOOL_CLIENT","USER","API_CLIENT","PATIENT","CONTACT","SYSTEM","WEBHOOK","INTERNAL_SERVICE","ANONYMOUS","UNRECOGNISED"]},"Direction":{"type":"string","enum":["OUT","IN"]},"SmsStatus":{"type":"string","enum":["SCHEDULED","ACCEPTED","SENT","RECEIVED","DELIVERED","UNDELIVERED","FAILED","UNRECOGNISED","DELETED"]},"MessageType":{"type":"string","enum":["CARE_TEAM","SYSTEM_TO_USER","SYSTEM_TO_PATIENT"]},"File":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"originalName":{"type":"string"},"size":{"type":"integer","description":"Bytes"},"contentType":{"type":"string"},"storageKey":{"type":"string"}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/SMS":{"get":{"summary":"Export SMS","tags":["Export"],"operationId":"Export_SMS","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all SMS for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Sms"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all sms records stored in database"}}}}
```

## GET /{tenantName}/{instanceName}/export/WHATS\_APP

> Export WhatsApp Messages

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/WHATS_APP":{"get":{"summary":"Export WhatsApp Messages","tags":["Export"],"operationId":"Export_WhatsApp_Messages","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"}},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20}}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Export Calendar Events

> Exports all calendar events stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"CalendarEvent":{"type":"object","required":["startDateTime","endDateTime","hostId","participants"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdBy":{"type":"string","format":"uuid","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedBy":{"type":"string","format":"uuid","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"externalId":{"type":"string","nullable":true},"externalIdUpdatedAt":{"type":"string","format":"date-time","nullable":true},"eventTitle":{"type":"string","nullable":true},"eventDescription":{"type":"string","nullable":true},"startDateTime":{"type":"string","format":"date-time"},"localStartDateTime":{"type":"string","format":"date-time","readOnly":true},"endDateTime":{"type":"string","format":"date-time"},"localEndDateTime":{"type":"string","format":"date-time","readOnly":true},"allDayEvent":{"type":"boolean"},"duration":{"type":"integer","readOnly":true,"nullable":true},"eventType":{"type":"string","description":"Free text — commonly one of CalendarEventType's values."},"eventStatus":{"type":"string","description":"Free text — commonly one of CalendarEventStatus's values."},"eventMode":{"type":"string","description":"Free text — commonly one of DeliveryMethod's values."},"eventColor":{"type":"string","nullable":true},"hostId":{"type":"string","format":"uuid"},"timezone":{"type":"string","nullable":true},"additionalInfo":{"type":"object","additionalProperties":true,"nullable":true},"acuityAppointmentId":{"type":"integer","nullable":true},"externalCalendarEventId":{"type":"string","nullable":true},"encounterInfo":{"$ref":"#/components/schemas/CalendarEventEncounterInfo","nullable":true},"participants":{"type":"array","items":{"$ref":"#/components/schemas/CalendarParticipant"}},"externalEventMetadata":{"$ref":"#/components/schemas/ExternalEventMetadata","nullable":true}}},"CalendarEventEncounterInfo":{"type":"object","required":["encounterId"],"properties":{"encounterId":{"type":"string","format":"uuid"},"dispositionId":{"type":"string","format":"uuid","nullable":true},"templateName":{"type":"string","nullable":true},"templateTitle":{"type":"string","nullable":true},"patientId":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"type":{"type":"string","nullable":true},"status":{"$ref":"#/components/schemas/EncounterStatus"},"serviceCost":{"type":"integer","nullable":true},"preVisitCost":{"type":"integer","nullable":true},"responsibleParty":{"$ref":"#/components/schemas/ResponsibleParty"},"visitServices":{"type":"array","items":{"$ref":"#/components/schemas/EncounterVisitService"}},"location":{"type":"string","nullable":true}}},"EncounterStatus":{"type":"string","enum":["DRAFT","OPEN","CANCELED","CANCELLED","FINALIZED"]},"ResponsibleParty":{"type":"string","enum":["SELF_PAY","INSURANCE","UNKNOWN"],"deprecated":true},"EncounterVisitService":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"quantity":{"type":"number","default":1},"serviceCost":{"type":"integer","nullable":true,"description":"Cost in cents"},"cancellationFee":{"type":"integer","nullable":true,"description":"Cost in cents"},"preVisitCost":{"type":"integer","nullable":true,"description":"Cost in cents"},"modifiers":{"type":"array","items":{"type":"string"}}}},"CalendarParticipant":{"type":"object","required":["participantId","participantRole"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"participantId":{"type":"string","format":"uuid"},"participantRole":{"$ref":"#/components/schemas/CalendarParticipantRole"},"participationStatus":{"$ref":"#/components/schemas/ParticipationStatus"},"attended":{"type":"boolean"},"timezone":{"type":"string","nullable":true},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"deleted":{"type":"boolean","nullable":true},"hasAccess":{"type":"boolean","nullable":true},"hiddenPhi":{"type":"boolean"},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"gender":{"$ref":"#/components/schemas/PatientGender"},"birthDate":{"type":"string","format":"date-time","nullable":true},"enabled":{"type":"boolean","nullable":true}}},"CalendarParticipantRole":{"type":"string","enum":["patient","psm"]},"ParticipationStatus":{"type":"string","enum":["UNKNOWN","DECLINED","TENTATIVE","ACCEPTED"]},"PatientGender":{"type":"string","enum":["MALE","FEMALE","OTHER","UNKNOWN"]},"ExternalEventMetadata":{"type":"object","properties":{"participants":{"type":"array","items":{"$ref":"#/components/schemas/ExternalEventParticipant"}},"calendarProvider":{"$ref":"#/components/schemas/CalendarProvider"}}},"ExternalEventParticipant":{"type":"object","properties":{"email":{"type":"string","format":"email"},"status":{"$ref":"#/components/schemas/ParticipationStatus"},"owner":{"type":"boolean"}}},"CalendarProvider":{"type":"string","enum":["GOOGLE","MICROSOFT"]},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/CALENDAR_EVENT":{"get":{"summary":"Export Calendar Events","tags":["Export"],"operationId":"Export_Calendar_Events","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CalendarEvent"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all calendar events stored in database"}}}}
```

## Export Email

> Exports all emails stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"Email":{"type":"object","required":["sender","body"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"createdBy":{"type":"string","format":"uuid","readOnly":true},"updatedBy":{"type":"string","format":"uuid","readOnly":true},"createdByName":{"type":"string","readOnly":true},"updatedByName":{"type":"string","readOnly":true},"sendNow":{"type":"boolean"},"sentAt":{"type":"string","format":"date-time","nullable":true},"receivedAt":{"type":"string","format":"date-time","nullable":true},"deletedAt":{"type":"string","format":"date-time","nullable":true},"date":{"type":"string","format":"date-time","nullable":true},"careTeam":{"type":"string","nullable":true},"patientInfo":{"type":"string","nullable":true},"sender":{"type":"string","format":"uuid"},"senderType":{"$ref":"#/components/schemas/ActorType"},"senderName":{"type":"string","nullable":true},"from":{"type":"string","nullable":true},"receiver":{"type":"string","format":"uuid","nullable":true},"receiverType":{"$ref":"#/components/schemas/ActorType"},"receiverName":{"type":"string","nullable":true},"to":{"type":"string","nullable":true},"direction":{"$ref":"#/components/schemas/Direction"},"externalId":{"type":"string","nullable":true},"starred":{"type":"boolean"},"errorMessage":{"type":"string","nullable":true},"assignedBy":{"type":"string","format":"uuid","readOnly":true,"nullable":true},"assignedByName":{"type":"string","readOnly":true,"nullable":true},"hasHistory":{"type":"boolean","readOnly":true},"unrecognized":{"type":"boolean","readOnly":true},"subject":{"type":"string","nullable":true},"body":{"type":"string"},"emailEditorJson":{"type":"string","nullable":true},"status":{"$ref":"#/components/schemas/EmailStatus"},"secure":{"type":"boolean","default":false},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/File"},"readOnly":true},"attachmentsFromTemplate":{"type":"array","items":{"$ref":"#/components/schemas/File"}},"bodyAttachments":{"type":"array","items":{"$ref":"#/components/schemas/SignedFile"}},"messageType":{"$ref":"#/components/schemas/MessageType","default":"CARE_TEAM"},"bodyType":{"$ref":"#/components/schemas/EmailBodyType","default":"PLAIN_TEXT"},"inReplyTo":{"type":"string","nullable":true},"messageId":{"type":"string","nullable":true},"skipEvent":{"type":"boolean"}}},"ActorType":{"type":"string","enum":["CS_TOOL_CLIENT","USER","API_CLIENT","PATIENT","CONTACT","SYSTEM","WEBHOOK","INTERNAL_SERVICE","ANONYMOUS","UNRECOGNISED"]},"Direction":{"type":"string","enum":["OUT","IN"]},"EmailStatus":{"type":"string","enum":["SCHEDULED","ACCEPTED","SENT","DELIVERED","REJECTED","FAILED","UNRECOGNISED","DELETED","CLICKED","OPENED"]},"File":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"originalName":{"type":"string"},"size":{"type":"integer","description":"Bytes"},"contentType":{"type":"string"},"storageKey":{"type":"string"}}},"SignedFile":{"allOf":[{"$ref":"#/components/schemas/File"},{"type":"object","properties":{"url":{"type":"string","format":"uri"},"thumbnailUrl":{"type":"string","format":"uri","nullable":true}}}]},"MessageType":{"type":"string","enum":["CARE_TEAM","SYSTEM_TO_USER","SYSTEM_TO_PATIENT"]},"EmailBodyType":{"type":"string","enum":["PLAIN_TEXT","HTML"]},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/EMAIL":{"get":{"summary":"Export Email","tags":["Export"],"operationId":"Export_Email","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all emails for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Email"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all emails stored in database"}}}}
```

## Export Tasks

> Exports all tasks stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"Task":{"type":"object","required":["name","status","priority","assignee"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdBy":{"type":"string","format":"uuid","readOnly":true},"updatedBy":{"type":"string","format":"uuid","readOnly":true},"createdByName":{"type":"string","readOnly":true},"updatedByName":{"type":"string","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"dueDate":{"type":"string","format":"date-time","nullable":true},"status":{"$ref":"#/components/schemas/TaskStatus"},"priority":{"$ref":"#/components/schemas/TaskPriority"},"patient":{"$ref":"#/components/schemas/IndexedNamed","description":"Set automatically from the path patientId when created via the Goal Task endpoint."},"assignee":{"$ref":"#/components/schemas/TaskUser"},"watchers":{"type":"array","items":{"$ref":"#/components/schemas/TaskUser"}},"comments":{"type":"array","items":{"$ref":"#/components/schemas/TaskComment"}},"goalId":{"type":"string","format":"uuid","nullable":true,"readOnly":true},"templateName":{"type":"string","nullable":true},"createdType":{"$ref":"#/components/schemas/TaskCreatedType"},"sourceId":{"type":"string","format":"uuid","nullable":true},"sourceType":{"$ref":"#/components/schemas/TaskSourceType"},"hiddenPhi":{"type":"boolean"},"watchersType":{"$ref":"#/components/schemas/WatchersType","default":"POINT_OF_CONTACT"}}},"TaskStatus":{"type":"string","enum":["TODO","IN_PROGRESS","COMPLETED","CANCELED"]},"TaskPriority":{"type":"string","enum":["LOW","MEDIUM","HIGH","URGENT"]},"IndexedNamed":{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true}}},"TaskUser":{"allOf":[{"$ref":"#/components/schemas/IndexedNamed"},{"type":"object","properties":{"enabled":{"type":"boolean","nullable":true}}}]},"TaskComment":{"type":"object","required":["text"],"properties":{"id":{"type":"string","format":"uuid","readOnly":true},"createdAt":{"type":"string","format":"date-time","readOnly":true},"author":{"$ref":"#/components/schemas/TaskUser"},"text":{"type":"string"},"patient":{"$ref":"#/components/schemas/IndexedNamed"},"user":{"$ref":"#/components/schemas/IndexedNamed"}}},"TaskCreatedType":{"type":"string","enum":["AUTOMATION","USER"]},"TaskSourceType":{"type":"string","enum":["ASSESSMENT"]},"WatchersType":{"type":"string","enum":["POINT_OF_CONTACT","CARE_TEAM"]},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/TASK":{"get":{"summary":"Export Tasks","tags":["Export"],"operationId":"Export_Tasks","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all tasks stored in database"}}}}
```

## Export Assessment

> Exports all assessments stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"AssessmentExportRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"finalizedDate":{"type":"string","format":"date-time","nullable":true},"assessmentName":{"type":"string"},"assessmentTitle":{"type":"string","nullable":true},"assessmentCdtName":{"type":"string","nullable":true},"version":{"type":"integer","nullable":true},"patientId":{"type":"string","format":"uuid"},"status":{"type":"string"},"cdtRecordId":{"type":"string","format":"uuid","nullable":true},"scoringRecordId":{"type":"string","format":"uuid","nullable":true},"answers":{"type":"object","additionalProperties":true},"scoring":{"type":"object","additionalProperties":true},"questions":{"type":"object","additionalProperties":true}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/ASSESSMENT":{"get":{"summary":"Export Assessment","tags":["Export"],"operationId":"Export_Assessment","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all assessments for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AssessmentExportRecord"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all assessments stored in database"}}}}
```

## Export PFA

> Exports all assessments sent to the patient

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/PFA":{"get":{"summary":"Export PFA","tags":["Export"],"operationId":"Export_PFA","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all assessments sent to the patient"}}}}
```

## Export Encounter

> Exports all encounters stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"CdtRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"patientId":{"type":"string","format":"uuid"},"cdtId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"cdtName":{"type":"string"},"jsonBody":{"type":"object","additionalProperties":true,"description":"Fields defined by the CDT schema, plus system fields (id, created_at, created_by, etc)."}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/ENCOUNTER":{"get":{"summary":"Export Encounter","tags":["Export"],"operationId":"Export_Encounter","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all CDT records for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CdtRecord"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all encounters stored in database"}}}}
```

## Export Encounter Comments

> Exports all encounter comments stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"EncounterComment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdByName":{"type":"string"},"updatedByName":{"type":"string"},"encounterId":{"type":"string","format":"uuid"},"text":{"type":"string"}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/ENCOUNTER_COMMENT":{"get":{"summary":"Export Encounter Comments","tags":["Export"],"operationId":"Export_Encounter_Comments","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EncounterComment"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all encounter comments stored in database"}}}}
```

## Export Encounter Disposition

> Exports all encounter dispositions stored in database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"CdtRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"patientId":{"type":"string","format":"uuid"},"cdtId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"cdtName":{"type":"string"},"jsonBody":{"type":"object","additionalProperties":true,"description":"Fields defined by the CDT schema, plus system fields (id, created_at, created_by, etc)."}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/ENCOUNTER_DISPOSITION":{"get":{"summary":"Export Encounter Disposition","tags":["Export"],"operationId":"Export_Encounter_Disposition","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 500. If the parameter is not specified, the page size will be 500"},{"name":"patientIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Allows you to export all CDT records for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CdtRecord"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all encounter dispositions stored in database"}}}}
```

## Export Automation Audit

> Exports all automation audit records stored in the database

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/automation-audit":{"get":{"summary":"Export Automation Audit","tags":["Export"],"operationId":"Export_Automation_Audit","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Min value is 1, max value is 1000. If the parameter is not specified, the page size will be 1000"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Allows you to retrieve records for a specific status only. Available values failure, success, conditions_check_failed"}],"responses":{"200":{"description":"Cursor-paginated export data (generic placeholder).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Exports all automation audit records stored in the database"}}}}
```

## Export Contacts

> This endpoint allows you to retrieve an export of contact data from the specified tenant and instance. The exported data will be in a format suitable for further analysis or integration with other systems.\
> \
> \### Request\
> \
> \- Method: GET\
> \- URL: \`{{url}}/{{tenantName}}/{{instanceName}}/export/CONTACT\`\
> &#x20;   \
> \
> \### Response\
> \
> The response will contain the exported contact data in a suitable format, typically JSON.\
> \
> \### Example\
> \
> \*\*Request:\*\*\
> \
> \`\`\`\
> arduinoCopy codeGET {{url}}/{{tenantName}}/{{instanceName}}/export/CONTACT\
> \
> &#x20;\`\`\`\
> \
> \*\*Response:\*\*\
> \
> \`\`\`\
> perlCopy code{\
> &#x20; "contacts": \[\
> &#x20;   {\
> &#x20;     "id": "1",\
> &#x20;     "name": "John Doe",\
> &#x20;     "email": "<johndoe@example.com>",\
> &#x20;     "phone": "123-456-7890"\
> &#x20;   },\
> &#x20;   {\
> &#x20;     "id": "2",\
> &#x20;     "name": "Jane Smith",\
> &#x20;     "email": "<janesmith@example.com>",\
> &#x20;     "phone": "987-654-3210"\
> &#x20;   },\
> &#x20;   ...\
> &#x20; ]\
> }\
> \
> &#x20;\`\`\`\
> \
> \### Error Codes\
> \
> \- 404 Not Found: The specified \`{{tenantName}}\` or \`{{instanceName}}\` does not exist.\
> &#x20;   \
> \
> \### Authentication\
> \
> Make sure to include appropriate authentication credentials, such as an API key or token, in the request headers for accessing this endpoint.\
> \
> \### Rate Limiting\
> \
> This endpoint may be subject to rate limiting. If you encounter rate limit errors, please wait for a suitable period of time before making additional requests.\
> \
> \### Notes\
> \
> \- This endpoint is specifically designed for exporting contact data. If you need to export data of a different type, refer to the corresponding endpoint documentation.\
> \- Ensure that you have the necessary permissions and access rights to retrieve contact data from the specified \`{{tenantName}}\` and \`{{instanceName}}\`.

````json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"Contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","format":"uuid","nullable":true},"updatedBy":{"type":"string","format":"uuid","nullable":true},"createdByName":{"type":"string"},"updatedByName":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","format":"email","nullable":true},"emailLabel":{"type":"string","nullable":true},"emailPdtFieldName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"phoneLabel":{"type":"string","nullable":true},"phonePdtFieldName":{"type":"string","nullable":true},"secondaryPhone":{"type":"string","nullable":true},"secondaryPhoneLabel":{"type":"string","nullable":true},"secondaryPhonePdtFieldName":{"type":"string","nullable":true},"patientId":{"type":"string","format":"uuid","readOnly":true},"pdtRecordId":{"type":"string","format":"uuid"},"relation":{"type":"string"},"active":{"type":"boolean"}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/CONTACT":{"get":{"summary":"Export Contacts","tags":["Export"],"operationId":"Export_Contacts","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"}},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","default":20}}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"This endpoint allows you to retrieve an export of contact data from the specified tenant and instance. The exported data will be in a format suitable for further analysis or integration with other systems.\n\n### Request\n\n- Method: GET\n- URL: `{{url}}/{{tenantName}}/{{instanceName}}/export/CONTACT`\n    \n\n### Response\n\nThe response will contain the exported contact data in a suitable format, typically JSON.\n\n### Example\n\n**Request:**\n\n```\narduinoCopy codeGET {{url}}/{{tenantName}}/{{instanceName}}/export/CONTACT\n\n ```\n\n**Response:**\n\n```\nperlCopy code{\n  \"contacts\": [\n    {\n      \"id\": \"1\",\n      \"name\": \"John Doe\",\n      \"email\": \"johndoe@example.com\",\n      \"phone\": \"123-456-7890\"\n    },\n    {\n      \"id\": \"2\",\n      \"name\": \"Jane Smith\",\n      \"email\": \"janesmith@example.com\",\n      \"phone\": \"987-654-3210\"\n    },\n    ...\n  ]\n}\n\n ```\n\n### Error Codes\n\n- 404 Not Found: The specified `{{tenantName}}` or `{{instanceName}}` does not exist.\n    \n\n### Authentication\n\nMake sure to include appropriate authentication credentials, such as an API key or token, in the request headers for accessing this endpoint.\n\n### Rate Limiting\n\nThis endpoint may be subject to rate limiting. If you encounter rate limit errors, please wait for a suitable period of time before making additional requests.\n\n### Notes\n\n- This endpoint is specifically designed for exporting contact data. If you need to export data of a different type, refer to the corresponding endpoint documentation.\n- Ensure that you have the necessary permissions and access rights to retrieve contact data from the specified `{{tenantName}}` and `{{instanceName}}`."}}}}
````

## GET /{tenantName}/{instanceName}/export/DOCUMENT\_SUMMARY

> Export Document Summary

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Export","description":"This is URL structure for export:\n\n`{{url}}/{{tenantName}}/{{instanceName}}/export/{{resourceName}}?start={value}&pageSize={value}`\n\nWhen working with the API, the `resourceName` parameter must be in uppercase.\n\nThis parameter specifies the type of resource you want to work with and can have one of the following values:\n\n| Name | Description |\n| --- | --- |\n| ASSESSMENT | Exports all assessments stored in the database |\n| CALENDAR_EVENT | Exports all calendar events stored in the database |\n| CDT_RECORD | Exports all cdt records stored in the database |\n| CHAT | Exports all chat messages records stored in the database |\n| EMAIL | Exports all emails stored in the database |\n| ENCOUNTER | Exports all encounters stored in the database |\n| ENCOUNTER_COMMENT | Exports all encounter comments stored in the database |\n| ENCOUNTER_DISPOSITION | Exports all encounter dispositions stored in the database |\n| PATIENT | Exports all patients stored in the database |\n| PFA | Exports all assessments sent to the patient |\n| SMS | Exports all sms records stored in the database |\n| TASK | Exports all tasks stored in the database |\n| VOICE_CALL | Exports all voice calls stored in the database |\n| WHATS_APP | Exports all WhatsApp messages stored in the database |\n\n**Response Body**\n\nThe response body contains a `cursor` object with the following properties:\n\n- `start:` The date the selection started from. This can be null if the `start` query parameter was not specified.\n    \n- `end:` The date the selection ended for the current request.\n    \n- `hasNext:` A boolean indicating whether there are more records left to retrieve.\n    \n- `pageSize:` The maximum number of records in the `data` field for the current request.\n    \n\n**Note:**  \nTo fetch the next set of data, use the value of `cursor → end` as the `start` query parameter in your next request. The final query will return at least one record, as the selection is performed with a \"less than or equal\" condition. All records in the `data` field are sorted by the last update in the database, from oldest to newest.\n\n**Permission**  \nThe export API is only accessible to API clients. To retrieve the data, an administrator must set up appropriate policies for the API client.\n\nTo perform exports, the API client needs to have the appropriate export permissions"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"CdtRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"patientId":{"type":"string","format":"uuid"},"cdtId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"cdtName":{"type":"string"},"jsonBody":{"type":"object","additionalProperties":true,"description":"Fields defined by the CDT schema, plus system fields (id, created_at, created_by, etc)."}}},"DateCursor":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Echoes the `start` query param for this page."},"end":{"type":"string","format":"date-time","nullable":true,"description":"Pass as `start` to fetch the next page."},"hasNext":{"type":"boolean"},"pageSize":{"type":"integer","description":"Effective page size used (1-1000, defaults to 1000 if omitted or out of range)."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/export/DOCUMENT_SUMMARY":{"get":{"summary":"Export Document Summary","tags":["Export"],"operationId":"Export_Document_Summary","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"name":"start","in":"query","required":false,"schema":{"type":"string"},"description":"Used as a cursor for fetching data from the database. If the parameter is not specified, the selection will start from the oldest record"},{"name":"patientId","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Allows you to export all document summary records for a specific patient. If you need to export records for multiple patients, their IDs should be entered separated by commas."}],"responses":{"200":{"description":"Cursor-paginated export data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CdtRecord"}},"cursor":{"$ref":"#/components/schemas/DateCursor"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.welkinhealth.com/api-reference/export.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
