Skip to content
First
Esc
↑↓navigate↵open⌘Jpreview

List media

Media library items, one page at a time.

Access: WordPress core’s own rules for this route decide.

GET/media
Authorization

Optional — this operation also accepts unauthenticated requests.

wordpress_logged_in_{hash}API key · cookie

WordPress's logged-in cookie, as a browser holds it after signing in. A request with it must also carry X-WP-Nonce.

X-WP-NonceAPI key · header

A WordPress REST nonce (wp_create_nonce('wp_rest')) for the cookie's session.

or
AuthorizationBasic auth · header

A WordPress user name and one of the user's application passwords.

or
AuthorizationBearer token (JWT) · header

A First Identity access token.

Query parameters
limitinteger

How many rows to return: 50 unless given, and never more than 100.

min 1 · default: 50
offsetinteger

How many rows to skip.

min 0
cursorstring

The cursor of the previous page, to read the next one. It replaces offset.

searchstring

Text to find, as WordPress core searches this route.

Responses
200

One page of rows.

dataMedia[]required
Show properties
Array of Media
idintegerrequired
urlstringrequired
mimestringrequired
sizeinteger
widthinteger | null
heightinteger | null
altstring | null
filenamestring
createdAtstring<date-time>
sizesobject
focalobject | null
Show properties
xnumber
ynumber
authorinteger | null
captionstring | null
cursorstring | nullrequired
400

An error, as an RFC 9457 problem document.

typestringrequired

Always about:blank: code names the problem.

titlestringrequired

The problem in a few words.

statusintegerrequired

The HTTP status.

codestringrequired

A stable name for the problem, such as unauthenticated, forbidden, not_found, invalid_input, invalid_query, invalid_json, method_not_allowed, unique_violation or reference_violation.

detailstringrequired

What went wrong, for a person.

pointerstring

A JSON pointer to the field of the request at fault, when there is one.

default

An error, as an RFC 9457 problem document.

typestringrequired

Always about:blank: code names the problem.

titlestringrequired

The problem in a few words.

statusintegerrequired

The HTTP status.

codestringrequired

A stable name for the problem, such as unauthenticated, forbidden, not_found, invalid_input, invalid_query, invalid_json, method_not_allowed, unique_violation or reference_violation.

detailstringrequired

What went wrong, for a person.

pointerstring

A JSON pointer to the field of the request at fault, when there is one.

Try it
Server
Authorization (optional)
Parameters
Request
curl -X GET 'https://example.space.fast/__first/api/v1/media' \
  -H 'X-WP-Nonce: YOUR_API_KEY' \
  -H 'Cookie: wordpress_logged_in_{hash}=YOUR_API_KEY' \
  -H 'Accept: application/json'
Response
{
  "data": [
    {
      "id": 0,
      "url": "string",
      "mime": "string",
      "size": 0,
      "width": 0,
      "height": 0,
      "alt": "string",
      "filename": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "sizes": {
        "property1": {
          "url": "string",
          "width": 0,
          "height": 0
        },
        "property2": {
          "url": "string",
          "width": 0,
          "height": 0
        }
      },
      "focal": {
        "x": 0,
        "y": 0
      },
      "author": 0,
      "caption": "string"
    }
  ],
  "cursor": "string"
}