Skip to main content

Bulk Enroll REST API

REST endpoints for programmatic bulk subscriber enrollment. All endpoints require manage_options capability and a valid WP REST nonce.

Base path: /wp-json/benecaster/v1/shows/{show_id}/subscribers/bulk-enroll


Submit a Bulk Enrollment Job

POST /shows/{show_id}/subscribers/bulk-enroll

Queues a bulk enrollment job. Only one job may run at a time per show — submitting while a job is active returns 409.

Request body:

{
  "tier_slug": "gold",
  "emails": [
    "alice@example.com",
    "bob@example.com"
  ]
}

emails — array of strings; maximum 1,000 entries. Blank or duplicate entries are ignored.

Response: 202 Accepted

{
  "job_id": "enroll_abc123",
  "total": 2,
  "status": "queued"
}

Error codes:

Code Meaning
409 active_job_exists Another job is already running for this show
400 invalid_tier tier_slug does not match an active native tier
400 limit_exceeded More than 1,000 emails submitted

Get Job Status

GET /shows/{show_id}/subscribers/bulk-enroll/status?job_id={job_id}

Returns current progress for a running or recently completed job.

Response:

{
  "job_id": "enroll_abc123",
  "status": "running",
  "total": 200,
  "processed": 87,
  "enrolled": 82,
  "skipped": 5,
  "errors": 0
}

status — one of queued, running, complete, failed.

Returns 404 when the job ID is not found (either never existed, or the completed job record has already been cleaned up).