Guide

PDF Extraction REST API

Editor-facing routes to queue OCR and poll status for a post’s PDF attachment.

Base path: /wp-json/prc-pdf-extraction/v1/

Source: includes/class-rest-api.php

Auth summary

Both routes require edit_post on the target post_id (convert_permission_check).

Route index

MethodPathPurpose
POST/convertSchedule async extraction
GET/statusRead none / pending / complete

POST /convert

Reference

Body parameters

Typed options, defaults, and constraints in one scannable reference.
2 fields
post_id number required
Parent report post ID.
attachment_id number required
PDF attachment ID.

Success: { job_id, status: "queued" } when scheduled. Idempotent when already pending — returns status: "pending" without a new job.

Errors include: 403 forbidden, 404 missing post/attachment, 400 non-PDF mime, 500 schedule failure.

GET /status

Reference

Query parameters

Typed options, defaults, and constraints in one scannable reference.
2 fields
post_id number required
Parent report post ID.
attachment_id number required
PDF attachment ID.

Success: { status, extraction_id } where status is none, pending, or complete.

Request GET /wp-json/prc-pdf-extraction/v1/status?post_id=123&attachment_id=456
HeadersKey: value
Accept application/json
Response 200 OK
BodyJSON
{
  "status": "complete",
  "extraction_id": 789
}

Was this helpful?