REST API
The Alpaco REST API allows you to programmatically inspect workspaces, compile designs, and push finalized email assets directly to your external distribution channels.
Base Configuration & Auth
All API requests must be made over HTTPS and authenticated using your organization-level JSON Web Token (JWT). Each user can generate a JWT token on their profile page

Base URL: https://platform.alpaco.email/api/mcp/v1/
Authentication Header: Bearer <your_organization_jwt>
Endpoint Lifecycle Matrix
Retrieves active workspace brand identities, target audiences, and copywriting rules.
/brand/guidelines
GET
Lists all active templates with their block keys and allowed inputs.
/templates
GET
Searches for existing approved graphics, logos, and banners in your media library.
/assets?search={keyword}
GET
Compiles a brand-new design layout into a fresh HTML draft asset and returns a unique id.
/assemble
POST
Fetches the current raw JSON configuration tree state of a saved email layout draft.
/assemble/{email_id}
GET
Updates and re-compiles an existing email draft asset for seamless content iterations.
/assemble/{email_id}
POST
Retrieves active third-party ESP/CRM integration connection IDs (HubSpot, Braze, etc.).
/connections
GET
Pushes a finalized, compiled email design straight into your external marketing platform.
/export
POST
Getting Started
Unlike traditional, rigid APIs that force you to memorize hundreds of syntax rules, the Alpaco API is discovery-driven and self-correcting.
You do not need a static instruction guide for every email layout in your workspace. Instead, you dynamically query our engine to find your template constraints, construct your payload, and rely on our real-time validation engine to guide you through any structural mistakes.:
Phase 1: Inspect
Before your code can assemble an email, it needs to know what layouts are valid in your specific workspace. You do this by calling the templates directory.
The Endpoint:
GET /templatesThe Goal: Capture your target
template_idand read theavailable_blocksarray.
Look closely at the response. The API will explicitly tell you what block components are allowed (e.g., article, products) and the exact array keys (header_text, body_text) those blocks require. Your application holds these keys in memory to map your raw data correctly.
Phase 2: Listen
Once your application maps out the text, images, and layout choices, you shoot your composition payload to the compilation track.
The Endpoint:
POST /assembleThe Goal: Render your raw JSON into bulletproof HTML markup.
If your code passes a typo (like writing bodycopy instead of body_text), or forgets a global parameter like the marketing subjectline, the Alpaco compiler will instantly stop and hand you a 422 Unprocessable Entity response containing a highly explicit error path.
Example of error response
You don't need a manual to troubleshoot your formatting. Simply read the errors object. It acts as a real-time code reviewer, telling you exactly which array index failed and providing a list of allowed alternative keys to fix your script instantly.
Phase 3: Scale
When your payload clears the validator, the engine returns a successful response alongside a unique, tracked asset number.
The Output: A unique, persistent database integer identifier (e.g.,
"id": 771024).
Chaining your next actions:
Once you have this tracking ID, you can interact with the layout indefinitely using simple lifecycle combinations:
Content Iterations (
GET /assemble/{id}) and (POST /assemble/{id}): If an automated process or reviewer needs to adjust a headline later, you don't generate a new orphan draft. You run an update request against that exact asset ID, passing the entire content back with adjustments.Platform Syncing (
POST /export): When the campaign is perfect, pass the emailidalongside youresp_connection_idto cleanly push the final layout directly into your email sending account, connected to your organization in Alpaco.
Last updated