About this API
Updates an existing campaign. All fields are optional - only provided fields will be updated. The campaign must be in DRAFT or SCHEDULED status to be edited. The from_email domain must match a verified (ACTIVE) sending identity for the user. Target groups must belong to the user.
Authentication
Include your API credential in the request header. Keep credentials on the server and never expose them in client-side applications.
Authorization: Bearer <TOKEN>YOUR_ACCESS_TOKENPath Parameters
Substitute these placeholders in the endpoint URL before sending the request.
idstringRequiredResource identifier for id.Request Body
Send a application/json payload. Replace placeholder values with data from your integration.
Top-Level Fields
namestringNot specifiedUpdated campaign name (optional).contentstringNot specifiedUpdated HTML content for the campaign email (optional).settingsobjectNot specifiedUpdated campaign settings as a JSON object (optional).from_namestringNot specifiedUpdated display name for the sender (optional).from_emailstringNot specifiedUpdated from email address. Domain must match a verified (ACTIVE) sending identity (optional).template_idstringNot specifiedUpdated template ID (optional). Set to null to remove template association.preview_textstringNot specifiedUpdated preview text (optional, max 255 characters).scheduled_atstringNot specifiedUpdated scheduled date and time (optional, must be a future date). Set to null to remove schedule. Campaign status will automatically be set to SCHEDULED if scheduled_at is provided, or DRAFT if removed.subject_linestringNot specifiedUpdated subject line (optional, max 998 characters).target_groupsarrayNot specifiedUpdated array of group IDs to target. Pass empty array to remove all groups (optional).reply_to_emailstringNot specifiedUpdated reply-to email address (optional).{}
{
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true,
"description": "Updated campaign name (optional)."
},
"content": {
"type": "string",
"nullable": true,
"description": "Updated HTML content for the campaign email (optional)."
},
"settings": {
"type": "object",
"nullable": true,
"description": "Updated campaign settings as a JSON object (optional)."
},
"from_name": {
"type": "string",
"nullable": true,
"description": "Updated display name for the sender (optional)."
},
"from_email": {
"type": "string",
"format": "email",
"nullable": true,
"description": "Updated from email address. Domain must match a verified (ACTIVE) sending identity (optional)."
},
"template_id": {
"type": "string",
"format": "uuid",
"nullable": true,
"description": "Updated template ID (optional). Set to null to remove template association."
},
"preview_text": {
"type": "string",
"nullable": true,
"maxLength": 255,
"description": "Updated preview text (optional, max 255 characters)."
},
"scheduled_at": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "Updated scheduled date and time (optional, must be a future date). Set to null to remove schedule. Campaign status will automatically be set to SCHEDULED if scheduled_at is provided, or DRAFT if removed."
},
"subject_line": {
"type": "string",
"nullable": true,
"maxLength": 998,
"description": "Updated subject line (optional, max 998 characters)."
},
"target_groups": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
},
"nullable": true,
"description": "Updated array of group IDs to target. Pass empty array to remove all groups (optional)."
},
"reply_to_email": {
"type": "string",
"format": "email",
"nullable": true,
"description": "Updated reply-to email address (optional)."
}
}
}
Code Examples
Select your language and customize the request URL. Credential placeholders are intentionally preserved so secrets never appear in generated samples.
curl --request PUT 'https://email.1spoc.com/api/user/campaigns/{id}' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data '{}'
const response = await fetch('https://email.1spoc.com/api/user/campaigns/{id}', {
method: 'PUT',
headers: {
"Authorization": "Bearer <TOKEN>",
"Content-Type": "application/json"
},
body: JSON.stringify({})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
const response = await fetch('https://email.1spoc.com/api/user/campaigns/{id}', {
method: 'PUT',
headers: {
"Authorization": "Bearer <TOKEN>",
"Content-Type": "application/json"
},
body: JSON.stringify({})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
import json
import requests
url = 'https://email.1spoc.com/api/user/campaigns/{id}'
headers = {
"Authorization": "Bearer <TOKEN>",
"Content-Type": "application/json"
}
payload = json.loads(r'''{}''')
response = requests.put(url, headers=headers, json=payload)
response.raise_for_status()
print(response.json())
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
var client = HttpClient.newHttpClient();
String body = """
{}
""";
var request = HttpRequest.newBuilder(URI.create("https://email.1spoc.com/api/user/campaigns/{id}"))
.header("Authorization", "Bearer <TOKEN>")
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
<?php
$curl = curl_init();
$payload = '{}';
curl_setopt_array($curl, [
CURLOPT_URL => 'https://email.1spoc.com/api/user/campaigns/{id}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => ["Authorization: Bearer <TOKEN>","Content-Type: application/json"],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($curl);
if ($response === false) throw new Exception(curl_error($curl));
curl_close($curl);
echo $response;
using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = AuthenticationHeaderValue.Parse("Bearer <TOKEN>");
var json = """
{}
""";
using var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PutAsync("https://email.1spoc.com/api/user/campaigns/{id}", content);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
package main
import (
"fmt"
"io"
"net/http"
"bytes"
)
func main() {
request, err := http.NewRequest("PUT", "https://email.1spoc.com/api/user/campaigns/{id}", bytes.NewBufferString("{}"))
if err != nil { panic(err) }
request.Header.Set("Content-Type", "application/json")
request.Header.Set("Accept", "application/json")
request.Header.Set("Authorization", "Bearer <TOKEN>")
response, err := http.DefaultClient.Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
data, err := io.ReadAll(response.Body)
if err != nil { panic(err) }
if response.StatusCode >= 400 { panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, data)) }
fmt.Println(string(data))
}
Response
A successful request returns the documented response payload. Delivery and asynchronous events may arrive separately through configured webhooks.
{}
{
"$ref": "#/components/schemas/Campaign"
}
Status Codes
200Campaign updated successfully.400Bad request - validation errors (invalid email format, invalid domain, campaign not in editable status, etc.).401Unauthorized (missing or invalid user access token)404Campaign, template, or target groups not found or don't belong to the user.500Internal server error