curl --request POST \
--url https://api.zapier.com/v2/promotions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"promotion_id": "promo_12345"
}
'import requests
url = "https://api.zapier.com/v2/promotions"
payload = { "promotion_id": "promo_12345" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({promotion_id: 'promo_12345'})
};
fetch('https://api.zapier.com/v2/promotions', 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.zapier.com/v2/promotions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'promotion_id' => 'promo_12345'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zapier.com/v2/promotions"
payload := strings.NewReader("{\n \"promotion_id\": \"promo_12345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.zapier.com/v2/promotions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promotion_id\": \"promo_12345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zapier.com/v2/promotions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promotion_id\": \"promo_12345\"\n}"
response = http.request(request)
puts response.read_body{
"enrollment_id": "<string>"
}{
"errors": [
{
"status": "401",
"code": "not_authenticated",
"title": "User Not Authenticated",
"detail": "User must be authenticated to access this resource. No valid user access token was provided."
}
]
}{
"errors": [
{
"status": "403",
"code": "permission_denied",
"title": "Permission Denied",
"detail": "You do not have permission to perform this action."
}
]
}{
"errors": [
{
"status": "404",
"code": "promotion_not_found",
"title": "Promotion Not Found",
"detail": "The requested promotion was not found. The specified promotion_id may be invalid."
}
]
}{
"errors": [
{
"status": "409",
"code": "already_enrolled",
"title": "Already Enrolled",
"detail": "The provided account is already enrolled in the specified promotion."
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>"
}
]
}Create promotion enrollment
Enrolls an account into an existing promotion.
Endpoint available to Partners only. The request must be authenticated by a user access token that the user has granted to the Partner for the account.
The enrollment_id, returned after successfully enrolling a user,
must be stored by the partner in order to retrieve
or delete the enrollment.
A promotion may be configured by Zapier with an enrollment expiration period. In that
case the enrollment expires automatically after that period: the enrollment
status becomes expired and tasks stop being sponsored. The expiration_date
is returned when retrieving the enrollment. Enrolling an account whose previous
enrollment has expired starts a new enrollment and restarts the period. See
Enrollment expiration.
OAuth
This endpoint requires the promotions:write OAuth scope.
curl --request POST \
--url https://api.zapier.com/v2/promotions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"promotion_id": "promo_12345"
}
'import requests
url = "https://api.zapier.com/v2/promotions"
payload = { "promotion_id": "promo_12345" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({promotion_id: 'promo_12345'})
};
fetch('https://api.zapier.com/v2/promotions', 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.zapier.com/v2/promotions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'promotion_id' => 'promo_12345'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zapier.com/v2/promotions"
payload := strings.NewReader("{\n \"promotion_id\": \"promo_12345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.zapier.com/v2/promotions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promotion_id\": \"promo_12345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zapier.com/v2/promotions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promotion_id\": \"promo_12345\"\n}"
response = http.request(request)
puts response.read_body{
"enrollment_id": "<string>"
}{
"errors": [
{
"status": "401",
"code": "not_authenticated",
"title": "User Not Authenticated",
"detail": "User must be authenticated to access this resource. No valid user access token was provided."
}
]
}{
"errors": [
{
"status": "403",
"code": "permission_denied",
"title": "Permission Denied",
"detail": "You do not have permission to perform this action."
}
]
}{
"errors": [
{
"status": "404",
"code": "promotion_not_found",
"title": "Promotion Not Found",
"detail": "The requested promotion was not found. The specified promotion_id may be invalid."
}
]
}{
"errors": [
{
"status": "409",
"code": "already_enrolled",
"title": "Already Enrolled",
"detail": "The provided account is already enrolled in the specified promotion."
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>"
}
]
}Authorizations
The user access token for the user you would like to enroll. See our OAuth2 authentication documentation.
Was this page helpful?