Enqueue encode for attachment
const url = 'https://example.com/wp-json/wp2/media-converter/v1/attachments/1/encode';const options = { method: 'POST', headers: {'X-WP-Nonce': '<X-WP-Nonce>', 'Content-Type': 'application/json'}, body: '{"attachment_id":1,"formats":["example"],"options":{},"parent_id":1,"blog_id":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/wp-json/wp2/media-converter/v1/attachments/1/encode \ --header 'Content-Type: application/json' \ --header 'X-WP-Nonce: <X-WP-Nonce>' \ --data '{ "attachment_id": 1, "formats": [ "example" ], "options": {}, "parent_id": 1, "blog_id": 1 }'Enqueues encoding for an existing attachment (no file re-upload). Returns 202.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Numeric entity id.
Request Body
Section titled “Request Body”object
Media library attachment ID.
Encode format catalog or selection.
Rejected in v1 (400 job_options_not_supported). Use PATCH /settings.
object
Parent ID when creating a site or term.
Network site ID. Optional on a single site.
Examplegenerated
{ "attachment_id": 1, "formats": [ "example" ], "options": {}, "parent_id": 1, "blog_id": 1}Responses
Section titled “Responses”object
Media library attachment ID.
Field “queue_key” as returned or accepted by PHP.
Encode format catalog or selection.
Status (build, post, or license — depending on the operation).
Field “poll_url” as returned or accepted by PHP.
Examplegenerated
{ "attachment_id": 1, "queue_key": "example", "formats": [ "example" ], "status": "example", "poll_url": "https://example.com"}Not authenticated. WordPress REST: rest_not_logged_in / rest_forbidden. Use cookie + X-WP-Nonce or Application Password.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Insufficient capability or invalid REST nonce. WordPress REST: rest_forbidden / rest_cookie_invalid_nonce.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}