Everything here describes itself: send OPTIONS to a route for its arguments and schema. The tables below come from the same registration code.
The track on media is public and keeps its shape within a major version. The riff/v1 routes are the player's own, there for the player and the Listen block to call, and may change in any release.
The track on media
Every audio and video item in wp/v2/media carries riff_track: The file as a track the player reads; null for files that are not audio or video. It is read only, and null for any other file. Its shape is the track schema.
GET /wp-json/wp/v2/media/123?_fields=id,riff_trackRoutes
GET /riff/v1/library
riff-library
Arguments
| Name | Type | Description |
|---|---|---|
page | integer | Page of the library. Default 1. |
Response
| Property | Type | Description |
|---|---|---|
items | array | |
items[]. | integer | Post ID. |
items[]. | string | Post title. |
items[]. | string | Permalink. |
items[]. | string | The artist every track shares, or empty. |
items[]. | array | Artwork, smallest first. |
items[]. | string | |
items[]. | string | |
items[]. | integer | Number of tracks. |
items[]. | string | A one-line byline for the post, written by a feature that knows how to say it in the language. |
items[]. | number | Total length in seconds, 0 when unknown. |
page | integer | |
pages | integer | |
total | integer |
GET /riff/v1/library/{id}
riff-library-post
Arguments
| Name | Type | Description |
|---|---|---|
id | integer Required | Post ID. |
Response
| Property | Type | Description |
|---|---|---|
id | integer | Post ID. |
title | string | Post title. |
url | string | Permalink. |
artist | string | The artist every track shares, or empty. |
art | array | Artwork, smallest first. |
art[]. | string | |
art[]. | string | |
count | integer | Number of tracks. |
meta | string | A one-line byline for the post, written by a feature that knows how to say it in the language. |
duration | number | Total length in seconds, 0 when unknown. |
tracks | array | The tracks, in order, as the player reads them. |
html | string | The media blocks rendered as the post renders them. |
GET /riff/v1/tracks
Tracks from the Media Library, by title, or one album in its order, or one artist; searchable by title, artist and album. A visitor sees every track except those uploaded to an unpublished or password-protected post; someone who can upload files sees them all.
Arguments
| Name | Type | Description |
|---|---|---|
search | string | Words to look for, at least two characters: a track matches on its title, artist or album; an album or artist on its name. Default "". |
album | integer | Only the tracks on this album, by term ID, in album order. Default 0. |
artist | integer | Only the tracks by this artist, by term ID. Default 0. |
include | array | Only these, by ID; what the requester cannot see is still left out. Default []. |
orderby | string | By title, the most recently added first, in the order include names them, or shuffled by seed. An album is in album order unless shuffled. Default "title". |
seed | integer | With orderby random, the shuffle: the same seed deals the same order, so its pages follow on without a track twice. Default 0. |
page | integer | Page of results. Default 1. |
after | string | Where the last page ended, as its next said: the page after it, which stays fast however deep into the library it is. By title or newest first, and not with album or include. Default "". |
per_page | integer | Tracks per page. Default 50. |
Response
| Property | Type | Description |
|---|---|---|
items | array | Tracks, in the shape of the track schema. |
items[]. | string | The attachment ID, or "url:" and a hash for a file outside the Media Library. |
items[]. | string | |
items[]. | string | One of audio, video. |
items[]. | string | |
items[]. | string | |
items[]. | string | |
items[]. | integer | The year from the file's tags, or 0. |
items[]. | integer | Which disc of a set the track is on, from the file's disc number tag (1 for "1/2"), or 0 when the tags do not say. |
items[]. | number | Seconds, 0 when unknown. |
items[]. | string | The language of the title and artist, as a lang attribute takes it, from the file's tags; empty when the file does not say. |
items[]. | string | The container, lower case, as WordPress read it from the file: mp3, flac, m4a. Empty when unknown. |
items[]. | integer | Kilobits per second, 0 when unknown. |
items[]. | boolean | Whether the encoding is lossless. |
items[]. | integer | Bits per sample, as WordPress read it from the file; 0 when the format does not say, as MP3 does not. |
items[]. | integer | Samples per second, 0 when unknown. |
items[]. | string | The track's loudness over time as digits 0 to 9, one per sample, when something has measured it; the drawn cover puts it in the groove. Empty otherwise. |
items[]. | array | Artwork, smallest first. |
items[]. | string | |
items[]. | string | |
items[]. | string | What the picture shows, for a screen reader: the image's alt text, or the album and artist a drawn cover names. |
items[]. | array | Text tracks for a video: the WebVTT file its Captions field names, or the tracks its video block carries. |
items[]. | string | |
items[]. | string | |
items[]. | string | |
items[]. | string | One of captions, subtitles, descriptions. |
items[]. | object | null | |
items[]. | string | |
items[]. | string | |
items[]. | array | |
items[]. | string | |
items[]. | string | |
items[]. | string | |
items[]. | string | One of captions, subtitles, descriptions. |
items[]. | object | null | |
items[]. | integer | |
items[]. | string | |
items[]. | string | |
items[]. | boolean | Whether the current visitor may not play the track, as riff_can_play decided. A locked track has no src. |
items[]. | string | Where a locked track sends the visitor to unlock it, from riff_unlock_url. Empty otherwise. |
page | integer | |
pages | integer | |
total | integer | |
next | string | Where this page ended, to pass as after for the next; empty when this is the last, or for an album or include. |
GET /riff/v1/albums
Albums with at least one track the requester can see, by name, each with its artist, artwork and track count.
Arguments
| Name | Type | Description |
|---|---|---|
search | string | Words to look for, at least two characters: a track matches on its title, artist or album; an album or artist on its name. Default "". |
artist | integer | Only the albums with a track by this artist, by term ID. Default 0. |
include | array | Only these, by ID; what the requester cannot see is still left out. Default []. |
orderby | string | By name, or the most recently added first. Default "name". |
page | integer | Page of results. Default 1. |
Response
| Property | Type | Description |
|---|---|---|
items | array | |
items[]. | integer | Term ID. |
items[]. | string | |
items[]. | integer | Tracks the requester can see. |
items[]. | string | The album's artist, or empty. |
items[]. | array | The album's first track's artwork as the player shows it, as { src, sizes }. |
page | integer | |
pages | integer | |
total | integer |
GET /riff/v1/artists
Artists with at least one track the requester can see, by name, each with a track count.
Arguments
| Name | Type | Description |
|---|---|---|
search | string | Words to look for, at least two characters: a track matches on its title, artist or album; an album or artist on its name. Default "". |
include | array | Only these, by ID; what the requester cannot see is still left out. Default []. |
page | integer | Page of results. Default 1. |
Response
| Property | Type | Description |
|---|---|---|
items | array | |
items[]. | integer | Term ID. |
items[]. | string | |
items[]. | integer | Tracks the requester can see. |
page | integer | |
pages | integer | |
total | integer |
GET, POST /riff/v1/users/{user}/likes
The signed-in user's likes, newest first. Kept as the riff_likes user option, one list per site.
Arguments
| Name | Type | Description |
|---|---|---|
user | string | Whose: me for the signed-in user, or a user ID, for someone who may edit that user. |
items | array Required | Likes to add: a kind and an ID each, and when it was liked. |
Response
| Property | Type | Description |
|---|---|---|
items | array | |
items[]. | string | One of track, album, artist. |
items[]. | integer | |
items[]. | integer | When it was liked, in milliseconds since the epoch. |
DELETE /riff/v1/users/{user}/likes/{kind}/{id}
The signed-in user's likes, newest first. Kept as the riff_likes user option, one list per site.
Arguments
| Name | Type | Description |
|---|---|---|
user | string | Whose: me for the signed-in user, or a user ID, for someone who may edit that user. |
kind | string | What was liked: track, album or artist. |
id | integer | Its ID. |
Response
| Property | Type | Description |
|---|---|---|
items | array | |
items[]. | string | One of track, album, artist. |
items[]. | integer | |
items[]. | integer | When it was liked, in milliseconds since the epoch. |
GET, POST, DELETE /riff/v1/users/{user}/history
The tracks the signed-in user played, newest first, at most 30. Kept as the riff_history user option, one list per site.
Arguments
| Name | Type | Description |
|---|---|---|
user | string | Whose: me for the signed-in user, or a user ID, for someone who may edit that user. |
items | array Required | Plays to add: a track's ID each, and when it was played. |
Response
| Property | Type | Description |
|---|---|---|
items | array | |
items[]. | string | The attachment ID, or "url:" and a hash for a file outside the Media Library. |
items[]. | string | |
items[]. | string | One of audio, video. |
items[]. | string | |
items[]. | string | |
items[]. | string | |
items[]. | integer | The year from the file's tags, or 0. |
items[]. | integer | Which disc of a set the track is on, from the file's disc number tag (1 for "1/2"), or 0 when the tags do not say. |
items[]. | number | Seconds, 0 when unknown. |
items[]. | string | The language of the title and artist, as a lang attribute takes it, from the file's tags; empty when the file does not say. |
items[]. | string | The container, lower case, as WordPress read it from the file: mp3, flac, m4a. Empty when unknown. |
items[]. | integer | Kilobits per second, 0 when unknown. |
items[]. | boolean | Whether the encoding is lossless. |
items[]. | integer | Bits per sample, as WordPress read it from the file; 0 when the format does not say, as MP3 does not. |
items[]. | integer | Samples per second, 0 when unknown. |
items[]. | string | The track's loudness over time as digits 0 to 9, one per sample, when something has measured it; the drawn cover puts it in the groove. Empty otherwise. |
items[]. | array | Artwork, smallest first. |
items[]. | string | |
items[]. | string | |
items[]. | string | What the picture shows, for a screen reader: the image's alt text, or the album and artist a drawn cover names. |
items[]. | array | Text tracks for a video: the WebVTT file its Captions field names, or the tracks its video block carries. |
items[]. | string | |
items[]. | string | |
items[]. | string | |
items[]. | string | One of captions, subtitles, descriptions. |
items[]. | object | null | |
items[]. | string | |
items[]. | string | |
items[]. | array | |
items[]. | string | |
items[]. | string | |
items[]. | string | |
items[]. | string | One of captions, subtitles, descriptions. |
items[]. | object | null | |
items[]. | integer | |
items[]. | string | |
items[]. | string | |
items[]. | boolean | Whether the current visitor may not play the track, as riff_can_play decided. A locked track has no src. |
items[]. | string | Where a locked track sends the visitor to unlock it, from riff_unlock_url. Empty otherwise. |
items[]. | integer | When it was played, in milliseconds since the epoch. |
GET, POST /riff/v1/users/{user}/playlists
A user's playlists, the most recently changed first. Each is a private riff_playlist post holding a core Playlist block.
Arguments
| Name | Type | Description |
|---|---|---|
user | string | Whose: me for the signed-in user, or a user ID, for someone who may edit that user. |
title | string Required | The playlist's name. |
tracks | array | Tracks, by their audio attachments' IDs, in order. |
Response
| Property | Type | Description |
|---|---|---|
items | array | |
items[]. | integer | |
items[]. | string | |
items[]. | integer | How many tracks it holds. |
items[]. | array | Up to four covers from its first tracks, for a mosaic. |
items[]. | string | When it last changed. |
GET, POST, DELETE /riff/v1/users/{user}/playlists/{id}
riff-playlist
Arguments
| Name | Type | Description |
|---|---|---|
user | string | Whose: me for the signed-in user, or a user ID, for someone who may edit that user. |
id | integer | The playlist's post ID. |
title | string | The playlist's name. |
tracks | array | Tracks, by their audio attachments' IDs, in order. |
Response
| Property | Type | Description |
|---|---|---|
id | integer | |
title | string | |
count | integer | How many tracks it holds. |
covers | array | Up to four covers from its first tracks, for a mosaic. |
modified | string | When it last changed. |
ids | array | Every track's ID, in order, including any the requester cannot see. |
tracks | array | The tracks the requester can see, in the track shape, in order. |
tracks[]. | string | The attachment ID, or "url:" and a hash for a file outside the Media Library. |
tracks[]. | string | |
tracks[]. | string | One of audio, video. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | integer | The year from the file's tags, or 0. |
tracks[]. | integer | Which disc of a set the track is on, from the file's disc number tag (1 for "1/2"), or 0 when the tags do not say. |
tracks[]. | number | Seconds, 0 when unknown. |
tracks[]. | string | The language of the title and artist, as a lang attribute takes it, from the file's tags; empty when the file does not say. |
tracks[]. | string | The container, lower case, as WordPress read it from the file: mp3, flac, m4a. Empty when unknown. |
tracks[]. | integer | Kilobits per second, 0 when unknown. |
tracks[]. | boolean | Whether the encoding is lossless. |
tracks[]. | integer | Bits per sample, as WordPress read it from the file; 0 when the format does not say, as MP3 does not. |
tracks[]. | integer | Samples per second, 0 when unknown. |
tracks[]. | string | The track's loudness over time as digits 0 to 9, one per sample, when something has measured it; the drawn cover puts it in the groove. Empty otherwise. |
tracks[]. | array | Artwork, smallest first. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | What the picture shows, for a screen reader: the image's alt text, or the album and artist a drawn cover names. |
tracks[]. | array | Text tracks for a video: the WebVTT file its Captions field names, or the tracks its video block carries. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | One of captions, subtitles, descriptions. |
tracks[]. | object | null | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | array | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | One of captions, subtitles, descriptions. |
tracks[]. | object | null | |
tracks[]. | integer | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | boolean | Whether the current visitor may not play the track, as riff_can_play decided. A locked track has no src. |
tracks[]. | string | Where a locked track sends the visitor to unlock it, from riff_unlock_url. Empty otherwise. |
tracks[]. | integer | The track's place in the playlist, from 0. |
POST /riff/v1/users/{user}/playlists/{id}/tracks
riff-playlist
Arguments
| Name | Type | Description |
|---|---|---|
user | string | Whose: me for the signed-in user, or a user ID, for someone who may edit that user. |
id | integer | The playlist's post ID. |
tracks | array Required | Tracks, by their audio attachments' IDs, in order. |
Response
| Property | Type | Description |
|---|---|---|
id | integer | |
title | string | |
count | integer | How many tracks it holds. |
covers | array | Up to four covers from its first tracks, for a mosaic. |
modified | string | When it last changed. |
ids | array | Every track's ID, in order, including any the requester cannot see. |
tracks | array | The tracks the requester can see, in the track shape, in order. |
tracks[]. | string | The attachment ID, or "url:" and a hash for a file outside the Media Library. |
tracks[]. | string | |
tracks[]. | string | One of audio, video. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | integer | The year from the file's tags, or 0. |
tracks[]. | integer | Which disc of a set the track is on, from the file's disc number tag (1 for "1/2"), or 0 when the tags do not say. |
tracks[]. | number | Seconds, 0 when unknown. |
tracks[]. | string | The language of the title and artist, as a lang attribute takes it, from the file's tags; empty when the file does not say. |
tracks[]. | string | The container, lower case, as WordPress read it from the file: mp3, flac, m4a. Empty when unknown. |
tracks[]. | integer | Kilobits per second, 0 when unknown. |
tracks[]. | boolean | Whether the encoding is lossless. |
tracks[]. | integer | Bits per sample, as WordPress read it from the file; 0 when the format does not say, as MP3 does not. |
tracks[]. | integer | Samples per second, 0 when unknown. |
tracks[]. | string | The track's loudness over time as digits 0 to 9, one per sample, when something has measured it; the drawn cover puts it in the groove. Empty otherwise. |
tracks[]. | array | Artwork, smallest first. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | What the picture shows, for a screen reader: the image's alt text, or the album and artist a drawn cover names. |
tracks[]. | array | Text tracks for a video: the WebVTT file its Captions field names, or the tracks its video block carries. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | One of captions, subtitles, descriptions. |
tracks[]. | object | null | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | array | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | One of captions, subtitles, descriptions. |
tracks[]. | object | null | |
tracks[]. | integer | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | boolean | Whether the current visitor may not play the track, as riff_can_play decided. A locked track has no src. |
tracks[]. | string | Where a locked track sends the visitor to unlock it, from riff_unlock_url. Empty otherwise. |
tracks[]. | integer | The track's place in the playlist, from 0. |
DELETE /riff/v1/users/{user}/playlists/{id}/tracks/{index}
riff-playlist
Arguments
| Name | Type | Description |
|---|---|---|
user | string | Whose: me for the signed-in user, or a user ID, for someone who may edit that user. |
id | integer | The playlist's post ID. |
index | integer | The track's place in the playlist, from 0. |
Response
| Property | Type | Description |
|---|---|---|
id | integer | |
title | string | |
count | integer | How many tracks it holds. |
covers | array | Up to four covers from its first tracks, for a mosaic. |
modified | string | When it last changed. |
ids | array | Every track's ID, in order, including any the requester cannot see. |
tracks | array | The tracks the requester can see, in the track shape, in order. |
tracks[]. | string | The attachment ID, or "url:" and a hash for a file outside the Media Library. |
tracks[]. | string | |
tracks[]. | string | One of audio, video. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | integer | The year from the file's tags, or 0. |
tracks[]. | integer | Which disc of a set the track is on, from the file's disc number tag (1 for "1/2"), or 0 when the tags do not say. |
tracks[]. | number | Seconds, 0 when unknown. |
tracks[]. | string | The language of the title and artist, as a lang attribute takes it, from the file's tags; empty when the file does not say. |
tracks[]. | string | The container, lower case, as WordPress read it from the file: mp3, flac, m4a. Empty when unknown. |
tracks[]. | integer | Kilobits per second, 0 when unknown. |
tracks[]. | boolean | Whether the encoding is lossless. |
tracks[]. | integer | Bits per sample, as WordPress read it from the file; 0 when the format does not say, as MP3 does not. |
tracks[]. | integer | Samples per second, 0 when unknown. |
tracks[]. | string | The track's loudness over time as digits 0 to 9, one per sample, when something has measured it; the drawn cover puts it in the groove. Empty otherwise. |
tracks[]. | array | Artwork, smallest first. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | What the picture shows, for a screen reader: the image's alt text, or the album and artist a drawn cover names. |
tracks[]. | array | Text tracks for a video: the WebVTT file its Captions field names, or the tracks its video block carries. |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | One of captions, subtitles, descriptions. |
tracks[]. | object | null | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | array | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | string | One of captions, subtitles, descriptions. |
tracks[]. | object | null | |
tracks[]. | integer | |
tracks[]. | string | |
tracks[]. | string | |
tracks[]. | boolean | Whether the current visitor may not play the track, as riff_can_play decided. A locked track has no src. |
tracks[]. | string | Where a locked track sends the visitor to unlock it, from riff_unlock_url. Empty otherwise. |
tracks[]. | integer | The track's place in the playlist, from 0. |
WPGraphQL
When WPGraphQL is active, Riff adds these fields and types.
| Field | Description |
|---|---|
MediaItem.riffTrackRiffTrack | The file as a track, for audio and video. |
Post.riffTracks[RiffTrack] | The tracks in the post, in order. |
RiffArt
One size of a track's artwork.
| Field | Type |
|---|---|
src | String |
sizes | String |
alt | String |
RiffCaptions
| Field | Type |
|---|---|
src | String |
label | String |
srclang | String |
kind | String |
RiffVideo
The video version of an audio track.
| Field | Type |
|---|---|
src | String |
poster | String |
captions | [RiffCaptions] |
RiffPost
The post a track appears in.
| Field | Type |
|---|---|
id | Int |
title | String |
url | String |
RiffTrack
A file as a track the Riff player reads.
| Field | Type |
|---|---|
id | String |
src | String |
type | String |
title | String |
artist | String |
album | String |
year | Int |
disc | Int |
duration | Float |
lang | String |
format | String |
bitrate | Int |
lossless | Boolean |
bits | Int |
rate | Int |
levels | String |
art | [RiffArt] |
captions | [RiffCaptions] |
video | RiffVideo |
post | RiffPost |
locked | Boolean |
unlock | String |