Compile a template
curl --request POST \
--url https://api.lithoblocks.com/v1/templates/compile \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}
'import requests
url = "https://api.lithoblocks.com/v1/templates/compile"
payload = {
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}
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({template_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', data: {}})
};
fetch('https://api.lithoblocks.com/v1/templates/compile', 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.lithoblocks.com/v1/templates/compile",
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([
'template_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'data' => [
]
]),
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.lithoblocks.com/v1/templates/compile"
payload := strings.NewReader("{\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {}\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.lithoblocks.com/v1/templates/compile")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lithoblocks.com/v1/templates/compile")
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 \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {}\n}"
response = http.request(request)
puts response.read_body{
"template": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"user_name": "<string>",
"icon_emoji": "<string>"
},
"compiled_message": "<string>",
"status": "success",
"interactivity": [
{
"action_id": "<string>",
"effects": [
"<string>"
]
}
],
"remaining_credits": 123,
"warnings": [
"<string>"
],
"slack_truncation": {
"fields_truncated": 123
},
"version_id": "<string>",
"version_number": 123
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"error_details": "<string>",
"template": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"user_name": "<string>",
"icon_emoji": "<string>"
},
"compiled_message": "<string>",
"status": "error",
"message": "<string>",
"details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
],
"interactivity": [
{
"action_id": "<string>",
"effects": [
"<string>"
]
}
],
"remaining_credits": 123
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}{
"success": false,
"error": {
"issues": [
{
"code": "<string>",
"path": [
"<string>"
],
"message": "<string>"
}
],
"name": "<string>"
},
"message": "<string>",
"code": "validation_failed",
"request_id": "<string>"
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}Templates
Compile a template
Provide template_id and data in the JSON body (legacy templateId accepted). Manages credits and returns compiled_message. Legacy path: POST /templates//compile.
Compile a template
curl --request POST \
--url https://api.lithoblocks.com/v1/templates/compile \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}
'import requests
url = "https://api.lithoblocks.com/v1/templates/compile"
payload = {
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}
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({template_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', data: {}})
};
fetch('https://api.lithoblocks.com/v1/templates/compile', 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.lithoblocks.com/v1/templates/compile",
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([
'template_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'data' => [
]
]),
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.lithoblocks.com/v1/templates/compile"
payload := strings.NewReader("{\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {}\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.lithoblocks.com/v1/templates/compile")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lithoblocks.com/v1/templates/compile")
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 \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {}\n}"
response = http.request(request)
puts response.read_body{
"template": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"user_name": "<string>",
"icon_emoji": "<string>"
},
"compiled_message": "<string>",
"status": "success",
"interactivity": [
{
"action_id": "<string>",
"effects": [
"<string>"
]
}
],
"remaining_credits": 123,
"warnings": [
"<string>"
],
"slack_truncation": {
"fields_truncated": 123
},
"version_id": "<string>",
"version_number": 123
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"error_details": "<string>",
"template": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"user_name": "<string>",
"icon_emoji": "<string>"
},
"compiled_message": "<string>",
"status": "error",
"message": "<string>",
"details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
],
"interactivity": [
{
"action_id": "<string>",
"effects": [
"<string>"
]
}
],
"remaining_credits": 123
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}{
"success": false,
"error": {
"issues": [
{
"code": "<string>",
"path": [
"<string>"
],
"message": "<string>"
}
],
"name": "<string>"
},
"message": "<string>",
"code": "validation_failed",
"request_id": "<string>"
}{
"error": "<string>",
"code": "unauthenticated",
"request_id": "<string>",
"message": "<string>",
"details": "<string>",
"error_details": "<string>",
"success": false,
"valid": false,
"required_scopes": [
"<string>"
],
"user_scopes": [
"<string>"
]
}Authorizations
Headers
Any unique string (a UUID is fine). Repeating a request with the same key and body within 24 hours replays the original response with Idempotency-Replayed: true instead of running again; the same key with a different body is a 409. Incomplete and 5xx outcomes are retained for reconciliation beyond 24 hours. Applies only on the documented endpoints. Never automatically change keys to bypass an uncertain outcome.
Required string length:
1 - 255Example:
"3f7d2c1a-9b4e-4f0a-8c6d-2e1b5a7c9d10"
Body
application/json
Compile template with credits
Response
Successfully compiled template with credits

