M2A Live (v4)

Download OpenAPI specification:Download

M2A Media: ta@m2amedia.tv URL: https://www.m2amedia.tv License: MIT

Overview

The M2A Live service provides an API for creating and managing the resources required to deliver a live streaming video workflow on top of the AWS media services suite, including AWS MediaLive. In this version, the following resources are supported:

  • Encoders An encoder resource represents the encoding of a single logical input stream into one or more output renditions that may be distributed to one or more destinations of the same type. Encoders must be created within an M2A Cloud Target Account which has been set up for your Organisation. Each encoder is associated with a specific AWS region. If multi-region resiliency is required multiple encoders are defined in different AWS regions.
  • Standalone Inputs A standalone input is a long-lived MediaLive input resource that persists independently of any encoder. Standalone inputs are used when static IP addresses are required for push-type inputs (RTP, RTMP). They can be attached to and detached from channels as needed, but must be managed separately from the encoders that reference them.

Configuring Encoders

New in version v4 An encoder is defined by three core components: a template, a list of inputs, and a list of destinations. Together these describe the full AWS MediaLive channel configuration.

Templates

Each encoder references a named Jinja2 channel template stored in the M2A template service. The template defines the encoding profile — output groups, video/audio codec settings, input attachment structure, and timecode configuration. It is rendered at channel creation time to produce the final AWS MediaLive channel JSON. Use template-configuration to supply per-encoder overrides for any Jinja2 variables (macros) declared in the template. For example, audio PIDs, language codes, or stream-specific bitrate values that differ between encoders that share the same template. Keys must match variable names defined in the template; unrecognised keys are ignored.

Inputs

The template defines a fixed number of InputAttachments. Each input you provide in the inputs array is mapped positionally into the corresponding attachment slot in the rendered template — the first input maps to the first attachment, the second to the second, and so on. The number of inputs provided must not exceed the number of attachment slots in the template. Most single-pipeline templates expect one input. Templates designed for automatic input failover expect two: the primary input first, followed by the secondary. The secondary input is automatically wired into the failover settings on the primary attachment.

Destinations

Destinations define where encoded media is sent. Each destination in the destinations array is matched independently to an output group in the rendered template by its output-group-type and, optionally, its name. Destination properties fall into two logical categories, which may be mixed freely within the same destinations array:

Explicit properties supply the raw target directly:

  • url — the ingest endpoint for HLS, MS Smooth, RTMP, Archive, UDP, CMAF Ingest, and Multiplex output groups.
  • channel-id — a raw AWS MediaPackage channel ID.

M2A resource properties supply an M2A platform identifier that is resolved to the underlying AWS resource or network endpoint at channel creation time:

  • packager-id — an M2A-managed MediaPackage packager. The platform resolves this to the associated MediaPackage channel ID. Mutually exclusive with channel-id; if both are supplied, packager-id takes precedence and channel-id is ignored.
  • connect-source-id — an M2A Connect source, resolved to a UDP endpoint.

If name is specified on a destination, the system looks for an output group with that exact name in the template. If name is omitted, the first output group of the matching type is used.

By default (auto-fix-destinations: true) the system silently drops any template output groups that have no matching destination. Set auto-fix-destinations: false to enforce a strict count match — channel creation will fail if the number of destinations does not exactly match the number of output groups in the rendered template.

API Structure:

