# Create a contact (/api/createContact)

At least one of `whatsapp`, `sms` or `email` is required.

A number, email or `external_id` that already belongs to one of your
contacts updates that contact instead of creating a second one, and
the answer is `200` rather than `201`. `on_existing` decides what that
update may change. Saved numbers and emails are only ever replaced
through a matching `external_id` with `update`. When the values in the
request belong to different contacts, nothing is written and the
answer is `validation_failed`, naming those contacts.

Endpoint: POST /api/v1/contacts
Full URL: https://app.sendkuy.com/api/v1/contacts
- header parameter Idempotency-Key (optional): string — Any unique string, one per logical request. Retrying with the same key returns the first answer instead of doing the work twice, and answers with `Idempotent…
Request body (JSON, required); required fields: none
Example "A number and a name": {"first_name":"Budi","whatsapp":"+6281234567891"}
Success status: 200

cURL:

```bash
curl -X POST https://app.sendkuy.com/api/v1/contacts \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "first_name": "Budi",
  "whatsapp": "+6281234567891"
}'
```

Node.js:

```ts
import { SendKuy } from 'sendkuy';

const sendkuy = new SendKuy('sk_live_YOUR_API_KEY');

const result = await sendkuy.contacts.create({
  first_name: 'Budi',
  whatsapp: '+6281234567891',
});
```

PHP:

```php
<?php

use SendKuy\SendKuy;

$sendkuy = new SendKuy('sk_live_YOUR_API_KEY');

$result = $sendkuy->contacts()->create([
    'first_name' => 'Budi',
    'whatsapp' => '+6281234567891',
]);
```

Python:

```python
import requests

response = requests.request(
    "POST",
    "https://app.sendkuy.com/api/v1/contacts",
    headers={"Authorization": "Bearer sk_live_YOUR_API_KEY"},
    json={
        "first_name": "Budi",
        "whatsapp": "+6281234567891"
    },
)

data = response.json()["data"]
```