Documentation Index
Fetch the complete documentation index at: https://docs.promptingcompany.com/llms.txt
Use this file to discover all available pages before exploring further.
Site pages
Site pages are product-scoped content records with a path, title, status, optional body content, metadata, and domain attachments. Use them when your source of truth is a CMS, documentation site, or Markdown folder.
List pages
You need content:read.
curl "https://app.promptingco.com/api/v1/site/pages?productId=$TPC_PRODUCT_ID&page=1&pageSize=25" \
-H "x-api-key: $TPC_API_KEY"
Filter by search, status, path, and content presence:
curl "https://app.promptingco.com/api/v1/site/pages?productId=$TPC_PRODUCT_ID&query=pricing&status=published&pathPrefix=docs/&hasContent=true" \
-H "x-api-key: $TPC_API_KEY"
Create pages
You need content:write.
curl "https://app.promptingco.com/api/v1/site/pages" \
-X POST \
-H "content-type: application/json" \
-H "x-api-key: $TPC_API_KEY" \
-H "Idempotency-Key: page-create-docs-install" \
--data '{
"productId": "'"$TPC_PRODUCT_ID"'",
"pages": [
{
"slug": "docs/install",
"title": "Install",
"content": "# Install\n\nInstall instructions."
}
]
}'
You can create up to 25 pages per request.
Update pages
Pass only the fields you want to change:
curl "https://app.promptingco.com/api/v1/site/pages" \
-X PATCH \
-H "content-type: application/json" \
-H "x-api-key: $TPC_API_KEY" \
-H "Idempotency-Key: page-update-page-123" \
--data '{
"productId": "'"$TPC_PRODUCT_ID"'",
"pages": [
{
"id": "page_123",
"title": "Install The Prompting Company",
"status": "published"
}
]
}'
Delete pages
Deletes are soft deletes. Deleted pages are removed from normal list results but remain available to internal retention and audit systems.
curl "https://app.promptingco.com/api/v1/site/pages" \
-X DELETE \
-H "content-type: application/json" \
-H "x-api-key: $TPC_API_KEY" \
-H "Idempotency-Key: page-delete-page-123" \
--data '{
"productId": "'"$TPC_PRODUCT_ID"'",
"pageIds": ["page_123"]
}'
You can delete up to 50 pages per request.
Worked example: sync Markdown files
import { readFile, readdir } from "node:fs/promises";
import { join, relative } from "node:path";
async function syncMarkdownFolder(root: string, productId: string, apiKey: string) {
const names = await readdir(root);
const pages = [];
for (const name of names) {
if (!name.endsWith(".md")) continue;
const path = join(root, name);
const content = await readFile(path, "utf8");
const slug = relative(root, path).replace(/\.md$/, "");
pages.push({
slug,
title: slug.replace(/-/g, " "),
content,
});
}
const results = [];
for (let index = 0; index < pages.length; index += 25) {
const batch = pages.slice(index, index + 25);
const response = await fetch("https://app.promptingco.com/api/v1/site/pages", {
method: "POST",
headers: {
"content-type": "application/json",
"x-api-key": apiKey,
"Idempotency-Key": `markdown-sync-${index}-${Date.now()}`,
},
body: JSON.stringify({ productId, pages: batch }),
});
results.push(await response.json());
}
return results;
}