Pause or resume an A/Z variant
Pause or resume one A/Z variant of a campaign email step (same behavior as switching a variant off or on in the dashboard sequence builder). Works for variants in the main sequence and in subsequences. Stats are kept either way.
- pause: the variant stops being sent (
status: disabled,enabled: false). - resume: the variant is sent again (
status: active,enabled: true).
Asking for the state the variant is already in succeeds without changing anything. A step must keep at least one active variant, and a variant auto-paused by A/Z optimization cannot be resumed while optimization is on.
curl -X PATCH "https://api.sendkit.ai/v1/campaigns/example_string/variants/example_string" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"action": "pause"
}'
import requests
import json
url = "https://api.sendkit.ai/v1/campaigns/example_string/variants/example_string"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
data = {
"action": "pause"
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/campaigns/example_string/variants/example_string", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"action": "pause"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"action": "pause"
}`)
req, err := http.NewRequest("PATCH", "https://api.sendkit.ai/v1/campaigns/example_string/variants/example_string", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.sendkit.ai/v1/campaigns/example_string/variants/example_string')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
request.body = '{
"action": "pause"
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"campaignId": "665a1b2c3d4e5f6a7b8c9d0e",
"variantId": "665a1b2c3d4e5f6a7b8c9d11",
"label": "B",
"status": "disabled",
"enabled": false
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "action must be 'pause' or 'resume'"
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Campaign not found"
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Variant not found"
}
}
{
"success": false,
"error": {
"code": "LAST_ACTIVE_VARIANT",
"message": "Cannot pause the only active variant in this step. Keep at least one variant active."
}
}
{
"success": false,
"error": {
"code": "AUTO_PAUSED_VARIANT",
"message": "Can't resume an auto-paused variant while A/Z optimization is on. Turn off variant optimization to manage variants manually."
}
}
{
"success": false,
"error": {
"code": "CONFLICT",
"message": "Variant changed while updating; fetch the campaign and try again."
}
}
/v1/campaigns/{campaignId}/variants/{variantId}Target server for requests. Edit to use your own host.
Platform API key (sk_user_...) or Workspace API key (sk_...)
Campaign ID
The variant's _id, from sequence[].variants[] or subsequences[].sequence[].variants[] in the campaign response
The media type of the request body
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Platform API key (sk_user_...) or Workspace API key (sk_...)
Path Parameters
Campaign ID
The variant's _id, from sequence[].variants[] or subsequences[].sequence[].variants[] in the campaign response
Body
pauseresume