Skip to main content
POST
/
downloadQueue
/
{queueId}
/
add
PlexGO
package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.DownloadQueue.AddDownloadQueueItems(ctx, operations.AddDownloadQueueItemsRequest{
        QueueID: 984925,
        Keys: []string{
            "/library/metadata/3",
            "/library/metadata/6",
        },
        AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(),
        AudioBoost: plexgo.Pointer[int64](50),
        AudioChannelCount: plexgo.Pointer[int64](5),
        AutoAdjustQuality: components.BoolIntOne.ToPointer(),
        AutoAdjustSubtitle: components.BoolIntOne.ToPointer(),
        DirectPlay: components.BoolIntOne.ToPointer(),
        DirectStream: components.BoolIntOne.ToPointer(),
        DirectStreamAudio: components.BoolIntOne.ToPointer(),
        DisableResolutionRotation: components.BoolIntOne.ToPointer(),
        HasMDE: components.BoolIntOne.ToPointer(),
        Location: components.LocationWan.ToPointer(),
        MediaBufferSize: plexgo.Pointer[int64](102400),
        MediaIndex: plexgo.Pointer[int64](0),
        MusicBitrate: plexgo.Pointer[int64](5000),
        Offset: plexgo.Pointer[float64](90.5),
        PartIndex: plexgo.Pointer[int64](0),
        Path: plexgo.Pointer("/library/metadata/151671"),
        PeakBitrate: plexgo.Pointer[int64](12000),
        PhotoResolution: plexgo.Pointer("1080x1080"),
        Protocol: components.ProtocolDash.ToPointer(),
        SecondsPerSegment: plexgo.Pointer[int64](5),
        SubtitleSize: plexgo.Pointer[int64](50),
        VideoBitrate: plexgo.Pointer[int64](12000),
        VideoQuality: plexgo.Pointer[int64](50),
        VideoResolution: plexgo.Pointer("1080x1080"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
{
  "MediaContainer": {
    "identifier": "<string>",
    "offset": 123,
    "size": 123,
    "totalSize": 123,
    "AddedQueueItems": [
      {
        "id": 123,
        "key": "<string>"
      }
    ]
  }
}

Authorizations

X-Plex-Token
string
header
required

The token which identifies the user accessing the PMS. This can be either:

  • A traditional access token obtained from plex.tv
  • A JWT token obtained through the JWT authentication flow

JWT tokens provide better security with:

  • Short-lived tokens (7 days expiration)
  • Public-key cryptography (ED25519)
  • Better clock synchronization
  • Individual device revocation capability

Headers

accepts
enum<string>
default:application/xml

Indicates the client accepts the indicated media types

Available options:
application/json,
application/xml
X-Plex-Client-Identifier
string
required

An opaque identifier unique to the client

Example:

"abc123"

X-Plex-Product
string

The name of the client product

Example:

"Plex for Roku"

X-Plex-Version
string

The version of the client application

Example:

"2.4.1"

X-Plex-Platform
string

The platform of the client

Example:

"Roku"

X-Plex-Platform-Version
string

The version of the platform

Example:

"4.3 build 1057"

X-Plex-Device
string

A relatively friendly name for the client device

Example:

"Roku 3"

X-Plex-Model
string

A potentially less friendly identifier for the device model

Example:

"4200X"

X-Plex-Device-Vendor
string

The device vendor

Example:

"Roku"

X-Plex-Device-Name
string

A friendly name for the client

Example:

"Living Room TV"

X-Plex-Marketplace
string

The marketplace on which the client application is distributed

Example:

"googlePlay"

Path Parameters

queueId
integer
required

The queue id

Query Parameters

keys
string[]
required

Keys to add

advancedSubtitles
enum<string>

Indicates how incompatible advanced subtitles (such as ass/ssa) should be included: * 'burn' - Burn incompatible advanced text subtitles into the video stream * 'text' - Transcode incompatible advanced text subtitles to a compatible text format, even if some markup is lost

Available options:
burn,
text,
unknown
audioBoost
integer

Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc)

Required range: x >= 1
audioChannelCount
integer

Target video number of audio channels.

Required range: 1 <= x <= 8
autoAdjustQuality
enum<integer>

Indicates the client supports ABR.

Available options:
0,
1
autoAdjustSubtitle
enum<integer>

Indicates if the server should adjust subtitles based on Voice Activity Data.

Available options:
0,
1
directPlay
enum<integer>

Indicates the client supports direct playing the indicated content.

Available options:
0,
1
directStream
enum<integer>

Indicates the client supports direct streaming the video of the indicated content.

Available options:
0,
1
directStreamAudio
enum<integer>

Indicates the client supports direct streaming the audio of the indicated content.

Available options:
0,
1
disableResolutionRotation
enum<integer>

Indicates if resolution should be adjusted for orientation.

Available options:
0,
1
hasMDE
enum<integer>

Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1

Available options:
0,
1
location
enum<string>

Network type of the client, can be used to help determine target bitrate.

Available options:
lan,
wan,
cellular
mediaBufferSize
integer

Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks.

mediaIndex
integer

Index of the media to transcode. -1 or not specified indicates let the server choose.

musicBitrate
integer

Target bitrate for audio only files (in kbps, used to transcode).

Required range: x >= 0
offset
number

Offset from the start of the media (in seconds).

partIndex
integer

Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode

path
string

Internal PMS path of the media to transcode.

peakBitrate
integer

Maximum bitrate (in kbps) to use in ABR.

Required range: x >= 0
photoResolution
string

Target photo resolution.

protocol
enum<string>

Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022)

Available options:
http,
hls,
dash
secondsPerSegment
integer

Number of seconds to include in each transcoded segment

subtitleSize
integer

Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect)

Required range: x >= 1
subtitles
enum<string>

Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream

Available options:
auto,
burn,
none,
sidecar,
embedded,
segmented,
unknown
videoBitrate
integer

Target video bitrate (in kbps).

Required range: x >= 0
videoQuality
integer

Target photo quality.

Required range: 0 <= x <= 99
videoResolution
string

Target maximum video resolution.

Response

200 - application/json

OK

MediaContainer
object

MediaContainer is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable. Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination) The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the parentTitle attribute may appear on the MediaContainer rather than being repeated on each track.