Guide

Email Builder REST API

Custom routes under prc-email-builder/v1 for the editor sidebar, library, and sends.

Base path: /wp-json/prc-email-builder/v1/

Additional preview and form-related routes live in other classes (class-preview.php, class-public-email-preview.php, form send under prc-api/v3). This page covers the primary REST_API surface.

Auth summary

AccessRoutes
edit_postsAudiences, connection, segments, count, library, audiences-system, transactional/create-from-audience, domain-query audience jobs
edit_post on quizPOST /transactional/create-from-audience when quiz_id is sent; source-entity jobs for that quiz
edit_post on datasetSource-entity audience jobs for that dataset
edit_post on target campaign/txn (send permission checks)/send, campaign draft update/unlink/create, reports
edit_post on transactional post/send-system-email

Read endpoints

MethodPathNotes
GET/audiencesMailchimp audiences
GET/connectionConnection status and sender info
GET/audiences-systemSystem-email audiences from options (builder, verification, source_id, source_title)
GET/audience-jobs/{job_id}Poll a registry-backed audience job (ad_, ds_, qz_, or cs_ id). Job views omit emails.
GET/auth-domain-audiences/{job_id}Alias of the generic job poller for ad_ jobs
GET/audiences/{audience_id}/segmentsSaved segments
GET/audiences/{audience_id}/countOptional segment_id
GET/libraryDataViews backing store
GET/campaigns/{post_id}/reportStored Mailchimp report, or Mandrill/system envelope from the event ledger

Library query params

Reference

Library filters

Typed options, defaults, and constraints in one scannable reference.
4 fields
post_type enum
all, campaign, or txn.
newsletter_list string
Comma-separated prc_newsletter_list slugs.
mailchimp_status string
e.g. campaign:save, campaign:sent.
mandrill_status string
txn send status filter.

Pagination uses standard search, orderby, order, page, per_page with X-WP-Total headers.

Write endpoints

MethodPathBody
POST/send{ post_id, reset? } — Mandrill bulk send
POST/send-system-email{ post_id, to_email, context?, dry_run? }
POST/campaigns/update-draft{ post_id } — push HTML to existing Mailchimp draft
POST/campaigns/unlink{ post_id } — clear linkage meta
POST/campaigns/create-draft{ post_id } — create and send (recovery / retry send)
POST/campaigns/{post_id}/report/refreshMailchimp pull, or Mandrill/system ledger recompute
POST/mandrill-webhookMandrill events (?key= matches Email Builder or CRM webhook key)
POST/audience-jobs{ builder, ...input } — enqueue a registry-backed job, or persist a CSV audience. Returns 202 with the job view. CSV bodies use { builder: "csv-upload", label, csv }.
POST/audience-jobs/{job_id}/draftCreate a prc_email_txn draft from a ready job
POST/auth-domain-audiencesAlias of POST /audience-jobs for the email-domain builder
POST/auth-domain-audiences/{job_id}/draftAlias of the generic draft route
POST/transactional/create-from-audience{ audience_key, title?, subject?, quiz_id? } — draft prc_email_txn for a stored Mandrill list
Request POST /wp-json/prc-email-builder/v1/transactional/create-from-audience
HeadersKey: value
Content-Type application/jsonAccept application/json
Request bodyJSON
{
  "audience_key": "prc_email_audience_quiz_group_owners_123_verified",
  "quiz_id": 123
}
Response 200 OK
BodyJSON
{
  "id": 456,
  "edit_url": "https://example.test/wp-admin/post.php?post=456&action=edit",
  "title": "Update for Climate quiz group creators (verified)"
}
Request POST /wp-json/prc-email-builder/v1/campaigns/update-draft
HeadersKey: value
Content-Type application/jsonAccept application/json
Request bodyJSON
{
  "post_id": 123
}
Response 200 OK
BodyJSON
{
  "success": true
}

Anonymous public system-email sends use the form action at /prc-api/v3/form/send-system-email (nonce + captcha), not /send-system-email.

Was this helpful?