| 400 | Provider or HCI code is invalid. | Check X-Scrubs-Clinic-Provider and, when using HCI auth, X-Scrubs-Clinic-Code. |
| 401 | Authentication failed. | Provide a valid API key for the provider, or a valid HCI code for the provider. |
| 400 | Request body is invalid. | Check redirect URL format, language, and connection type values. |
| 502 | Onboarding link could not be created. | The WhatsApp provider could not create the customer or onboarding link. |
1https://usescrubs.com



1curl --location --request POST 'https://usescrubs.com/api/v1/whatsapp/onboarding-links' \
2--header 'X-Scrubs-Clinic-Api-Key: your_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id' \
4--header 'Content-Type: application/json' \
5--data '{
6 "customer_name": "Example Customer",
7 "success_redirect_url": "https://example.com/whatsapp/success",
8 "failure_redirect_url": "https://example.com/whatsapp/failed",
9 "allowed_connection_types": ["coexistence", "dedicated"],
10 "language": "en"
11}'1{
2 "data": {
3 "onboarding_link_id": "setup_link_id",
4 "url": "https://usescrubs.com/api/v1/whatsapp/onboarding-links/encrypted_redirect_token",
5 "status": "active",
6 "expires_at": "2026-07-07T10:00:00.000Z",
7 "whatsapp_setup_status": "pending",
8 "whatsapp_setup_error": null
9 }
10}| 400 | Provider or HCI code is invalid. | Check X-Scrubs-Clinic-Provider and, when using HCI auth, X-Scrubs-Clinic-Code. |
| 401 | Authentication failed. | Provide a valid API key for the provider, or a valid HCI code for the provider. |
| 404 | Phone number was not found. | Complete WhatsApp onboarding before claiming the number through this endpoint. |
| 409 | Phone number cannot be claimed. | The number is not connected yet, or has already been claimed by another organisation. |
1https://usescrubs.com



1curl --location --request POST 'https://usescrubs.com/api/v1/whatsapp/numbers/claim' \
2--header 'X-Scrubs-Clinic-Api-Key: your_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id' \
4--header 'Content-Type: application/json' \
5--data '{
6 "phone_number": "sender_phone_number"
7}'1{
2 "data": {
3 "phone_number": "sender_phone_number",
4 "display_name": "Example Clinic",
5 "status": "CONNECTED",
6 "quality_rating": "GREEN",
7 "claimed_at": "2026-06-06T07:20:00.000Z",
8 "last_synced_at": "2026-06-06T07:20:00.000Z"
9 }
10}| 400 | Provider or HCI code is invalid. | Check X-Scrubs-Clinic-Provider and, when using HCI auth, X-Scrubs-Clinic-Code. |
| 401 | Authentication failed. | Provide a valid API key for the provider, or a valid HCI code for the provider. |
1https://usescrubs.com



1curl --location --request GET 'https://usescrubs.com/api/v1/whatsapp/numbers' \
2--header 'X-Scrubs-Clinic-Api-Key: your_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id'1{
2 "data": [
3 {
4 "phone_number": "sender_phone_number",
5 "display_name": "Example Clinic",
6 "status": "CONNECTED",
7 "quality_rating": "GREEN",
8 "claimed_at": "2026-06-06T07:20:00.000Z",
9 "last_synced_at": "2026-06-06T07:20:00.000Z"
10 }
11 ]
12}| 400 | Provider or HCI code is invalid. | Check X-Scrubs-Clinic-Provider and, when using HCI auth, X-Scrubs-Clinic-Code. |
| 401 | Authentication failed. | Provide a valid API key for the provider, or a valid HCI code for the provider. |
| 404 | Sender number was not found. | Claim the sender number before listing templates for it. |
1https://usescrubs.com



1curl --location --request GET 'https://usescrubs.com/api/v1/whatsapp/numbers/{sender_phone_number}/templates' \
2--header 'X-Scrubs-Clinic-Api-Key: your_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id'1{
2 "data": [
3 {
4 "template_name": "appointment_reminder_en",
5 "language": "en_US",
6 "status": "APPROVED",
7 "category": "UTILITY",
8 "dynamic_fields": [
9 {
10 "component": "body",
11 "field": "1",
12 "format": "positional",
13 "parameter_type": "text",
14 "example": "Example Patient"
15 }
16 ]
17 }
18 ]
19}| 400 | Provider or HCI code is invalid. | Check X-Scrubs-Clinic-Provider and, when using HCI auth, X-Scrubs-Clinic-Code. |
| 401 | Authentication failed. | Provide a valid API key for the provider, or a valid HCI code for the provider. |
| 400 | Template fields are invalid or template is not approved. | Send all dynamic fields returned by the templates endpoint. Rejected templates cannot be sent. |
| 404 | Sender number or template was not found. | Claim the sender number and use a template name/language returned for that sender number. |
1https://usescrubs.com



