# Request the WhatsApp verification code for a number

Requests the WhatsApp verification code for a number.

```http
POST https://api.pozy.ai/v1/phone-numbers/{id}/whatsapp/request-code
```

- Area: Phone & voice / Phone Numbers
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `id` (string, required)

## Request body

Content type: `application/json`

- `method`, string: One of `SMS`, `VOICE`

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/phone-numbers/6bfebd43ddc270f6d2c56fc5/whatsapp/request-code" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "method": "SMS"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/phone-numbers/6bfebd43ddc270f6d2c56fc5/whatsapp/request-code", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    method: "SMS"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/phone-numbers/6bfebd43ddc270f6d2c56fc5/whatsapp/request-code",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "method": "SMS",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `message`, string
- `method`, string: One of `SMS`, `VOICE`
- `alreadyVerified`, boolean
- `replaced`, boolean
- `newPhoneNumber`, string

```json
{
  "message": "Hello from Pozy",
  "method": "SMS",
  "alreadyVerified": true,
  "replaced": true,
  "newPhoneNumber": "+14155550123"
}
```
