Developer Guides
Production Integration Handbook
Architecture patterns for authenticating CI pipelines, shipping deterministic canary rollouts, verifying webhook payloads, and configuring typed DocsForge SDKs.
5-Minute Quickstart
Install the official TypeScript SDK, export a workspace token scoped with deployments:write and traces:read, then trigger your first canary build.
1. Install the package
npm install @docsforge/sdk 2. Deploy & query edge trace telemetry
import { DocsForge } from "@docsforge/sdk";
const client = new DocsForge({
token: process.env.DOCSFORGE_TOKEN!,
apiVersion: "2026-10-15",
});
// 1. Trigger a canary deployment in Ashburn (iad1)
const deployment = await client.deployments.create(
{
project: "edge-gateway",
region: "iad1",
strategy: "canary",
commit_sha: "9f4b2c8a1e7d",
},
{ idempotencyKey: "ci-run-4821" }
);
// 2. Inspect distributed edge telemetry
const trace = await client.traces.retrieve("trc_01j9x8n1v5w3r", {
include_spans: true,
});
console.log({ id: deployment.id, p99: trace.duration_ms }); Sandbox Environment
Tokens prefixed with df_test_ validate schemas and
return synthetic trace IDs without modifying live regional traffic routing.
API Versioning & LTS Guarantees
DocsForge separates major URL namespaces (/v2, /v1) from dated schema snapshots passed in the DocsForge-Version request header. Additive fields never
require a header bump; breaking envelope revisions always carry a 12-month deprecation window.
Authentication & Scopes
Every API request must present an HTTPS Bearer credential. Tokens are immutable once minted and validated locally at each of our 42 edge POPs in under one millisecond.
Security Recommendation
Issue short-lived 24-hour CI tokens with deployments:write
only. Keep tokens:admin restricted to hardware-MFA operator sessions.
Permission Scope Matrix
| Scope | Endpoints | Purpose |
|---|---|---|
| deployments:read | GET /v2/deployments | List and inspect regional deployment metadata |
| deployments:write | POST, PATCH /v2/deployments | Trigger rollouts and adjust canary weights |
| traces:read | GET /v2/traces/:id | Inspect request spans and POP latencies |
| tokens:admin | POST, DELETE /v2/tokens | Mint and globally revoke scoped bearer tokens |
| webhooks:write | POST /v2/webhooks | Register signed HTTPS delivery targets |
Idempotency & Safe Retries
Network interruptions during POST /v2/deployments can be
safely retried by supplying a unique Idempotency-Key header
(UUIDv7 or deterministic CI run slug). DocsForge caches the original status code and JSON body
for 24 hours per workspace.
Rate Limits & 429 Handling
When HTTP 429 is returned, inspect Retry-After before dispatching the next attempt.
Reusing an idempotency key with a modified JSON payload returns 422 Unprocessable Entity.
Webhook Signature Verification
Every outbound webhook includes a DocsForge-Signature header
formatted as t=<unix_ts>,v1=<hmac_hex>. Always compute
the HMAC-SHA256 digest against the raw request bytes before parsing JSON.
export async function verifyDocsForgeWebhook(
rawBody: string,
signatureHeader: string,
secret: string
): Promise<boolean> {
const parts = Object.fromEntries(
signatureHeader.split(",").map((pair) => pair.split("="))
);
const timestamp = Number(parts.t);
if (!timestamp || Math.abs(Date.now() / 1000 - timestamp) > 300) {
return false; // Reject events older than 5 minutes
}
const encoder = new TextEncoder();
const key = await crypto.subtle.importKey(
"raw",
encoder.encode(secret),
{ name: "HMAC", hash: "SHA-256" },
false,
["sign"]
);
const mac = await crypto.subtle.sign(
"HMAC",
key,
encoder.encode(`${timestamp}.${rawBody}`)
);
const expected = Array.from(new Uint8Array(mac))
.map((b) => b.toString(16).padStart(2, "0"))
.join("");
return expected === parts.v1;
} Official SDK Configuration
Configure per-request timeouts, automatic exponential backoff with full jitter, and pinned API date headers across TypeScript, Python, and Go.
import { DocsForge } from "@docsforge/sdk";
export const docsforge = new DocsForge({
token: process.env.DOCSFORGE_TOKEN!,
timeoutMs: 8000,
maxRetries: 3, // Honors Retry-After on HTTP 429
}); import os
from docsforge import AsyncDocsForge
client = AsyncDocsForge(
token=os.environ["DOCSFORGE_TOKEN"],
timeout=8.0,
max_retries=3,
) client := docsforge.NewClient(
os.Getenv("DOCSFORGE_TOKEN"),
docsforge.WithTimeout(8 * time.Second),
docsforge.WithMaxRetries(3),
)