GraphQL
The Mux plugin supports accessing muxAsset element object via GraphQL. Be sure to read about Craft's GraphQL support.
Available Queries
1. muxAssets
Query for multiple Mux assets with filtering and pagination options.
Type: [MuxAssetInterface] (Array of Mux Asset objects)
2. muxAsset
Query for a single Mux asset.
Type: MuxAssetInterface (Single Mux Asset object)
3. muxAssetCount
Get the count of Mux assets matching the query criteria.
Type: Int! (Non-null integer)
Query Parameters
Core Mux Asset Parameters
| Parameter | Type | Description |
|---|---|---|
id | [QueryArgument] | Narrows the query results based on the mux asset's ID |
asset_id | [QueryArgument] | Narrows the query results based on the mux asset's asset_id |
asset_status | [String] | Narrows the query results based on the mux asset's status |
aspect_ratio | [String] | Narrows the query results based on the mux asset's aspect ratio |
duration | [QueryArgument] | Narrows the query results based on the mux asset's duration |
is_live | [Boolean] | Narrows the query results based on whether the asset is live |
upload_id | [QueryArgument] | Narrows the query results based on the upload ID |
playback_ids | [QueryArgument] | Narrows the query results based on playback IDs |
tracks | [QueryArgument] | Narrows the query results based on tracks |
passthrough | [QueryArgument] | Narrows the query results based on passthrough data |
meta | [QueryArgument] | Narrows the query results based on meta data |
folderId | [QueryArgument] | Narrows the query results based on the folder ID |
volumeId | [QueryArgument] | Narrows the query results based on the volume ID |
Inherited Element Parameters
| Parameter | Type | Description |
|---|---|---|
uid | [String] | Narrows the query results based on the elements' UIDs |
site | [String] | Determines which site(s) the elements should be queried in |
unique | Boolean | Determines whether only elements with unique IDs should be returned |
preferSites | [QueryArgument] | Determines which site should be selected for multi-site elements |
title | [String] | Narrows the query results based on the elements' titles |
slug | [String] | Narrows the query results based on the elements' slugs |
uri | [String] | Narrows the query results based on the elements' URIs |
search | String | Narrows the query results to elements that match a search query |
searchTermOptions | SearchTermOptions | Defines default options for search terms |
relatedTo | [QueryArgument] | Narrows results to elements that relate to provided element IDs |
notRelatedTo | [QueryArgument] | Narrows results to elements that do not relate to provided element IDs |
relatedToAssets | [AssetRelation] | Narrows results to elements that relate to an asset list |
relatedToEntries | [EntryRelation] | Narrows results to elements that relate to an entry list |
relatedToUsers | [UserRelation] | Narrows results to elements that relate to a user list |
relatedToCategories | [CategoryRelation] | Narrows results to elements that relate to a category list |
relatedToTags | [TagRelation] | Narrows results to elements that relate to a tag list |
relatedToAll | [QueryArgument] | Narrows results to elements that relate to ALL provided element IDs |
ref | [String] | Narrows the query results based on a reference string |
fixedOrder | Boolean | Causes results to be returned in the order specified by the id argument |
inReverse | Boolean | Causes results to be returned in reverse order |
dateCreated | [String] | Narrows results based on the elements' creation dates |
dateUpdated | [String] | Narrows results based on the elements' last-updated dates |
offset | Int | Sets the offset for paginated results |
language | [String] | Determines which site(s) to query based on language |
limit | Int | Sets the limit for paginated results |
orderBy | String | Sets the field the returned elements should be ordered by |
siteSettingsId | [QueryArgument] | Narrows results based on unique identifier for element-site relation |
Status Parameters (if permissions allow)
| Parameter | Type | Description |
|---|---|---|
status | [String] | Narrows results based on the elements' statuses |
archived | Boolean | Narrows results to only archived elements |
trashed | Boolean | Narrows results to only soft-deleted elements |
Draft Parameters (if permissions allow)
| Parameter | Type | Description |
|---|---|---|
drafts | Boolean | Whether draft elements should be returned |
draftOf | QueryArgument | Narrows results to only drafts of a given element |
draftId | Int | The ID of the draft to return |
draftCreator | Int | The drafts' creator ID |
provisionalDrafts | Boolean | Whether provisional drafts should be returned |
withProvisionalDrafts | Boolean | Whether canonical elements should be replaced with provisional drafts |
Revision Parameters (if permissions allow)
| Parameter | Type | Description |
|---|---|---|
revisions | Boolean | Whether revision elements should be returned |
revisionOf | QueryArgument | The source element ID that revisions should be returned for |
revisionId | Int | The ID of the revision to return |
revisionCreator | Int | The revisions' creator ID |
Response Structure
MuxAssetInterface Fields
| Field | Type | Description |
|---|---|---|
id | ID | Element ID |
asset_id | String | ID of the mux asset |
volumeId | ID | Volume ID |
folderId | ID | Folder ID |
created_at | String | Creation time of the object |
asset_status | String | Status of the mux asset |
duration | String | Duration of the object |
max_stored_resolution | String | Max stored resolution of the object |
max_stored_frame_rate | String | Max stored frame rate of the object |
resolution_tier | String | Resolution tier of the object |
max_resolution_tier | String | Max resolution tier of the object |
encoding_tier | String | Encoding tier of the object |
aspect_ratio | String | Aspect ratio of the object |
playback_ids | [PlaybackID] | Playback IDs of the object |
tracks | [Track] | Tracks of the object |
errors | String | Errors of the object |
per_title_encode | String | Per-title encode of the object |
upload_id | String | Upload ID of the object |
is_live | String | Indicates whether the object is live or not |
passthrough | String | Passthrough of the object |
live_stream_id | String | Live stream ID of the object |
master | String | Master of the object |
master_access | String | Master access |
mp4_support | String | MP4 support (depreciated) |
source_asset_id | String | Source Asset Id |
nomralize_audio | String | Normalize Audio |
static_renditions | String | Static Renditions |
recording_times | String | Recording Times |
non_standard_input_reasons | String | Non Standard Input Reasons |
test | String | Test flag |
ingest_type | String | Ingest type |
meta | Meta | Meta data of the object |
PlaybackID Type
| Field | Type | Description |
|---|---|---|
id | String | ID of the playback |
policy | String | Policy of the playback |
Track Type
| Field | Type | Description |
|---|---|---|
id | String | Track ID |
type | String | Track type |
text_source | String | Text source |
text_type | String | Text type |
language_code | String | Language code |
name | String | Track name |
closed_captions | String | Closed captions |
duration | Float | The duration of the track in seconds |
max_width | Int | The maximum width of the track |
max_height | Int | The maximum height of the track |
max_frame_rate | Int | The maximum frame rate of the track |
Meta Type
| Field | Type | Description |
|---|---|---|
title | String | Title of the asset |
external_id | String | External ID of the asset |
creator_id | String | Creator ID of the asset |
Example Queries
Basic Query - Get All Mux Assets
graphql
query {
muxAssets {
id
asset_id
asset_status
duration
aspect_ratio
created_at
playback_ids {
id
policy
}
tracks {
id
type
duration
max_width
max_height
language_code
}
meta {
title
external_id
creator_id
}
}
}json
{
"data": {
"muxAssets": [
{
"id": "123",
"asset_id": "abc123def456",
"asset_status": "ready",
"duration": "120.5",
"aspect_ratio": "16:9",
"created_at": "2023-12-01T10:30:00Z",
"playback_ids": [
{
"id": "playback_123",
"policy": "public"
}
],
"tracks": [
{
"id": "track_123",
"type": "video",
"duration": 120.5,
"max_width": 1920,
"max_height": 1080,
"max_frame_rate": 30,
"language_code": "en"
},
{
"id": "track_124",
"type": "audio",
"duration": 120.5,
"language_code": "en"
}
],
"meta": {
"title": "Sample Video",
"external_id": "ext_123",
"creator_id": "user_456"
}
}
]
}
}Filtered Query - Get Live Assets with Specific Status
graphql
query {
muxAssets(
asset_status: ["ready"]
is_live: [true]
limit: 10
orderBy: "created_at"
) {
id
asset_id
asset_status
is_live
duration
aspect_ratio
playback_ids {
id
policy
}
tracks {
id
type
duration
max_width
max_height
}
meta {
title
external_id
}
}
}Single Asset Query
graphql
query {
muxAsset(asset_id: ["your-asset-id-here"]) {
id
asset_id
asset_status
duration
aspect_ratio
max_stored_resolution
max_stored_frame_rate
resolution_tier
encoding_tier
playback_ids {
id
policy
}
tracks {
id
type
text_type
language_code
name
duration
max_width
max_height
max_frame_rate
}
meta {
title
external_id
creator_id
}
errors
upload_id
passthrough
live_stream_id
master
master_access
mp4_support
source_asset_id
static_renditions
recording_times
non_standard_input_reasons
test
ingest_type
}
}json
{
"data": {
"muxAsset": {
"id": "123",
"asset_id": "abc123def456ghi789",
"asset_status": "ready",
"duration": "120.5",
"aspect_ratio": "16:9",
"max_stored_resolution": "1920x1080",
"max_stored_frame_rate": "30",
"resolution_tier": "1080p",
"encoding_tier": "smart",
"playback_ids": [
{
"id": "playback_123456789",
"policy": "public"
},
{
"id": "playback_987654321",
"policy": "signed"
}
],
"tracks": [
{
"id": "track_video_123",
"type": "video",
"text_type": null,
"language_code": "en",
"name": "Main Video Track",
"duration": 120.5,
"max_width": 1920,
"max_height": 1080,
"max_frame_rate": 30
},
{
"id": "track_audio_124",
"type": "audio",
"text_type": null,
"language_code": "en",
"name": "Stereo Audio",
"duration": 120.5,
"max_width": null,
"max_height": null,
"max_frame_rate": null
},
{
"id": "track_subtitles_125",
"type": "text",
"text_type": "subtitles",
"language_code": "en",
"name": "English Subtitles",
"duration": 120.5,
"max_width": null,
"max_height": null,
"max_frame_rate": null
}
],
"meta": {
"title": "Sample Marketing Video",
"external_id": "marketing_video_001",
"creator_id": "user_456789"
},
"errors": null,
"upload_id": "upload_abc123def456",
"passthrough": "{\"project\":\"marketing\",\"campaign\":\"q4_2023\"}",
"live_stream_id": null,
"master": "{\"access\":\"public\",\"url\":\"https://stream.mux.com/abc123def456.m3u8\"}",
"master_access": "public",
"mp4_support": "standard",
"source_asset_id": null,
"static_renditions": "{\"files\":[{\"name\":\"track_video_123.mp4\",\"ext\":\"mp4\",\"height\":720,\"width\":1280}]}",
"recording_times": null,
"non_standard_input_reasons": null,
"test": false,
"ingest_type": "on_demand"
}
}
}Notes
- All queries require appropriate GraphQL permissions to be configured in Craft CMS
- The
QueryArgumenttype supports various comparison operators (equals, not equals, greater than, less than, etc.) - Date parameters accept various formats including ISO 8601 strings
- The
searchparameter performs full-text search across searchable fields - Pagination is handled through
limitandoffsetparameters - Results can be ordered using the
orderByparameter with field names