PostBrix REST API Reference
Automate transactional receipts, lifecycle digests, and marketing email rendering with the PostBrix rendering engine. Generate client-tested, responsive HTML and MJML programmatically from your applications and microservices.
Key Architecture Highlights
- Base API Endpoint:
https://api.postbrix.com/v1 - Authentication: Bearer token authentication with scoped API keys (
pb_live_...) passed in the standard HTTPAuthorizationheader. - Sub-50ms Latency: P95 response times under 50ms powered by in-memory JSON AST compilation and distributed Redis caching.
- Universal ESP Compatibility: Clean, responsive MJML and inlined HTML ready for immediate sending through SendGrid, Mailchimp, Klaviyo, Brevo, AWS SES, or Postmark.
Overview & Base URL
The PostBrix API is organized around REST. All requests must use the HTTPS protocol with JSON-encoded request bodies and return standard HTTP response codes and JSON bodies (except dynamic preview endpoints which return raw HTML).
https://api.postbrix.com/v1Authentication
PostBrix authenticates API requests using Secret API Keys. Your API keys carry full privileges to render your organization’s templates and project data. Always store them securely using server-side environment variables or secret vaults.
Keep API Keys Confidential
All production keys begin with the prefix pb_live_ followed by 32 cryptographically secure hexadecimal characters.
Generate, rotate, or revoke keys at any time from your PostBrix dashboard under Settings → API Keys.
Rate Limiting
To guarantee consistent latency and protect shared infrastructure, PostBrix enforces a sliding-window rate limit evaluated at the organization level across all endpoints.
Rate limits depend on the current API plan and account configuration. Check your account's API response and the live plan details on the pricing page for current limits; this reference does not publish copied tier values.
HTTP 429 Status & Response Headers
Core Endpoints
PostBrix provides dedicated endpoints for project rendering, template rendering, and live preview generation.
| Method | Endpoint Path | Description |
|---|---|---|
| POST | /api/render-email | Render saved email structure by project ID with dynamic merge values. |
| POST | /v1/templates/:templateId/render | High-throughput template render endpoint with Redis caching. |
| GET | /api/render-email/:projectId | Raw HTML preview stream for iframe embedding and live customer portals. |
/api/render-emailThe primary endpoint for transactional email triggers. Fetches the latest visual email layout designed in the PostBrix Studio and evaluates Handlebars variables in one call.
Request Parameters
| Field | Type | Requirement | Description |
|---|---|---|---|
| projectId | string | Required | Unique project identifier from the PostBrix dashboard URL (e.g. cmuhceoo1000201ph972mxpzv). |
| data | object | Optional | Key-value map of dynamic Handlebars variables to merge into the template layout. |
/v1/templates/:templateId/renderThe recommended endpoint for high-scale backend services, microservices, and serverless runtimes. Features automatic Redis multi-tier caching and parallelized MJML worker compilation.
/api/render-email/:projectIdReturns raw text/html directly for easy embedding in iframes, customer webview portals, or mobile app preview screens.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | string | Optional | Project share token for unauthenticated preview access from third-party dashboards. |
| data | string | Optional | URI-encoded JSON string containing merge values to inject into the live render. |
Error Codes & Handling
PostBrix returns standard HTTP response status codes. Every 4xx and 5xx error includes a structured JSON body describing the exact error code and human-readable context.
| Status Code | Reason | Resolution |
|---|---|---|
| 200 OK | Success | HTML compiled and returned. |
| 400 Bad Request | Invalid Payload | Verify request body matches JSON schema. |
| 401 Unauthorized | Missing / Invalid API Key | Check Authorization Bearer header. |
| 404 Not Found | Template Not Found | Confirm project or template ID exists in workspace. |
| 429 Rate Limit | Rate Limit Exceeded | Inspect Retry-After header and back off. |
| 500 Server Error | Compilation Failure | Contact PostBrix API engineering support. |
Explore More Developer Guides
Client SDKs
Node.js, Python, and Go code samples with retry policies.
JSON Schema (AST)
Inspect the EmailBlock AST and block properties.
Rendering Pipeline
4-stage compilation, worker threads, and caching.
Need custom API integration or higher throughput?
Our engineering team assists enterprise customers with dedicated proxies, SLAs, and custom endpoints.