cURL
curl --request POST \
--url https://api.altur.io/api/v1.0/campaigns/{id}/{action} \
--header 'Authorization: <api-key>'import requests
url = "https://api.altur.io/api/v1.0/campaigns/{id}/{action}"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.altur.io/api/v1.0/campaigns/{id}/{action}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.altur.io/api/v1.0/campaigns/{id}/{action}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.altur.io/api/v1.0/campaigns/{id}/{action}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.altur.io/api/v1.0/campaigns/{id}/{action}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.altur.io/api/v1.0/campaigns/{id}/{action}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"campaign": {
"id": 123,
"name": "<string>",
"integration": {
"id": "<string>"
},
"agent": {
"id": "<string>",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"scheduling": {
"mon": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"tue": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"wed": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"thu": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"fri": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sat": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sun": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
}
},
"cycles": {
"enabled": true,
"max_iterations": 7,
"cooldown_minutes": 720,
"filter_statuses": [
"<string>"
],
"filter_tags": [
"<string>"
],
"schedule": {
"mon": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"tue": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"wed": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"thu": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"fri": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sat": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sun": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
}
},
"schedule_start_date": "2023-12-25",
"schedule_end_date": "2023-12-25"
},
"analytics": {}
}
}{
"success": false,
"message": "<string>",
"field": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"success": false,
"message": "<string>",
"field": "<string>"
}{
"success": false,
"message": "<string>",
"field": "<string>"
}{
"success": false,
"message": "<string>",
"field": "<string>",
"current_status": "<string>",
"valid_targets": [
"<string>"
]
}Campaigns
Lifecycle Actions
Aplica una acción de ciclo de vida a una Campaña. Acciones válidas: activate, pause, archive, resume. La acción es idempotente: aplicar una acción cuando la campaña ya está en el estado destino es un no-op exitoso.
POST
/
campaigns
/
{id}
/
{action}
cURL
curl --request POST \
--url https://api.altur.io/api/v1.0/campaigns/{id}/{action} \
--header 'Authorization: <api-key>'import requests
url = "https://api.altur.io/api/v1.0/campaigns/{id}/{action}"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.altur.io/api/v1.0/campaigns/{id}/{action}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.altur.io/api/v1.0/campaigns/{id}/{action}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.altur.io/api/v1.0/campaigns/{id}/{action}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.altur.io/api/v1.0/campaigns/{id}/{action}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.altur.io/api/v1.0/campaigns/{id}/{action}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"campaign": {
"id": 123,
"name": "<string>",
"integration": {
"id": "<string>"
},
"agent": {
"id": "<string>",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"scheduling": {
"mon": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"tue": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"wed": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"thu": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"fri": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sat": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sun": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
}
},
"cycles": {
"enabled": true,
"max_iterations": 7,
"cooldown_minutes": 720,
"filter_statuses": [
"<string>"
],
"filter_tags": [
"<string>"
],
"schedule": {
"mon": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"tue": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"wed": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"thu": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"fri": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sat": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
},
"sun": {
"startTime": "<string>",
"stopTime": "<string>",
"active": true
}
},
"schedule_start_date": "2023-12-25",
"schedule_end_date": "2023-12-25"
},
"analytics": {}
}
}{
"success": false,
"message": "<string>",
"field": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"success": false,
"message": "<string>",
"field": "<string>"
}{
"success": false,
"message": "<string>",
"field": "<string>"
}{
"success": false,
"message": "<string>",
"field": "<string>",
"current_status": "<string>",
"valid_targets": [
"<string>"
]
}Rate Limit: 12 requests per second
action is one of activate, pause, archive, resume.
Valid Transitions
| Action | Allowed source statuses | Effect |
|---|---|---|
activate | pending, ready, cooldown | sets status → active |
pause | active, cooldown | sets status → inactive |
resume | inactive | sets status → active |
archive | any | sets archived = true |
Idempotency
archiveis always a success. Re-archiving a campaign is a no-op.pauseon a campaign alreadyinactive, andresumeon a campaign alreadyactive, are no-op successes.activateis not idempotent: calling it on a campaign already inactive(orinactive, orfinished) returns409 INVALID_STATUS_TRANSITIONbecauseactiveis not in the allowed source statuses. Useresumeto re-activate a paused campaign.
Errors
400 UNKNOWN_ACTION:actionis not one of the supported values.402 BILLING_LIMIT_REACHED:activateorresumeand the plan limit was reached.409 INVALID_STATUS_TRANSITION: current status is not in the allowed sources. The response includescurrent_statusandvalid_targets.
Examples
curl -X POST "https://api.altur.io/api/v1.0/campaigns/1234/activate" \
-H "Authorization: api-key YOUR_API_SECRET_KEY"
import requests
response = requests.post(
"https://api.altur.io/api/v1.0/campaigns/1234/activate",
headers={"Authorization": "api-key YOUR_API_SECRET_KEY"},
)
response.raise_for_status()
campaign = response.json()["campaign"]
const res = await fetch(
"https://api.altur.io/api/v1.0/campaigns/1234/activate",
{
method: "POST",
headers: { Authorization: "api-key YOUR_API_SECRET_KEY" },
},
);
const { campaign } = await res.json();
Authorizations
Add api-key YOUR_API_SECRET_KEY as the value of the Authorization header.
Path Parameters
The identifier of the Campaign
Lifecycle action to apply
Available options:
activate, pause, archive, resume ⌘I