1curl --location --request POST 'https://usescrubs.com/api/v1/whatsapp/numbers/{sender_phone_number}/messages/template' \
2--header 'X-Scrubs-Clinic-Api-Key: your_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id' \
4--header 'Content-Type: application/json' \
5--data '{
6 "recipient_phone_number": "recipient_phone_number",
7 "template_name": "appointment_reminder_en",
8 "language": "en_US",
9 "fields": {
10 "1": "Example Patient",
11 "2": "Wednesday, 10-Jun-2026",
12 "3": "09:30 AM",
13 "4": "Example Clinic",
14 "5": "clinic_contact_number",
15 "6": "General consultation",
16 "7": "Please arrive 10 minutes early."
17 }
18}'1{
2 "messaging_product": "whatsapp",
3 "recipient_phone_number": "recipient_phone_number",
4 "contacts": [
5 {
6 "input": "recipient_phone_number",
7 "wa_id": "recipient_phone_number"
8 }
9 ],
10 "messages": [
11 {
12 "id": "wamid.HBg..."
13 }
14 ]
15}| 400 | Provider or HCI code is invalid. | Check X-Scrubs-Clinic-Provider and, when using HCI auth, X-Scrubs-Clinic-Code. |
| 401 | Authentication failed. | Provide a valid API key for the provider, or a valid HCI code for the provider. |
1https://usescrubs.com



1curl --location --request GET 'https://usescrubs.com/api/v1/whatsapp/numbers/{sender_phone_number}/conversations?recipient_phone_number={recipient_phone_number}&limit=20' \
2--header 'X-Scrubs-Clinic-Api-Key: your_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id'1{
2 "data": [
3 {
4 "conversation_id": "817ad873-0d2b-401c-8a75-e106583b79a5",
5 "recipient_phone_number": "recipient_phone_number",
6 "status": "ended",
7 "last_active_at": "2026-05-25T03:57:40-04:00",
8 "created_at": "2026-05-25T03:55:00-04:00",
9 "updated_at": "2026-05-25T03:57:40-04:00",
10 "contact_name": "Example Patient",
11 "messages_count": 7,
12 "last_message_type": "text",
13 "last_message_timestamp": "2026-05-25T03:57:40-04:00",
14 "last_inbound_at": "2026-05-25T03:57:36-04:00",
15 "last_outbound_at": "2026-05-25T03:57:40-04:00"
16 }
17 ],
18 "paging": {
19 "next": "next_cursor",
20 "previous": null
21 }
22}| 400 | Provider or HCI code is invalid. | Check X-Scrubs-Clinic-Provider and, when using HCI auth, X-Scrubs-Clinic-Code. |
| 401 | Authentication failed. | Provide a valid API key for the provider, or a valid HCI code for the provider. |
| 400 | Query parameters are invalid. | Use true or false for has_media and a valid conversation_id path value. |
| 404 | Sender number was not found. | Claim the sender number before listing messages for its conversations. |
1https://usescrubs.com



1curl --location --request GET 'https://usescrubs.com/api/v1/whatsapp/numbers/{sender_phone_number}/conversations/{conversation_id}/messages?limit=20' \
2--header 'X-Scrubs-Clinic-Api-Key: your_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id'1{
2 "data": [
3 {
4 "message_id": "wamid.HBg...",
5 "timestamp": "1705395000",
6 "type": "text",
7 "direction": "inbound",
8 "status": "delivered",
9 "processing_status": "processed",
10 "origin": "cloud_api",
11 "from_phone_number": "recipient_phone_number",
12 "to_phone_number": "sender_phone_number",
13 "contact_name": "Example Patient",
14 "content": "Hello, I need help with my appointment.",
15 "has_media": false
16 }
17 ],
18 "paging": {
19 "next": "next_cursor",
20 "previous": null
21 }
22}