Render a template
curl --request POST \
--url https://api.craftkit.dev/v1/templates/{slug}/render \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"customer": {
"name": "Acme Corp"
}
},
"options": {
"sync": false
}
}
'import requests
url = "https://api.craftkit.dev/v1/templates/{slug}/render"
payload = {
"data": { "customer": { "name": "Acme Corp" } },
"options": { "sync": False }
}
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({data: {customer: {name: 'Acme Corp'}}, options: {sync: false}})
};
fetch('https://api.craftkit.dev/v1/templates/{slug}/render', 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.craftkit.dev/v1/templates/{slug}/render",
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([
'data' => [
'customer' => [
'name' => 'Acme Corp'
]
],
'options' => [
'sync' => false
]
]),
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.craftkit.dev/v1/templates/{slug}/render"
payload := strings.NewReader("{\n \"data\": {\n \"customer\": {\n \"name\": \"Acme Corp\"\n }\n },\n \"options\": {\n \"sync\": false\n }\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.craftkit.dev/v1/templates/{slug}/render")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"customer\": {\n \"name\": \"Acme Corp\"\n }\n },\n \"options\": {\n \"sync\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.craftkit.dev/v1/templates/{slug}/render")
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 \"data\": {\n \"customer\": {\n \"name\": \"Acme Corp\"\n }\n },\n \"options\": {\n \"sync\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued",
"pollUrl": "<string>",
"downloadUrl": "<string>",
"errorMessage": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
Templates
Render a template
Validate request data against the template’s variable manifest and
enqueue an async render job. Returns 202 with a poll URL for a freshly
queued render, or 200 when an Idempotency-Key (or body jobId)
replays an existing render.
POST
/
v1
/
templates
/
{slug}
/
render
Render a template
curl --request POST \
--url https://api.craftkit.dev/v1/templates/{slug}/render \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"customer": {
"name": "Acme Corp"
}
},
"options": {
"sync": false
}
}
'import requests
url = "https://api.craftkit.dev/v1/templates/{slug}/render"
payload = {
"data": { "customer": { "name": "Acme Corp" } },
"options": { "sync": False }
}
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({data: {customer: {name: 'Acme Corp'}}, options: {sync: false}})
};
fetch('https://api.craftkit.dev/v1/templates/{slug}/render', 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.craftkit.dev/v1/templates/{slug}/render",
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([
'data' => [
'customer' => [
'name' => 'Acme Corp'
]
],
'options' => [
'sync' => false
]
]),
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.craftkit.dev/v1/templates/{slug}/render"
payload := strings.NewReader("{\n \"data\": {\n \"customer\": {\n \"name\": \"Acme Corp\"\n }\n },\n \"options\": {\n \"sync\": false\n }\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.craftkit.dev/v1/templates/{slug}/render")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"customer\": {\n \"name\": \"Acme Corp\"\n }\n },\n \"options\": {\n \"sync\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.craftkit.dev/v1/templates/{slug}/render")
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 \"data\": {\n \"customer\": {\n \"name\": \"Acme Corp\"\n }\n },\n \"options\": {\n \"sync\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued",
"pollUrl": "<string>",
"downloadUrl": "<string>",
"errorMessage": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
Authorizations
Project API key (ck_live_… or ck_test_…) presented as a bearer token.
For embed partner endpoints this is the partner secret key, which is the
same credential type.
Headers
Make retries safe — a repeated request with the same key returns the original resource.
Path Parameters
The template slug (canonical identifier within the project).
Body
application/json
Response
Idempotent replay of an existing render.
Render shape returned by render/idempotent-replay and embed form-submit.