media Query
Description
Retrieves a paginated list of media items with optional filtering by reference ID, numeric ID, file extensions, or multiple IDs. Results are sorted by creation date. You can request a specific page size, and it will be used if it does not exceed the server-enforced maximum. If your requested size exceeds the maximum, the server will enforce the maximum limit.
query media(
$mediaRef: ID
$id: Int
$ids: [Int]
$extensions: [String]
$page: Int
$limit: Int
) {
media(
mediaRef: $mediaRef
id: $id
ids: $ids
extensions: $extensions
page: $page
limit: $limit
) {
media {
_id
id
title
alt
caption
ext
mime
size
width
height
url
key
folder
}
pagination {
limit
count
page
pages
hasMore
}
}
}
Variables
{
"mediaRef": "97fa3c4e1a9705d94a1efe5a",
"id": 263831587375,
"ids": [
42
],
"extensions": [
"extensions"
],
"page": 1,
"limit": 20
}
Response
{
"media": {
"media": [
{
"_id": "fcafba7a6516d148907ebc01",
"id": 4260050619565,
"title": "example",
"alt": "example",
"caption": "example",
"ext": "example",
"mime": "example",
"size": 42,
"width": 42,
"height": 42,
"url": "https://example.com",
"key": "example",
"folder": "example"
}
],
"pagination": {
"limit": 20,
"count": 10,
"page": 1,
"pages": 1,
"hasMore": true
}
}
}
Arguments
| Name | Type | Description |
|---|---|---|
mediaRef | ID | Media reference ID (ObjectId) to retrieve a specific media item. |
id | Int | Numeric media ID to retrieve a specific media item. |
ids | [Int] | List of numeric media IDs to retrieve multiple media items. |
extensions | [String] | List of file extensions to filter by (e.g., ["jpg", "png", "pdf"]). |
page | Int | The requested page number. Defaults to 1 if not specified. |
limit | Int | Number of media items per page. You can request a specific page size, and it will be used if it does not exceed the server-enforced maximum. If your requested size exceeds the maximum, the server will enforce the maximum limit. |