POST /api/v1/conversions
curl --request POST \
--url https://api.draftliftai.com/api/v1/conversions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.draftliftai.com/api/v1/conversions"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.draftliftai.com/api/v1/conversions', 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.draftliftai.com/api/v1/conversions",
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: Bearer <token>"
],
]);
$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.draftliftai.com/api/v1/conversions"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.draftliftai.com/api/v1/conversions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftliftai.com/api/v1/conversions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyConversions
Create Conversions
POST
/
api
/
v1
/
conversions
POST /api/v1/conversions
curl --request POST \
--url https://api.draftliftai.com/api/v1/conversions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.draftliftai.com/api/v1/conversions"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.draftliftai.com/api/v1/conversions', 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.draftliftai.com/api/v1/conversions",
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: Bearer <token>"
],
]);
$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.draftliftai.com/api/v1/conversions"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.draftliftai.com/api/v1/conversions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftliftai.com/api/v1/conversions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyRepurpose one source draft into drafts for several templates, on any mix of platforms, in one request.
{
"source_content_id": 369,
"targets": [
{ "template_id": 41 },
{ "template_id": 52, "user_direction": "Lead with the number." },
{ "template_id": 63, "output_count": 2 }
],
"idempotency_key": "campaign-369"
}
targetsholds 1 to 10 entries, each with a uniquetemplate_id. The request can ask for at most 10 outputs in total. A singletarget_template_idstill works as one target.- Admission is all-or-nothing. The server checks the templates, the spending limit, the concurrent-conversion limit and generation quota for the whole batch before it creates anything.
- The response is
202withconversion_batch_id,status(createdoralready_exists) and onetargetsentry per output:conversion_id,target_content_id,job_id,template_id,template_name,platform,statusanderror_message. - Send the same key in
idempotency_keyor theIdempotency-Keyheader to retry safely. The same key returns the original batch and creates nothing. Reusing a key for different targets returns409. - Each target is its own conversion and job. If one target is rejected, the others still run. Poll the batch for each target’s status and error, and retry one target with retry.
Was this page helpful?