Core concepts
Response format
Every response — success or failure — uses the same envelope: a data field and an error field.
The envelope
{
"data": { },
"error": {
"code": 0,
"message": "OK"
}
}error.codeis0on success and1on failure.- On errors,
error.messageis a human-readable description. - On errors,
error.typeis a stable machine code (e.g.invalid_client,playlist_restricted) you can branch on safely.
Paginated lists
List endpoints wrap their results in a consistent pagination object inside data:
{
"data": {
"totalRecords": 1280,
"totalPages": 64,
"currentPage": 1,
"pageSize": 20,
"items": [ ]
},
"error": { "code": 0, "message": "OK" }
}Every list shares this shape
All list endpoints return the same totalRecords / totalPages / currentPage / pageSize / items structure. See Pagination & filtering for the parameters, and Errors for the failure shape.