יצירת רשימה
http
POST https://smsprovider-web.vercel.app/api/v1/listsיצירת רשימה עם עד 10,000 אנשי קשר (טלפון + df1–df6). מספרים לא תקינים מוחזרים ב-rejected.
אימות: Authorization: Bearer bm_live_… · Scope נדרש: lists
גוף הבקשה
| שדה | סוג | חובה | הערות |
|---|---|---|---|
name | string | כן | len 1–100 |
contacts | object[] | לא | items 0–10000, default [] |
תשובה
201 — ContactList
שגיאות
| סטטוס | קוד |
|---|---|
| 400 | validation_error |
| 401 | unauthorized |
| 403 | insufficient_scope |
| 429 | rate_limited |
| 500 | internal_error |
דוגמאות
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();