The API is modelled on JSONAPI (https://jsonapi.org/format/). Where possible related resources are modelled as Relationships. ie: - a specific account owner (one to one relationship) - mediainputs (one to many relationship) - enrolments (one to many relationship) Owner can be only of type target-account.

HTTP Headers:

The following headers are required for all requests - json { 'Accept': 'application/vnd.api+json', 'Content-Type': 'application/vnd.api+json' }

encoders

Encoder CRUD API

Submit a new encoder definition

An encoder represents the specification of the source content, the encoding profile and the destination(s) the encoded content is to be delivered to. A 'success' HTTP status code merely means that the definition has been persisted. An encoder must be started and stopped by the client application based on the required schedule. To automatically apply actions every time the encoder starts, set schedule-actions in the encoder settings block. Actions are submitted individually as immediate actions, in list order, each time the encoder reaches RUNNING state, including restarts. Only motion-graphics-activate, motion-graphics-deactivate, static-image-activate, and static-image-deactivate are currently implemented; other types return 501 Not Implemented. Set to null to remove.

Authorizations:
http_security_schema
header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Content-Type
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

The original media type of the resource.

Request Body schema: application/vnd.api+json
required
object (Data Element)

JSONAPI data element

Responses

Callbacks

Request samples

Content type
application/vnd.api+json
{
  • "data": {
    }
}

Response samples

Content type
application/vnd.api+json
{
  • "data": {
    }
}

Callback payload samples

Callback
POST: Invoke state transition webhook
Content type
application/vnd.api+json
{
  • "state": "IN_PROGRESS",
  • "id": "03ac6692-84b9-11ea-b791-5ff49275eb0b"
}

List encoders

Returns a cursor-paginated list of encoders owned by the specified target account. Results are returned in an unspecified but stable order; use page[cursor] from the previous response's links.next to retrieve subsequent pages.

Authorizations:
http_security_schema
query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

page[cursor]
string

Opaque cursor returned in the previous response's links.next. Pass this value to retrieve the next page of results.

page[limit]
integer >= 1
Default: 20

Maximum number of resources to return per page.

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Responses

Response samples

Content type
application/vnd.api+json
{
  • "data": [
    ],
  • "links": {
    }
}

Get encoder by ID

Gets an encoder by its ID

Authorizations:
http_security_schema
path Parameters
encoder-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the encoder

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Responses

Response samples

Content type
application/vnd.api+json
{
  • "data": {
    }
}

inputs

Standalone MediaLive Input CRUD API

Create a new standalone input

Creates a long-lived MediaLive input that persists independently of channels. Use standalone inputs when static IP addresses are required for push-type inputs (RTP, RTMP).

Authorizations:
http_security_schema
header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Content-Type
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

The original media type of the resource.

Request Body schema: application/vnd.api+json
required
object (Data Element)

JSONAPI data element

Responses

Request samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

Response samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

List standalone inputs

Lists standalone inputs for the specified owner.

Authorizations:
http_security_schema
query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

page[cursor]
string

Opaque cursor returned in the previous response's links.next. Pass this value to retrieve the next page of results.

page[limit]
integer >= 1
Default: 20

Maximum number of resources to return per page.

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Responses

Response samples

Content type
application/vnd.api+json
{
  • "data": [
    ],
  • "links": {
    }
}

Get standalone input by ID

Gets a standalone input by its ID

Authorizations:
http_security_schema
path Parameters
input-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the standalone input

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Responses

Response samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

Update a standalone input

Updates a standalone input. All attributes are optional for partial update. When an If-Match header is supplied, the update is rejected with 412 Precondition Failed if the resource has been modified since the ETag was obtained.

Immutable fields: The input type, region, and all network settings are fixed at creation and cannot be changed.

Pipeline mode: The number of items in array fields (sources, flow-arns, connect-source-ids, srt-caller-settings) cannot be changed. MediaLive pipeline mode — single (1 item) or standard/dual (2 items) — is determined at creation and is immutable.

No-op detection: If the request attributes are identical to the current state of the resource, the server returns 304 Not Modified with the current ETag header and performs no update.

State requirements: The input must be in READY provisioning-state. The input must also be in DETACHED attachment-state; requests that violate these constraints are rejected with 409 Conflict.

Authorizations:
http_security_schema
path Parameters
input-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the standalone input

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

If-Match
string

ETag value from a previous GET response. Used for optimistic concurrency control.

Content-Type
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

The original media type of the resource.

Request Body schema: application/vnd.api+json
required
object (Data Element)

JSONAPI data element

Responses

Request samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

Response samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

Delete a standalone input

Deletes a standalone input. The input must be detached from all channels and be in READY or FAILED provisioning state before deletion. When an If-Match header is supplied, the delete is rejected with 412 Precondition Failed if the resource has been modified since the ETag was obtained.

Authorizations:
http_security_schema
path Parameters
input-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the standalone input

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

If-Match
string

ETag value from a previous GET response. Used for optimistic concurrency control.

Responses

Response samples

Content type
application/vnd.api+json
{
  • "errors": [
    ]
}

actions

Submit and manage control actions for encoders. The action-type field determines the behaviour and which schema applies.


Scheduled actions

Scheduled actions (SCHEDULED) allow dynamic, real-time changes to a live encoder without stopping the stream — graphics overlays, input switches, SCTE-35 markers, timed metadata

The encoder must be in IDLE or RUNNING state. The settings.type field identifies the action; settings.timing controls when it fires.

Timing types (settings.timing.type):

  • immediate — as soon as possible after submission.
  • fixed — at a specific wall-clock time. Requires settings.timing.time.
  • follow — relative to another action. Requires settings.timing.reference-action-id and settings.timing.follow-point.

Status for scheduled actions uses ScheduleActionStatus: PENDINGACTIVE / FIREDINACTIVE / FAILED.

Currently implemented: motion-graphics-activate, motion-graphics-deactivate, static-image-activate, static-image-deactivate. All other scheduled action types have schemas defined but return 501 Not Implemented.

Startup scheduled actions: Encoders can be configured with schedule-actions (in the encoder settings). These are submitted automatically each time the encoder reaches RUNNING state, including restarts. The resulting action records are returned in the encoder response under schedule-actions.

To cancel a scheduled action before it fires, use DELETE /encoders/{encoder-id}/actions/{action-id}. Only PENDING actions can be deleted.


Slate actions

Slate actions replace the encoder's live output with a pre-configured slate (fallback) clip. Use slating to fill airtime during source failures, ad breaks, or planned pauses without stopping the encoder.

All slate actions require the encoder to be RUNNING. The sequence for managing a slate is:

Action Purpose
PREPARE_SLATE Pre-loads the slate input. Requires material-id.
START_SLATE Switches output to the slate. Requires material-id.
SWITCH_SLATE Switches to a different slate while one is active. Requires material-id.
STOP_SLATE Restores live output, ending the active slate.
DELETE_FIXED_SLATE Cancels a fixed-time slate that has not yet fired.

Use slate-action-type: FIXED with slate-datetime on START_SLATE or SWITCH_SLATE to schedule the transition at a specific wall-clock time rather than immediately.


Lifecycle actions

Lifecycle actions transition the encoder between states (START, STOP, RESTART, PAUSE, RESUME, etc.). Each action is processed asynchronously. The response status field (ACTIVE, COMPLETE, FAILED) reflects the outcome.

Submit an action to multiple encoders

Submits an action to multiple encoders simultaneously. All encoders receive the same action. action-type determines which schema applies.

Currently supported action types: SCHEDULED.

Validation: All encoders are validated upfront. If any encoder fails validation the entire request returns 409 and no records are created.

Returns 207 Multi-Status with one action record per encoder. Each record starts as PENDING. If AWS later rejects an action, its status transitions to FAILED with an error-detail explaining why.

Authorizations:
http_security_schema
header Parameters
Content-Type
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

The original media type of the resource.

Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Request Body schema: application/vnd.api+json
required
object

Responses

Request samples

Content type
application/vnd.api+json
{
  • "data": {
    }
}

Response samples

Content type
application/vnd.api+json
{
  • "data": [
    ]
}

List actions for an encoder

Returns the action history for an encoder, most recent first. Use page[cursor] for pagination.

Authorizations:
http_security_schema
path Parameters
encoder-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the encoder

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

page[cursor]
string

Opaque cursor returned in the previous response's links.next. Pass this value to retrieve the next page of results.

page[limit]
integer >= 1
Default: 20

Maximum number of resources to return per page.

filter[action-type]
Array of strings (Encoder Action Type)
Items Enum: "START" "STOP" "RESTART" "START_PAUSED" "PAUSE" "RESUME" "CONFIGURE" "DELETE" "END" "PREPARE_SLATE" "START_SLATE" "SWITCH_SLATE" "STOP_SLATE" "DELETE_FIXED_SLATE" "SCHEDULED"

Filter results by action type. Accepts a comma-separated list to match multiple types e.g. filter[action-type]=START,STOP.

filter[status]
Array of strings
Items Enum: "PENDING" "ACTIVE" "INACTIVE" "FIRED" "FAILED" "COMPLETE"

Filter results by action status. Accepts a comma-separated list to match multiple statuses e.g. filter[status]=PENDING,ACTIVE. Valid values cover both lifecycle/slate statuses (ACTIVE, COMPLETE, FAILED) and scheduled action statuses (PENDING, ACTIVE, INACTIVE, FIRED, FAILED).

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Responses

Response samples

Content type
application/vnd.api+json
{
  • "data": [
    ],
  • "links": {
    }
}

Submit an encoder action

Submits a lifecycle, slate, or scheduled action for an encoder. The action-type field in the request body determines which schema applies and how the action is processed.


Lifecycle actions — transition the encoder between states. Processed asynchronously. status starts as ACTIVE and transitions to COMPLETE or FAILED.

Action Valid from state
START INITIAL
STOP RUNNING
RESTART RUNNING
START_PAUSED INITIAL
PAUSE RUNNING
RESUME PAUSED
CONFIGURE PAUSED
DELETE Any
END RUNNING

Slate actions — control slate output on a running encoder (V4 only). Require material-id except for STOP_SLATE and DELETE_FIXED_SLATE. Use slate-action-type: FIXED with slate-datetime to fire at a specific time. status starts as ACTIVE and transitions to COMPLETE or FAILED.


Scheduled actions (SCHEDULED) — submit a runtime-controlled action directly to the encoder's MediaLive schedule (e.g. graphics overlay, input switch, SCTE-35 markers).

  • The encoder must be in IDLE or RUNNING state. Submitting a SCHEDULED action when the encoder is in any other state returns 409 Conflict.
  • settings.type identifies the action. settings.timing controls when it fires (immediate, fixed, or follow).
  • Returns 201 Created immediately. status starts as PENDING and transitions based on the action type — see ScheduleActionStatus.

To delete a SCHEDULED action before it fires, use DELETE /encoders/{encoder-id}/actions/{action-id}. Only actions in PENDING status can be deleted.

Authorizations:
http_security_schema
path Parameters
encoder-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the encoder

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Content-Type
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

The original media type of the resource.

Request Body schema: application/vnd.api+json
required
object

Responses

Request samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

Response samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

Get an action

Returns a single action record by its ID.

Authorizations:
http_security_schema
path Parameters
encoder-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the encoder

action-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The unique ID of a scheduled action. Returned in the 207 Multi-Status response body when the action was submitted.

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

Responses

Response samples

Content type
application/vnd.api+json
Example
{
  • "data": {
    }
}

Delete a pending scheduled action

Deletes a SCHEDULED action that has not yet fired. Only actions with status: PENDING can be deleted — attempting to delete an action in any other status (ACTIVE, FIRED, INACTIVE) returns 409 Conflict. When an If-Match header is supplied, the delete is rejected with 412 Precondition Failed if the resource has been modified since the ETag was obtained.

This removes the entry from the encoder's MediaLive schedule. Once an action has fired it cannot be undone via this endpoint.

Note: Only SCHEDULED action types are supported. Attempting to delete a lifecycle or slate action returns 409 Conflict.

Authorizations:
http_security_schema
path Parameters
encoder-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the encoder

action-id
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: 03ac6692-84b9-11ea-b791-5ff49275eb0b

The unique ID of a scheduled action. Returned in the 207 Multi-Status response body when the action was submitted.

query Parameters
owner
required
string (Resource Identifier) ^[a-zA-Z0-9_-]{8,36}$
Example: owner=03ac6692-84b9-11ea-b791-5ff49275eb0b

The ID of the Target Account

header Parameters
Accept
required
string (JsonAPIMediaType)
Value: "application/vnd.api+json"

Content type (expressed as MIME types) the client is able to understand.

If-Match
string

ETag value from a previous GET response. Used for optimistic concurrency control.

Responses

Response samples

Content type
application/vnd.api+json
{
  • "error": "400 Bad Request: The browser (or proxy) sent a request that this server could not understand.",
  • "messages": {
    }
}