Skip to content

Playback descriptor for an attachment

GET
/wp-json/wp2/media-playback/v1/attachments/{id}
curl --request GET \
--url https://example.com/wp-json/wp2/media-playback/v1/attachments/1 \
--header 'X-WP-Nonce: <X-WP-Nonce>'

Ready-made player descriptor: sources, poster, subtitle/chapter tracks. Query blog_id and lang select site and language. This is a read model, not encoding.

id
required
integer

Numeric entity id.

blog_id
integer

Network site ID. Optional on a single site.

lang
string

WPML language.

Player descriptor (camelCase, as MediaDescriptor::to_array).

Media typeapplication/json
object
attachmentId

Attachment ID.

integer
blogId

Blog ID the descriptor was built on.

integer
title

Attachment title.

string
poster

Poster URL or null.

string
nullable
thumbnailsVtt

Seekbar sprite VTT URL or null.

string
nullable
sources

Player sources.

Array<object>
object
url

Source URL (original or derived format).

string
type

Source MIME type.

string
width

Width if known.

integer
nullable
height

Height if known.

integer
nullable
label

Quality variant label.

string
nullable
format

Encode format key.

string
nullable
tracks

Subtitle and chapter tracks.

Array<object>
object
kind

Subtitles, captions, or chapters.

string
src

VTT/SRT URL.

string
srclang

Track language code.

string
label

Track label.

string
default

Default track flag.

boolean
meta

Clip metadata from _kgvid-meta.

object
duration

Duration in seconds.

number
nullable
originalUrl

Original media-library file URL.

string
nullable
mimeType

Original file MIME type.

string
nullable
width

Original width.

integer
nullable
height

Original height.

integer
nullable
Examplegenerated
{
"attachmentId": 1,
"blogId": 1,
"title": "example",
"poster": "example",
"thumbnailsVtt": "example",
"sources": [
{
"url": "example",
"type": "example",
"width": 1,
"height": 1,
"label": "example",
"format": "example"
}
],
"tracks": [
{
"kind": "example",
"src": "example",
"srclang": "example",
"label": "example",
"default": true
}
],
"meta": {
"duration": 1,
"originalUrl": "example",
"mimeType": "example",
"width": 1,
"height": 1
}
}

Not authenticated. WordPress REST: rest_not_logged_in / rest_forbidden. Use cookie + X-WP-Nonce or Application Password.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

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.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Attachment_not_found

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}