CRM adds custom routes. Contact CRUD uses the core WordPress REST API at /wp/v2/prc-crm-contacts. Quick add posts to that route with meta.source = quick-add. Share links use /wp/v2/prc-crm-shares.
Compose email
/wp-json/wp/v2/pages
Accept application/jsonAuthorization Bearer $WP_ACCESS_TOKEN
{
"id": 42,
"slug": "getting-started"
}Requires edit_posts and a registered prc_email_txn post type.
| Body field | Type | Notes |
|---|---|---|
contactIds | integer[] | Contact post IDs. Ignored when segmentId is set. |
segmentId | integer | prc_crm_segment term ID. Optional. |
Success payload:
| Field | Type |
|---|---|
postId | integer, draft transactional post |
editUrl | string, wp-admin editor URL |
audienceKey | string, prc_email_audience_* option |
count | integer, recipient count |
Error codes include prc_crm_email_unavailable, prc_crm_no_recipients, and prc_crm_missing_segment.
Contact insights
/wp-json/wp/v2/pages
Accept application/jsonAuthorization Bearer $WP_ACCESS_TOKEN
{
"id": 42,
"slug": "getting-started"
}Requires edit_post on the contact.
Success payload:
| Field | Type |
|---|---|
emails | array of message summaries (emailPostId, title, status, activity, opens, opensUnique, clicks, clicksUnique, clickThroughs, completed, lastEventAt, editUrl) |
shares | array of share rows (shareId, title, url, hitCount, lastAccessAt) |
Mandrill webhook
/wp-json/wp/v2/pages
Accept application/jsonAuthorization Bearer $WP_ACCESS_TOKEN
{
"id": 42,
"slug": "getting-started"
}Unauthenticated except for the site webhook key. Pass it as key on the query string or as the X-PRC-CRM-Webhook-Key header. Print the URL with wp prc crm webhook-url.
Body is Mandrill's mandrill_events form field (JSON array). CRM stores events whose recipient email matches a contact.
Success payload:
| Field | Type |
|---|---|
stored | integer, number of events written |
Create contact from a form
/wp-json/wp/v2/pages
Accept application/jsonAuthorization Bearer $WP_ACCESS_TOKEN
{
"id": 42,
"slug": "getting-started"
}Public form route. Same envelope as other prc-block/form REST actions (formName, formId, formPostId, formFields). Public submissions go through Turnstile when a secret is configured. Users who can publish posts skip captcha.
Email is required. The handler maps common field names and labels onto Contact_Fields and upserts on normalized email. New contacts get source = form or form:{formPostId}.
Success payload:
| Field | Type |
|---|---|
status | string, success |
message | string |
contactId | integer |
created | boolean, true when a new contact was inserted |
Error prc_crm_missing_email (400) when the submission has no valid email. The handler does not insert a blank contact.
Create contacts from form responses
/wp-json/wp/v2/pages
Accept application/jsonAuthorization Bearer $WP_ACCESS_TOKEN
{
"id": 42,
"slug": "getting-started"
}Requires edit_posts and the form responses capability (prc_form_responses_capability, default manage_options). Body: { "ids": [1, 2] } (max 100). CRM reads each stored response and upserts on email. Spam rows and rows without a valid email are skipped.
Success payload:
| Field | Type |
|---|---|
created | integer |
updated | integer |
skipped | array of { id, code, message } |
contacts | array of { responseId, contactId, created } |