Copy Gallery Template
Copy a gallery template directly into your organization's custom templates. The endpoint creates a new custom template populated with the gallery template's HTML and returns the new template's id. That id can be used as template_id when creating an email campaign or passed to PATCH /templates/:id to customize the design before sending.
Endpoint
POST /templates/gallery/:id/copy
Returns: 201 Created
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Gallery template ID (from Browse Gallery or Get Gallery Template). |
Body Parameters
The request body is optional. You can send {} or omit the body entirely.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Name for the new custom template. Max 100 characters. Defaults to the gallery template's name. |
Response
{
"id": "0192a1b2-c3d4-7e5f-9000-abcdef123456"
}
| Field | Type | Description |
|---|---|---|
id | string | ID of the new custom template. Use this as template_id when creating an email campaign, or with PATCH /templates/:id to customize further. |
Examples
Copy with default name
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
const response = await fetch("https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.post(
"https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={},
)
response.raise_for_status()
print(response.json())
using System.Net.Http.Headers;
using System.Text;
var client = new HttpClient(); // share one instance across requests
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ARSEL_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy")
{
Content = new StringContent(
"""
{}
""",
Encoding.UTF8,
"application/json"),
};
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"{(int)response.StatusCode}: {body}");
Console.WriteLine(body);
<?php
$ch = curl_init("https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => "{}",
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception("{$data['name']}: {$data['message']}");
}
print_r($data);
Copy with custom name
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Spring Sale 2026"
}'
const response = await fetch("https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Spring Sale 2026",
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.post(
"https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={
"name": "Spring Sale 2026",
},
)
response.raise_for_status()
print(response.json())
using System.Net.Http.Headers;
using System.Text;
var client = new HttpClient(); // share one instance across requests
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ARSEL_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy")
{
Content = new StringContent(
"""
{
"name": "Spring Sale 2026"
}
""",
Encoding.UTF8,
"application/json"),
};
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"{(int)response.StatusCode}: {body}");
Console.WriteLine(body);
<?php
$ch = curl_init("https://api.arsel.sa/v1/templates/gallery/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a/copy");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Spring Sale 2026",
]),
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception("{$data['name']}: {$data['message']}");
}
print_r($data);
End-to-end: Use a gallery template in a campaign
The typical workflow for launching a campaign from a gallery design:
- Browse the gallery via
GET /templates/galleryto find a suitable starter. - Copy it via this endpoint (
POST /templates/gallery/:id/copy) — get back{ id }. - Pass that
idastemplate_idtoPOST /email/campaignsto create the campaign. - Schedule delivery with
POST /email/campaigns/:id/send(includescheduled_atto send at a specific time).
- JavaScript
- Python
async function arsel(path, { method = "GET", body } = {}) {
const response = await fetch(`https://api.arsel.sa/v1${path}`, {
method,
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: body && JSON.stringify(body),
});
const data = await response.json();
if (!response.ok) throw new Error(`${data.name}: ${data.message}`);
return data;
}
// 1. Find a starter (grab the first result)
const { data } = await arsel("/templates/gallery?search=welcome&limit=1");
const galleryId = data[0].id;
// 2. Copy it into custom templates
const { id: templateId } = await arsel(`/templates/gallery/${galleryId}/copy`, {
method: "POST",
body: { name: "Welcome Campaign 2026" },
});
// 3. Create the campaign using the copied template
const { id: campaignId } = await arsel("/email/campaigns", {
method: "POST",
body: {
name: "Welcome Campaign",
subject: "Welcome to Arsel!",
from: "hello@yourdomain.com",
from_name: "Your Brand",
template_id: templateId,
list_ids: ["your-list-id"],
},
});
// 4. Schedule it for a specific time (UTC)
await arsel(`/email/campaigns/${campaignId}/send`, {
method: "POST",
body: { scheduled_at: "2026-04-28T09:00:00.000Z" },
});
import os
import requests
API = "https://api.arsel.sa/v1"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['ARSEL_API_KEY']}"
session.hooks["response"] = lambda response, *args, **kwargs: response.raise_for_status()
# 1. Find a starter (grab the first result)
gallery = session.get(f"{API}/templates/gallery", params={"search": "welcome", "limit": 1})
gallery_id = gallery.json()["data"][0]["id"]
# 2. Copy it into custom templates
copy = session.post(
f"{API}/templates/gallery/{gallery_id}/copy",
json={"name": "Welcome Campaign 2026"},
)
template_id = copy.json()["id"]
# 3. Create the campaign using the copied template
campaign = session.post(
f"{API}/email/campaigns",
json={
"name": "Welcome Campaign",
"subject": "Welcome to Arsel!",
"from": "hello@yourdomain.com",
"from_name": "Your Brand",
"template_id": template_id,
"list_ids": ["your-list-id"],
},
)
campaign_id = campaign.json()["id"]
# 4. Schedule it for a specific time (UTC)
session.post(
f"{API}/email/campaigns/{campaign_id}/send",
json={"scheduled_at": "2026-04-28T09:00:00.000Z"},
)
Error Responses
- 404 Not Found
- 401 Unauthorized
- 429 Rate Limited
{
"status_code": 404,
"name": "not_found",
"message": "Gallery template not found"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid API Key"
}
{
"status_code": 429,
"name": "rate_limit_exceeded",
"message": "Too many requests. Please retry after the period indicated in the retry-after header."
}