Guide

Attachments Inspector REST API

Custom routes under prc-api/v3 for the panel, report, and mismatch tools.

Base path: /wp-json/prc-api/v3/

Auth summary

AccessRoutes
edit_postsPanel get/unattach
edit_posts + edit_post on targetMismatch find
edit_posts + edit_post + upload_filesMismatch import
PublicReport get

Panel

GET /attachments-panel/get/{post_id}

Permission: edit_posts

Returns attached media: id, title, type, filename, editLink, attachmentLink, url, alt, caption.

POST /attachments-panel/unattach/{attachment_id}

Permission: edit_posts

Sets post_parent to 0.

Report

GET /attachments-report/get/{post_id}

Permission: public (return true)

Reference

Query parameters

Typed options, defaults, and constraints in one scannable reference.
2 fields
mime_type string
Mime filter such as image or all.
include_children boolean
Include attachments from child posts (up to 25).

Response: { postTitle, attachments[] } with metadata fields including alt, caption, mimeType, url, thumbnails, dimensions, and owner.

Image mismatch

POST /image-mismatch/find

Permission: edit_posts and edit_post on post_id

Reference

Request body

Typed options, defaults, and constraints in one scannable reference.
3 fields
post_id number required
Post that owns the block.
url url
Image URL to resolve.
filename string
Filename search fallback.

Resolves via attachment_url_to_postid, then filename search on _wp_attached_file. Returns { filename, matches[] } (panel-shaped payloads, capped).

POST /image-mismatch/import

Permission: edit_posts, edit_post on post_id, and upload_files

Reference

Request body

Typed options, defaults, and constraints in one scannable reference.
2 fields
post_id number required
Parent post for the sideload.
url url required
Allowlisted host URL to download.

Sideloads with download_urlmedia_handle_sideload, parented to the post. Returns { success, attachment }.

Request GET /wp-json/prc-api/v3/attachments-panel/get/123
HeadersKey: value
Accept application/json
Response 200 OK
BodyJSON
[
  {
    "id": 456,
    "title": "Chart",
    "filename": "chart.png",
    "url": "https://example.org/chart.png"
  }
]

Was this helpful?