curl --request POST \
--url https://your-site.com/{basePath}/posts \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-Castro-Signature: <api-key>' \
--header 'X-Castro-Timestamp: <api-key>' \
--data '
{
"title": "10 Best Running Shoes in 2026",
"content": "<p>Choosing the right running shoe...</p>",
"excerpt": "<string>",
"date": "2026-07-03 14:22:01",
"categories": [
"Running",
"Gear"
],
"tags": [
"shoes",
"running"
],
"author": "Jane Levy",
"featured_image": "<string>",
"reading_time": "5 minutes",
"seo": {
"title": "<string>",
"description": "<string>",
"keywords": [
"<string>"
]
},
"source_id": "cnt_9f2ka83b"
}
'import requests
url = "https://your-site.com/{basePath}/posts"
payload = {
"title": "10 Best Running Shoes in 2026",
"content": "<p>Choosing the right running shoe...</p>",
"excerpt": "<string>",
"date": "2026-07-03 14:22:01",
"categories": ["Running", "Gear"],
"tags": ["shoes", "running"],
"author": "Jane Levy",
"featured_image": "<string>",
"reading_time": "5 minutes",
"seo": {
"title": "<string>",
"description": "<string>",
"keywords": ["<string>"]
},
"source_id": "cnt_9f2ka83b"
}
headers = {
"X-API-Key": "<api-key>",
"X-Castro-Timestamp": "<api-key>",
"X-Castro-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Key': '<api-key>',
'X-Castro-Timestamp': '<api-key>',
'X-Castro-Signature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: '10 Best Running Shoes in 2026',
content: '<p>Choosing the right running shoe...</p>',
excerpt: '<string>',
date: '2026-07-03 14:22:01',
categories: ['Running', 'Gear'],
tags: ['shoes', 'running'],
author: 'Jane Levy',
featured_image: '<string>',
reading_time: '5 minutes',
seo: {title: '<string>', description: '<string>', keywords: ['<string>']},
source_id: 'cnt_9f2ka83b'
})
};
fetch('https://your-site.com/{basePath}/posts', 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://your-site.com/{basePath}/posts",
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([
'title' => '10 Best Running Shoes in 2026',
'content' => '<p>Choosing the right running shoe...</p>',
'excerpt' => '<string>',
'date' => '2026-07-03 14:22:01',
'categories' => [
'Running',
'Gear'
],
'tags' => [
'shoes',
'running'
],
'author' => 'Jane Levy',
'featured_image' => '<string>',
'reading_time' => '5 minutes',
'seo' => [
'title' => '<string>',
'description' => '<string>',
'keywords' => [
'<string>'
]
],
'source_id' => 'cnt_9f2ka83b'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"X-Castro-Signature: <api-key>",
"X-Castro-Timestamp: <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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-site.com/{basePath}/posts"
payload := strings.NewReader("{\n \"title\": \"10 Best Running Shoes in 2026\",\n \"content\": \"<p>Choosing the right running shoe...</p>\",\n \"excerpt\": \"<string>\",\n \"date\": \"2026-07-03 14:22:01\",\n \"categories\": [\n \"Running\",\n \"Gear\"\n ],\n \"tags\": [\n \"shoes\",\n \"running\"\n ],\n \"author\": \"Jane Levy\",\n \"featured_image\": \"<string>\",\n \"reading_time\": \"5 minutes\",\n \"seo\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ]\n },\n \"source_id\": \"cnt_9f2ka83b\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("X-Castro-Timestamp", "<api-key>")
req.Header.Add("X-Castro-Signature", "<api-key>")
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://your-site.com/{basePath}/posts")
.header("X-API-Key", "<api-key>")
.header("X-Castro-Timestamp", "<api-key>")
.header("X-Castro-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"10 Best Running Shoes in 2026\",\n \"content\": \"<p>Choosing the right running shoe...</p>\",\n \"excerpt\": \"<string>\",\n \"date\": \"2026-07-03 14:22:01\",\n \"categories\": [\n \"Running\",\n \"Gear\"\n ],\n \"tags\": [\n \"shoes\",\n \"running\"\n ],\n \"author\": \"Jane Levy\",\n \"featured_image\": \"<string>\",\n \"reading_time\": \"5 minutes\",\n \"seo\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ]\n },\n \"source_id\": \"cnt_9f2ka83b\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/{basePath}/posts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["X-Castro-Timestamp"] = '<api-key>'
request["X-Castro-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"10 Best Running Shoes in 2026\",\n \"content\": \"<p>Choosing the right running shoe...</p>\",\n \"excerpt\": \"<string>\",\n \"date\": \"2026-07-03 14:22:01\",\n \"categories\": [\n \"Running\",\n \"Gear\"\n ],\n \"tags\": [\n \"shoes\",\n \"running\"\n ],\n \"author\": \"Jane Levy\",\n \"featured_image\": \"<string>\",\n \"reading_time\": \"5 minutes\",\n \"seo\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ]\n },\n \"source_id\": \"cnt_9f2ka83b\"\n}"
response = http.request(request)
puts response.read_bodyCreate a blog post (required)
Called when the user publishes a blog post. Store it in your system
and return an id — any string up to 191 characters. Castro stores it
verbatim and sends it back on every later update or delete.
Store source_id too: republishing the same content sends the same
source_id, so you can use it for idempotency.
curl --request POST \
--url https://your-site.com/{basePath}/posts \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-Castro-Signature: <api-key>' \
--header 'X-Castro-Timestamp: <api-key>' \
--data '
{
"title": "10 Best Running Shoes in 2026",
"content": "<p>Choosing the right running shoe...</p>",
"excerpt": "<string>",
"date": "2026-07-03 14:22:01",
"categories": [
"Running",
"Gear"
],
"tags": [
"shoes",
"running"
],
"author": "Jane Levy",
"featured_image": "<string>",
"reading_time": "5 minutes",
"seo": {
"title": "<string>",
"description": "<string>",
"keywords": [
"<string>"
]
},
"source_id": "cnt_9f2ka83b"
}
'import requests
url = "https://your-site.com/{basePath}/posts"
payload = {
"title": "10 Best Running Shoes in 2026",
"content": "<p>Choosing the right running shoe...</p>",
"excerpt": "<string>",
"date": "2026-07-03 14:22:01",
"categories": ["Running", "Gear"],
"tags": ["shoes", "running"],
"author": "Jane Levy",
"featured_image": "<string>",
"reading_time": "5 minutes",
"seo": {
"title": "<string>",
"description": "<string>",
"keywords": ["<string>"]
},
"source_id": "cnt_9f2ka83b"
}
headers = {
"X-API-Key": "<api-key>",
"X-Castro-Timestamp": "<api-key>",
"X-Castro-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Key': '<api-key>',
'X-Castro-Timestamp': '<api-key>',
'X-Castro-Signature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: '10 Best Running Shoes in 2026',
content: '<p>Choosing the right running shoe...</p>',
excerpt: '<string>',
date: '2026-07-03 14:22:01',
categories: ['Running', 'Gear'],
tags: ['shoes', 'running'],
author: 'Jane Levy',
featured_image: '<string>',
reading_time: '5 minutes',
seo: {title: '<string>', description: '<string>', keywords: ['<string>']},
source_id: 'cnt_9f2ka83b'
})
};
fetch('https://your-site.com/{basePath}/posts', 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://your-site.com/{basePath}/posts",
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([
'title' => '10 Best Running Shoes in 2026',
'content' => '<p>Choosing the right running shoe...</p>',
'excerpt' => '<string>',
'date' => '2026-07-03 14:22:01',
'categories' => [
'Running',
'Gear'
],
'tags' => [
'shoes',
'running'
],
'author' => 'Jane Levy',
'featured_image' => '<string>',
'reading_time' => '5 minutes',
'seo' => [
'title' => '<string>',
'description' => '<string>',
'keywords' => [
'<string>'
]
],
'source_id' => 'cnt_9f2ka83b'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"X-Castro-Signature: <api-key>",
"X-Castro-Timestamp: <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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-site.com/{basePath}/posts"
payload := strings.NewReader("{\n \"title\": \"10 Best Running Shoes in 2026\",\n \"content\": \"<p>Choosing the right running shoe...</p>\",\n \"excerpt\": \"<string>\",\n \"date\": \"2026-07-03 14:22:01\",\n \"categories\": [\n \"Running\",\n \"Gear\"\n ],\n \"tags\": [\n \"shoes\",\n \"running\"\n ],\n \"author\": \"Jane Levy\",\n \"featured_image\": \"<string>\",\n \"reading_time\": \"5 minutes\",\n \"seo\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ]\n },\n \"source_id\": \"cnt_9f2ka83b\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("X-Castro-Timestamp", "<api-key>")
req.Header.Add("X-Castro-Signature", "<api-key>")
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://your-site.com/{basePath}/posts")
.header("X-API-Key", "<api-key>")
.header("X-Castro-Timestamp", "<api-key>")
.header("X-Castro-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"10 Best Running Shoes in 2026\",\n \"content\": \"<p>Choosing the right running shoe...</p>\",\n \"excerpt\": \"<string>\",\n \"date\": \"2026-07-03 14:22:01\",\n \"categories\": [\n \"Running\",\n \"Gear\"\n ],\n \"tags\": [\n \"shoes\",\n \"running\"\n ],\n \"author\": \"Jane Levy\",\n \"featured_image\": \"<string>\",\n \"reading_time\": \"5 minutes\",\n \"seo\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ]\n },\n \"source_id\": \"cnt_9f2ka83b\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/{basePath}/posts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["X-Castro-Timestamp"] = '<api-key>'
request["X-Castro-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"10 Best Running Shoes in 2026\",\n \"content\": \"<p>Choosing the right running shoe...</p>\",\n \"excerpt\": \"<string>\",\n \"date\": \"2026-07-03 14:22:01\",\n \"categories\": [\n \"Running\",\n \"Gear\"\n ],\n \"tags\": [\n \"shoes\",\n \"running\"\n ],\n \"author\": \"Jane Levy\",\n \"featured_image\": \"<string>\",\n \"reading_time\": \"5 minutes\",\n \"seo\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ]\n },\n \"source_id\": \"cnt_9f2ka83b\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
The connection key the user generated in Jorge Castro (Settings → Integration → Custom Website). Reject any request whose key doesn't match yours.
Unix time in milliseconds when the request was signed — Castro uses
Date.now(). Reject anything more than a few minutes old.
A seconds-based comparison makes every request look ~55,000 years in the future, and the freshness check then silently passes everything.
HMAC-SHA256("{timestamp}.{rawBody}", api_key), lowercase hex.
rawBody is the exact bytes of the request body — empty for GET
and DELETE, which therefore sign over "{timestamp}.". Hash the raw
bytes, never a re-serialized copy of the parsed JSON: whitespace and key
order differences will break the comparison for some payloads and not
others, which reads as an intermittent bug.
Compare in constant time (crypto.timingSafeEqual, hash_equals,
hmac.compare_digest).
Body
The body of POST /posts. title, content and status are always
present; the rest depend on what the user filled in.
"10 Best Running Shoes in 2026"
Post body as HTML. The H1 is already stripped — render title as your page heading.
"<p>Choosing the right running shoe...</p>"
publish, draft Short summary / meta description text.
Publish datetime, YYYY-MM-DD HH:MM:SS.
"2026-07-03 14:22:01"
Category NAMES. Create any that don't exist yet.
["Running", "Gear"]
["shoes", "running"]
Author display name.
"Jane Levy"
URL of the featured image, hosted by Castro.
"5 minutes"
Show child attributes
Show child attributes
Castro's internal content id — store it for idempotency.
"cnt_9f2ka83b"

