# Create a list

```http
POST https://smsprovider-web.vercel.app/api/v1/lists
```

Create a list with up to 10,000 contacts (phone + df1–df6). Invalid numbers are returned in `rejected`.

**Authentication:** `Authorization: Bearer bm_live_…` · **Required scope:** `lists`

## Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | yes | len 1–100 |
| `contacts` | object[] | no | items 0–10000, default `[]` |

## Response

`201` — `ContactList`

## Errors

| Status | Code |
| --- | --- |
| 400 | `validation_error` |
| 401 | `unauthorized` |
| 403 | `insufficient_scope` |
| 429 | `rate_limited` |
| 500 | `internal_error` |

## Examples

### curl
```bash
curl -X POST "https://smsprovider-web.vercel.app/api/v1/lists" \
  -H "Authorization: Bearer $BATLER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"לקוחות VIP","contacts":[{"phone":"0501234567","df1":"דנה"},{"phone":"0527654321","df1":"יוסי"}]}'
```
### Node.js
```ts
import { BatlerSMS } from "@batler/sms";

const sms = new BatlerSMS({ apiKey: process.env.BATLER_API_KEY! });
const body = {
  "name": "לקוחות VIP",
  "contacts": [
    {
      "phone": "0501234567",
      "df1": "דנה"
    },
    {
      "phone": "0527654321",
      "df1": "יוסי"
    }
  ]
};
const result = await sms.lists.create(body);
```
### PHP
```php
<?php
$ch = curl_init("https://smsprovider-web.vercel.app/api/v1/lists");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("BATLER_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode(["name" => "לקוחות VIP", "contacts" => [["phone" => "0501234567", "df1" => "דנה"], ["phone" => "0527654321", "df1" => "יוסי"]]], JSON_UNESCAPED_UNICODE),
]);
$result = json_decode(curl_exec($ch), true);
```
### Python
```python
import os, uuid, requests

resp = requests.request(
    "POST", "https://smsprovider-web.vercel.app/api/v1/lists",
    headers={"Authorization": f"Bearer {os.environ['BATLER_API_KEY']}"},
    json={"name": "לקוחות VIP", "contacts": [{"phone": "0501234567", "df1": "דנה"}, {"phone": "0527654321", "df1": "יוסי"}]},
    timeout=30,
)
resp.raise_for_status()
result = resp.json()
```
### C#
```csharp
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("BATLER_API_KEY"));
var req = new HttpRequestMessage(HttpMethod.Post, "https://smsprovider-web.vercel.app/api/v1/lists");
req.Content = new StringContent("{\"name\":\"לקוחות VIP\",\"contacts\":[{\"phone\":\"0501234567\",\"df1\":\"דנה\"},{\"phone\":\"0527654321\",\"df1\":\"יוסי\"}]}", System.Text.Encoding.UTF8, "application/json");
var res = await http.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
```
