Create Tag
Create a new tag to label and categorize contacts for flexible targeting. Unlike lists, tags are lightweight labels — use them for attributes like "VIP", "churned", or "webinar-attendee".
Endpoint
POST /tags
Returns: 201 Created
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Tag name. Max 100 characters. Only letters, numbers, spaces, hyphens, and underscores. |
description | string | No | Optional description. |
Response
{
"id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"name": "VIP",
"description": "High-value customers eligible for special offers",
"contact_count": 0,
"created_at": "2026-03-08T12:00:00.000Z",
"updated_at": "2026-03-08T12:00:00.000Z"
}
| Field | Type | Description |
|---|---|---|
id | string | Unique tag ID (UUIDv7) |
name | string | Tag name |
description | string | null | Tag description |
contact_count | number | Number of contacts currently tagged |
created_at | string | ISO 8601 timestamp |
updated_at | string | ISO 8601 timestamp |
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/tags" \
-H "Authorization: Bearer be_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "VIP",
"description": "High-value customers eligible for special offers"
}'
const response = await fetch("https://api.arsel.sa/v1/tags", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer be_your_api_key",
},
body: JSON.stringify({
name: "VIP",
description: "High-value customers eligible for special offers",
}),
});
const tag = await response.json();
console.log(tag.id);
import requests
response = requests.post(
"https://api.arsel.sa/v1/tags",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer be_your_api_key",
},
json={
"name": "VIP",
"description": "High-value customers eligible for special offers",
},
)
tag = response.json()
print(tag["id"])
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer be_your_api_key");
var payload = new
{
name = "VIP",
description = "High-value customers eligible for special offers"
};
var json = System.Text.Json.JsonSerializer.Serialize(payload);
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.arsel.sa/v1/tags", content);
Console.WriteLine(await response.Content.ReadAsStringAsync());
<?php
$ch = curl_init("https://api.arsel.sa/v1/tags");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer be_your_api_key"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"name" => "VIP",
"description" => "High-value customers eligible for special offers"
]));
$response = curl_exec($ch);
echo $response;
curl_close($ch);
Error Responses
- 422 Validation Error
- 401 Unauthorized
{
"status_code": 422,
"name": "validation_error",
"message": "name must match /^[a-zA-Z0-9\\s\\-_]+$/ regular expression"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid or missing API key"
}