Custom routes under prc-api/v3 for downloads, ATP, and editor stats.
Base path: /wp-json/prc-api/v3/
Auth summary
| Access | Routes |
|---|---|
| Firebase UID + token headers (public permission callback) | get-download, check-atp, accept-atp, log-download |
edit_posts | download-stats |
edit_post on dataset | audiences (GET/DELETE), build-audience (POST), audience-jobs (GET) |
Firebase headers
| Header | Purpose |
|---|---|
X-PRC-User-Id | Firebase UID |
X-PRC-User-Token | Firebase ID token validated server-side |
get-download also applies per-IP rate limiting (HTTP 429 rate_limited).
POST /datasets/get-download
Request body
-
dataset_idnumber required -
Dataset post ID.
No fields match this filter.
Resolves the file URL after verifying the Firebase token, running extra gates (ATP), incrementing counters, and logging the download. Attachment files go through Protected_Files::grant_for_user().
POST /datasets/check-atp
Returns whether the Firebase user has accepted the ATP agreement.
POST /datasets/accept-atp
Records ATP acceptance on the user’s Firebase record via User_Data.
POST /datasets/log-download
Request body
-
dataset_idnumber required -
Dataset post ID.
No fields match this filter.
Logs a download without resolving a URL.
GET /datasets/download-stats
Permission: edit_posts
Query parameters
-
dataset_idnumber required -
Dataset post ID.
No fields match this filter.
Returns { total, log, daily, new_data_uploaded, splits } (24h transient cache).
GET /datasets/audiences
Permission: edit_post on the dataset
Query parameters
-
dataset_idnumber required -
Dataset post ID.
No fields match this filter.
Returns audience snapshots for the dataset (no email arrays).
POST /datasets/build-audience
Permission: edit_post on the dataset
Starts an async downloader audience job. Returns 202 with the job view. Does not wait for the Firebase scan and does not create a draft transactional email.
GET /datasets/audience-jobs/{job_id}
Permission: edit_post on the source dataset for that job
Poll a ds_ job. Inspectors may also poll Email Builder GET /prc-email-builder/v1/audience-jobs/{job_id}.
DELETE /datasets/audiences
Permission: edit_post on the dataset
Deletes the audience option and _meta companion. Pass verification and/or key.