# Send a contact

> Send 1 to 10 contact cards over WhatsApp with POST /v1/messages and type contacts, with name, phone numbers and emails.

`type: "contacts"` sends contact cards that the recipient can save with one tap. WhatsApp only. The fields shared by every type (`to`, `reply_to`, `typing`, `delay_ms`, the 24 h window) are in [Common fields](/en/send/text/#common-fields).

## Fields

`contacts` is a list of 1 to 10 cards.

| Field | Rule |
| --- | --- |
| `contacts[].name.formatted_name` | Required, 1 to 256 characters |
| `contacts[].name.first_name` | Optional, up to 128 characters |
| `contacts[].name.last_name` | Optional, up to 128 characters |
| `contacts[].phones` | Optional, up to 10 items |
| `contacts[].phones[].phone` | 1 to 64 characters |
| `contacts[].phones[].type` | Optional, up to 32 characters (e.g. `CELL`, `WORK`) |
| `contacts[].phones[].wa_id` | Optional, up to 64 characters: the number on WhatsApp, for the chat button |
| `contacts[].emails` | Optional, up to 10 items |
| `contacts[].emails[].email` | 1 to 128 characters |
| `contacts[].emails[].type` | Optional, up to 32 characters |

## Send a contact

**cURL**

```bash
curl https://api.messajo.com/v1/messages \
  -H "Authorization: Bearer $MESSAJO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "connection_id": "conn_...",
    "to": "5511999999999",
    "type": "contacts",
    "contacts": [
      {
        "name": { "formatted_name": "Ana Souza", "first_name": "Ana", "last_name": "Souza" },
        "phones": [{ "phone": "+55 11 98888-7777", "type": "CELL", "wa_id": "5511988887777" }],
        "emails": [{ "email": "ana@example.com", "type": "WORK" }]
      }
    ]
  }'
```

**TypeScript**

```ts
import { Messajo } from "@messajo/sdk";

const messajo = new Messajo({ apiKey: process.env.MESSAJO_API_KEY! });

const sent = await messajo.messages.send({
  connection_id: "conn_...",
  to: "5511999999999",
  type: "contacts",
  contacts: [
    {
      name: { formatted_name: "Ana Souza", first_name: "Ana", last_name: "Souza" },
      phones: [{ phone: "+55 11 98888-7777", type: "CELL", wa_id: "5511988887777" }],
      emails: [{ email: "ana@example.com", type: "WORK" }],
    },
  ],
});
```

**n8n**

n8n HTTP Request: POST https://api.messajo.com/v1/messages

```json
{
  "connection_id": "conn_...",
  "to": "5511999999999",
  "type": "contacts",
  "contacts": [
    {
      "name": { "formatted_name": "Ana Souza", "first_name": "Ana", "last_name": "Souza" },
      "phones": [{ "phone": "+55 11 98888-7777", "type": "CELL", "wa_id": "5511988887777" }],
      "emails": [{ "email": "ana@example.com", "type": "WORK" }]
    }
  ]
}
```

The response is the same as for a text message (`201`, `status: "queued"`); see [Response](/en/send/text/#response).

## Errors

- `422` [`outside_service_window`](/en/errors#outside_service_window): a contact is a free-form message, so it only goes out within 24 hours of the recipient's last message. Outside the window, use a [template](/en/guides/templates/).
- `422` [`type_not_supported_by_channel`](/en/errors#type_not_supported_by_channel): Instagram or Messenger connection. Contacts are WhatsApp only.
- `400` [`validation_failed`](/en/errors#validation_failed): empty list or more than 10 cards, missing `formatted_name`, a size limit exceeded, or an unknown field.
