BoxCast <Developer />   API Reference

Please note: In some cases, this documentation may be out of date. For additional API or integration assistance, visit the Developer Support Portal.

Overview

The BoxCast API exists to provide partners and broadcasters with programmatic access to BoxCast's services, including scheduling broadcasts, embedding video players, consuming view statistics, etc. In general, anything that a broadcaster can accomplish through the BoxCast web dashboard can be accomplished directly through the API.

Endpoint Access

API requests must be encrypted via TLS/SSL. Unencrypted requests will be rejected.

All resources are accessed relative to the API base URL:

https://rest.boxcast.com/

Guiding Principles

The BoxCast API conforms to a standard HTTP REST pattern. It is organized as a set of resources that can be created, read, updated, deleted, listed and/or searched through HTTP requests. In general, snake_case is used for all resource names, parameters, field names and tokens.

In order to avoid common client bugs, the API also avoids the use of null and never omits unused fields from a response. Instead, meaningful values are returned, such as an empty string ("") or a far-future datetime ("9999-12-31T23:59:59Z") as appropriate.

The following typical patterns are used for resource requests:

HTTP Request PatternDescription
for a resource collection
POST /resourcesCreate a new resource from the posted parameters.
GET /resources/idRead detailed information about the identified resource.
PUT /resources/idUpdate the identified resource from the posted parameters.
DELETE /resources/idDelete the identified resource.
GET /resourcesSearch and list resource summaries.
for a singleton
GET /resourceRead detailed information about the singleton resource.
PUT /resourceUpdate the singleton resource from the posted parameters.

Authentication

The BoxCast API handles authentication in conformance with the OAuth2 protocol (RFC 6749 ). One of the OAuth2 grant types are used to acquire an access token. Once the API client has a valid access token, subsequent authenticated requests can be made by supplying the access token in the HTTP Authorization header as a bearer token (RFC 6750 ).

OAuth2 Authorization Endpoint
https://auth.boxcast.com/oauth2/auth
OAuth2 Token Endpoint
https://auth.boxcast.com/oauth2/token

API Client Credentials

All API clients must be registered before use. Please contact BoxCast customer support to register an API client application and receive valid API client credentials.

ParameterTypeDescriptionRemarks
client_idslug The API client's primary unique identifier.Required.
client_secrettext The API client's secure password. This must be kept secure at all times.Required.

Client Credentials Grant

This type of grant allows BoxCast accounts to programmatically access their own information. For example, a production company may wish to schedule BoxCast broadcasts on their own account as part of their own product. This type of grant is not suitable for a 3rd-party application to access another BoxCast account.

An API client authenticates by directly supplying their API token credentials (not a particular user's email and password) in exchange for an access token.

POST https://auth.boxcast.com/oauth2/token
Authorization: Basic {base-64 encoded client_id:client_secret}
ParameterTypeDescriptionRemarks
grant_typetoken Must be "client_credentials".Required.
scopeslug A space-separated list of scopes that the client will need to access.Optional. If not provided, the returned scope will match the scope of the API key.
Response FieldTypeDescription
token_typetoken Always "bearer".
access_tokenslug The bearer token to make authenticated requests.
expires_innumeric The number of seconds of inactivity before the token expires.
scopeslug A space-separated list of scopes that the client has been granted permission to access.

The API client can now make authenticated requests to the API.

If you're ready, jump to a code sample.

Example

If the API client credentials are client_id=4pQPM2O6hK and client_secret=1oqZV~7.vw (and noting that the base-64 encoding of 4pQPM2O6hK:1oqZV~7.vw is NHBRUE0yTzZoSzoxb3FaVn43LnZ3), then:

POST https://auth.boxcast.com/oauth2/token
Authorization: Basic NHBRUE0yTzZoSzoxb3FaVn43LnZ3
grant_type=client_credentials

Response

200 OK
{
  "token_type": "bearer",
  "access_token": "iq50kw1GmZ5T54PJOVpsvb5merQUwU3IT5f-Xtrxj~6jgBnwF9yCGg~zySOZ4U_ovm5wsvJkhphnDMrg",
  "expires_in": 86400,
  "scope": "owner"
}

Authorization Code Grant

If you are using Client Credentials, you can skip ahead

This type of grant allows BoxCast accounts to be safely integrated into 3rd-party web applications. For example, a website hosting company may want to allow BoxCast customers to integrate their broadcasts into their website without needing to go to the BoxCast dashboard or cut-and-paste any codes. This type of grant makes that possible, while keeping the user's BoxCast account independent from their 3rd-party (e.g. website hosting) account.

An API client authenticates by redirecting a user to BoxCast, which allows the user to login and grant access to the API client. Once the user has granted access, they are redirected to the API client's redirection endpoint (setup during registration) along with a one-time authorization code. The API client can then send this code securely to the BoxCast API in exchange for an access token.

Step 1: The API client sends the user to BoxCast for authentication and permission

https://auth.boxcast.com/oauth2/auth?response_type=code&client_id={client_id}&redirect_uri={redirect_uri}&scope={scope}&state={state}
ParameterTypeDescriptionRemarks
response_typetoken Must be "code".Required.
client_idslug The API client's unique identifier.Required.
redirect_urislug The client's redirection endpoint to which the authorization response will be redirected.Required.
scopeslug A space-separated list of scopes that the client will ask the user for permission to access.Required.
stateslug An opaque random value (at least 8 characters) used to maintain state between the request and callback. It should be used for preventing cross-site request forgery.Required.

Example

GET https://auth.boxcast.com/oauth2/auth?
    response_type=code&client_id=4pQPM2O6hK&redirect_uri=https%3A%2F%2Fexample.com%2Foauth2-callback&scope=owner&state=ap24GknE

Response

200 OK
<html>...omitted...<html>

Step 2: The user logs in to BoxCast and grants permission to the API client

This is all handled on the BoxCast site.

Step 3: BoxCast redirects the user back to the API client with an authorization code

After authenticating the user's credentials and verifying permissions, the user is redirected back to the API client via a secure callback URI that was set during client registration. The authorization response redirects to this callback with the response parameters in the query string.

302 Found
Location: {callback_uri}?code={code}&state={state}
Response FieldTypeDescription
codeslug A one-time use authorization code which can be securely exchanged for an access token.
stateslug The exact same value that was passed in the initial request. API clients should use this to match callbacks to requests and reject any callbacks that are not matched.

NOTE: If there is a problem, then the callback URI will not receive an authorization code, but error fields instead.

Step 4: The API client exchanges the authorization code for an access token

In response, the API client should securely post this authorization code back to the token endpoint in exchange for an access token.

POST https://auth.boxcast.com/oauth2/token
Authorization: Basic {base-64 encoded client_id:client_secret}
ParameterTypeDescriptionRemarks
grant_typetoken Must be "authorization_code".Required.
codeslug The one-time authorization code returned from the authorization endpoint.Required.
redirect_urislug The same redirect_uri which was used during the initial request in Step 1.Required.
Response FieldTypeDescription
token_typetoken Always "bearer".
access_tokenslug The bearer token to make authenticated requests.
expires_innumeric The number of seconds of inactivity before the token expires.
refresh_token (if applicable)slug A long-lived refresh token suitable for saving securely and using to get a new access token later without require the user to login again.
scopeslug A space-separated list of scopes that the client has been granted permission to access.

The API client can now make authenticated requests to the API.

If you're ready, jump to a code sample.

Example

If the API client credentials are client_id=4pQPM2O6hK and client_secret=1oqZV~7.vw (and noting that the base-64 encoding of 4pQPM2O6hK:1oqZV~7.vw is NHBRUE0yTzZoSzoxb3FaVn43LnZ3), then:

POST /oauth2/tokens
Authorization: Basic NHBRUE0yTzZoSzoxb3FaVn43LnZ3
grant_type=authorization_code&code=bDEUJZy~ISjJMlkbf.Zfks~HbDU8a0CaiQeOQyCo.QOv1HeRIW8CkFuN7dm4zYuVfw7jRfNNp~~LKClm&redirect_uri=https%3A%2F%2Fexample.com%2Foauth2-callback

Response

200 OK
{
  "token_type": "bearer",
  "access_token": "iq50kw1GmZ5T54PJOVpsvb5merQUwU3IT5f-Xtrxj~6jgBnwF9yCGg~zySOZ4U_ovm5wsvJkhphnDMrg",
  "expires_in": 86400,
  "refresh_token": "JMjZml6S19qxWp0Jb9Pe4NG5cDTT8nlhzxOp08ajhVKZJViCW5YUj_pXutaUYIEXo9wT7Ei3yf62D-EB",
  "scope": "owner"
}

Public Clients (e.g. Mobile Application)

If the client is unable to securely store the client credentials, such as a mobile application, then the client will not be issued a secret, but must use Proof Key for Code Exchange (PKCE).

This should be handled by a secure implementation, such as AppAuth.


Access Tokens

Once the API client has acquired an access token, it can make authenticated requests by passing it in the HTTP Authorization header as a bearer token (RFC 6750 ).

Example

GET /account
Authorization: Bearer iq50kw1GmZ5T54PJOVpsvb5merQUwU3IT5f-X
               trxj~6jgBnwF9yCGg~zySOZ4U_ovm5wsvJkhphnDMrg

Response

200 OK
{ ...omitted... }

An access token will expire after a certain period of time. Once the token expires, it is no longer valid; any attempt to use an expired token will result in an unauthorized error.


Refresh Tokens

If the client has a refresh token, it can request a new access token without requiring a user to login again.

An API client authenticates by supplying the refresh token (which has a much longer amount of time before expiration) in exchange for an access token.

POST https://auth.boxcast.com/oauth2/token
Authorization: Basic {base-64 encoded client_id:client_secret}
ParameterTypeDescriptionRemarks
grant_typetoken Must be "refresh_token".Required.
refresh_tokenslug The refresh token which was saved securely after the initial authentication.
Response FieldTypeDescription
token_typetoken Always "bearer".
access_tokenslug The bearer token to make authenticated requests.
expires_innumeric The number of seconds of inactivity before the token expires.
refresh_tokenslug A long-lived refresh token suitable for saving securely and using to get a new access token later without require the user to login again.
scopeslug A space-separated list of scopes that the client has been granted permission to access.

The API client can now make authenticated requests to the API.


Scopes

When a client requests access, the user is able to grant or allow the client to access various aspects of their account. These are defined by scopes which the client requests access to and which the user is prompted to grant access.

ScopeDescription
offlineAllows the client to store and use a refresh token.
ownerAllows access to all areas of the account.

Data Types

Data types are used by the API to validate parameters and to define possible values that a resource field may take. The following types are used:

TypeDescriptionExamples
booleanA simple true or false indicator. true, false
numericA simple number. Numeric fields may be integers, floating-point decimals, or negative numbers. A field or parameter using a numeric type may contain additional restrictions about which numbers are considered valid. 42, 3.1415, -9
textAn open text field which can contain any printable characters including newlines and whitespace. "Lorem ipsum dolor sit amet... \n
Sed ut perspiciatis... \n
At vero eos et accusamus... "
stringA single-line of text with no whitespace on either end. All printable characters are valid. "The Main Event", "Iglesia Peña", "*** The #1 Team! ***"
datetimeAn ISO 8601 formatted date/time string in UTC time. "1970-01-01T00:00:00Z", "2013-03-15T15:30:00Z", "9999-12-31T23:59:59Z"
slugA string which consists only of URL-safe characters (A-Z, a-z, 0-9, -, _, ., and ~). "n1237bc12a464", "my-widget", "-~.aFdtmXCyQkLE-uY0_"
tokenA slug which belongs to a set of possible values and has a particular meaning. Any field or parameter using a token will provide a list of possible values along with their meanings. Any value outside of the defined list is considered invalid. See BoxCaster status.
token+A token for which the set of possible values is open-ended. More values can be added to the list without changing the API version, therefore API clients are not guaranteed that the token will be from the list defined at the time that they last read the API documentation. Unknown token values must therefore be handled in a graceful way. Suggestions are provided with the specific documentation for each resource. See BoxCaster warning.
arrayAn array of objects. The expected type for each item's value is given in the resource field description. [], ["xklajsef233", "kj2eij2eokk"], [{"id": 1}, {"id": 2}]
mapA map (or hash) of key-value pairs. Expected types for the map's keys and values are given in the resource field description, although each key is generally a token type. { "name": "can't be blank" }, {}, { "offset": 0, "max": 100, "count": 2 }

Requests

GET requests should pass all parameters in the URL query string.

POST and PUT requests should post all parameters in the request body using a recognized format indicated by the Content-type header. The currently supported content types for posting parameters are:

  • Content-type: application/x-www-form-urlencoded
  • Content-type: application/json


Versioning

The current API version is v1 and the only currently supported representation is JSON. These are (and will remain) the default settings.

In order to minimize API version changes, users of the API must ignore any unknown fields that are returned and handle unknown tokens gracefully (as described in each resource's reference documentation for token+ fields). When new features are added to the API, the version number will only change if the updated API would cause an existing, well-behaved client to function incorrectly.

As they become available, alternate API versions and representations can be selected using the HTTP Accept header. The currently recognized versions are:

  • Accept: application/vnd.boxcast-v1+json


Redirects

The BoxCast API may respond to any request with an HTTP redirect. An API client must follow such redirects according to the HTTP 1.1 spec by retrying the request at the URL given in the Location header. Typically, redirects will be:

HTTP StatusDescription
301The resource has been permanently moved. Future requests should be made to the new URL.
302, 307The resource has been temporarily moved. This request should be retried at the new URL, but future requests should continue to use the old URL.
304The resource has not been modified. The API client should not retry the request, but should rely on its cached copy.

Conditionals

The BoxCast API supports conditional GET requests using the HTTP headers: ETag and If-None-Match. If an API client makes a GET request, it may use the returned ETag header to make subsequent conditional GET requests for the same resource by supplying the ETag in the If-None-Match header. If the resource has not changed, the API will return a status of 304 (Not Modified).

Some resource (as noted) support conditional PUT requests using the HTTP headers: ETag and If-Match. If an API client makes a GET request, it may use the returned ETag header to make subsequent conditional PUT requests for the same resource by supplying the ETag in the If-Match header. If the resource has not changed, the API will modify the resource as requested. However, if the resource has changed, the update will fail with a status of 412 (Precondition Failed). This is very useful for making sensitive updates to avoid conflicting changes that would be unwanted.


Pagination

API requests which search and list summaries from a resource collection are subject to pagination if there are too many results.

If a result list is paginated, the response will include an HTTP X-Pagination header, which is a JSON-encoded object that may contain the following:

KeyDescriptionExample
firstThe page number of the first page of results.
previousThe page number of the previous page of results.
nextThe page number of the next page of results.
lastThe page number of the last page of results.
totalThe total count of results.

When querying a paginated resource, the following request parameters can be provided as querystring arguments to control pagination behavior:

ParameterDescriptionExample
pThe page number to query (0-based index). p=2
lThe page size limit. l=20
sThe sort order of the results. s=-starts_at

Example

GET /account/broadcasts?p=2&s=-starts_at&l=20

Response

200 OK
X-Pagination: {"total":63,"first":0,"previous":1,"next":3,"last":3}
[ ...omitted... ]

Filtering

API requests against a resource collection support a filter syntax for exact matching of certain fields. Some fields support single values, while others may support a list of one or more values.

Filter parameters should be provided in the querystring; filter keys start with filter., and are followed by the key name. For example, filtering a set of resources by broadcast ID b123 would look like filter.broadcast_id=b123. For filters that accept multiple values, the values should be a comma-separated list with no whitespace; for example: filter.ids=b123,b456.


Search

API requests against a resource collection support a text query syntax to narrow down and better filter results. The search is initiated by providing a string as the q querystring parameter.

The search grammar supports several types of instructions.

TypeDescriptionExample
WildcardFind partial word matches. *football*
Exact MatchFind an exact quoted string. "St. Joseph"
Field-ScopedSearch against a single field rather than all. Note that not all fields in a resource support searching against. timeframe:current
Date RangeFilter within a given set of dates. starts_at:[2015-01-01T00:00:00 TO 2015-01-02T00:00:00]
Combination (OR)Space-separated phrases are considered boolean OR. timeframe:past timeframe:current
Combination (AND)Phrases prefixed with a + are boolean AND. football +timeframe:current

Please note that if you attempt to apply a field-scoped search to a field that does not support searching, the API will return an error.


Errors

When an error occurs, the API will generally return a meaningful HTTP error code along with following error fields:

FieldTypeDescription
errortoken+ The type of error condition that occurred. Possible values are:
  • bad_request: The request could not be understood due to malformed syntax.
  • unauthorized: The request requires user authentication.
  • invalid_token: The access token provided is expired, revoked, malformed or invalid for other reasons.
  • payment_required: Payment is required to complete the request.
  • forbidden: The request is forbidden.
  • not_found: The requested resource was not found.
  • conflict: The request could not be completed due to a conflict with the current state of the resource.
  • gone: The requested resource is no longer available.
  • unprocessable_entity: The request could not be processed.
  • too_many_requests: The user has sent too many requests in a given amount of time.
  • internal_server_error: The server encountered an unexpected condition which prevented it from fulfilling the request.
  • not_implemented: The server does not support the functionality required to fulfill the request.
  • bad_gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
  • service_unavailable: The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.
  • gateway_timeout: The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.
  • Other errors may be added to this list without an API version change. Therefore, API clients should treat unknown values as generic errors, relying on the HTTP error code and the error_description to handle such conditions gracefully.
When interacting with an OAuth2 endpoint, the following errors may also occur, as defined in the OAuth2 specification (RFC 6749 ):
  • invalid_request: The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.
  • invalid_client: Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method).
  • invalid_grant: The provided authorization grant is invalid, expired or revoked.
  • unauthorized_client: The authenticated client is not authorized to use this authorization grant type.
  • unsupported_grant_type: The authorization grant type is not supported by the authorization server.
error_descriptionstring A human-friendly description of the error condition.
invalid_fieldsmap A map from field/parameter names (token+) to error descriptions (string), which provides more specific details about invalid fields or parameters.

Example

PUT /account/boxcasters/m9c4ebfb82112
{ "name": "" }

Response

422 Unprocessable Entity
{
  "error": "unprocessable_entity",
  "error_description": "The request could not be processed.",
  "invalid_fields": {
    "name": "can't be blank"
  }
}

Account

An account represents a person or organization that uses BoxCast services. Each account has its own boxcasters, broadcasts, users, etc. which are managed through the account and are not accessible from any other account. An account is the entity which is responsible for paying invoices or receiving profits from ticket sales.

FieldTypeDescription
idslug The primary unique identifier.
namestring A human-friendly name for quick identification and display in user interfaces.
channel_idslug An automatically created channel for all non-private broadcasts that have streamed, are streaming or will stream from the account.
descriptiontext A description of the account which is show to viewers. This text identifies and describes the organization that is providing broadcasts.
time_zonestring The primary time zone in which the organization is based.
static_playlist_urlstring An M3U8 URL containing any currently-live, public broadcasts from this account.
NOTE: This M3U8 URL will return a 404 if there is no currently-live, public content.
NOTE: This URL can be used for integration into certain third party app providers. It should never be distributed directly to viewers. Also be aware that the use of this URL for watching the broadcast will skew your analytics. If you would like to retain analytics, your app should be updated to use one of the supported BoxCast SDKs.

Get Account Detail

Returns all fields for the current account.

GET /account

Example

GET /account

Response

200 OK
{
  "id": "MTVUYQLN",
  "name": "The Ocho",
  "channel_id": "3nRUBPr00vqUSYYKfBtX",
  "description": "The obscure sports network.",
  "time_zone": "Pacific Time (US & Canada)",
  "static_playlist_url": ""https://play.boxcast.com/p/MTVUYQLN/v/all-ext.m3u8?signed=yes"
}

BoxCasters

A BoxCaster is a device that captures, encodes, and transmits an audio/video stream to the BoxCast service over a network.

FieldTypeDescription
idslug The primary unique identifier. Usually, this ID is printed on the underside of the BoxCaster device.
namestring A human-friendly name for quick identification and display in user interfaces.
statustoken An indicator of the current state of the BoxCaster:
  • offline: It has not reported to the BoxCast service for long enough that it is assumed to be powered off or disconnected from the network.
  • ready: It is online and waiting for the next scheduled broadcast.
  • preparing_broadcast: It is preparing for a scheduled broadcast which will be starting soon. Preparation includes finding a valid audio/video source, determining network connection speeds, allocating resources through the BoxCast service and communicating all necessary configuration parameters.
  • broadcasting: It is actively capturing, encoding and transmitting an audio/video stream through the BoxCast service.
warningtoken+ An indicator of any warning condition that the BoxCaster has detected:
  • none: It has no warnings to report.
  • no_video_source: It was preparing a broadcast, but was unable to detect a valid audio/video source. This must be resolved before the BoxCaster can finish preparations and begin broadcasting.
  • updating_firmware: It received a firmware update from the BoxCast service and is updating itself. This only occurs when there are no broadcasts scheduled in the near future. The BoxCaster should not be powered off or disconnected from the network until the firmware update is complete.
  • Other warnings may be added to this list without an API version change. Therefore, API clients should handle an unknown warning gracefully. Generally, a warning when the BoxCaster is offline or ready does not require any immediate action, but a warning that occurs while the BoxCaster is preparing_broadcast or broadcasting indicates a problem with a live stream and will need to be resolved quickly to avoid broadcast failure.
last_seen_atdatetime The last time at which the BoxCaster reported to the BoxCast service. This is helpful information when the BoxCaster is offline.
next_broadcast_atdatetime The start time of the next broadcast that the BoxCaster will need to stream (or of the currently streaming broadcast). This is helpful information when the BoxCaster has an unexpected status, such as being offline during a scheduled broadcast. If there is no upcoming broadcast scheduled on the BoxCaster, then this field will show a far-future date (e.g., 9999-12-31T23:59:59Z).
next_broadcast_idslug The ID of the next broadcast that the BoxCaster will need to stream (or of the currently streaming broadcast). If there is no upcoming broadcast scheduled on the BoxCaster, then this field will be blank.
next_broadcast_namestring The name of the next broadcast that the BoxCaster will need to stream (or of the currently streaming broadcast). If there is no upcoming broadcast scheduled on the BoxCaster, then this field will be blank.
the following fields are excluded from summary responses
channel_idslug An automatically created channel for all non-private broadcasts that have streamed, are streaming or will stream through the BoxCaster.
static_playlist_urlstring An M3U8 URL containing any currently-live, public broadcasts from this BoxCaster.
NOTE: This M3U8 URL will return a 404 if there is no currently-live, public content.
NOTE: This URL can be used for integration into certain third party app providers. It should never be distributed directly to viewers. Also be aware that the use of this URL for watching the broadcast will skew your analytics. If you would like to retain analytics, your app should be updated to use one of the supported BoxCast SDKs.

Get BoxCaster Detail

Returns all fields for the specified BoxCaster.

GET /account/boxcasters/{id}

Example

GET /account/boxcasters/m9c4ebfb82112

Response

200 OK
{
  "id": "m9c4ebfb82112",
  "name": "Main Camera",
  "status": "broadcasting",
  "warning": "none",
  "last_seen_at": "2012-10-09T15:44:09Z",
  "next_broadcast_at": "2012-10-09T15:00:00Z",
  "next_broadcast_id": "e3u2Te__7aaAqUNkjvpj",
  "next_broadcast_name": "Smith Wedding 10/9/12",
  "channel_id": "dSUdyxXH1loPJYIlR4F0",
  "static_playlist_url": ""https://play.boxcast.com/p/dSUdyxXH1loPJYIlR4F0/v/all-ext.m3u8?signed=yes"
}

Update a BoxCaster

Updates the supplied fields of the specified BoxCaster.

PUT /account/boxcasters/{id}
ParameterTypeDescriptionRemarks
namestring The desired name for the BoxCaster.Optional.

Example

PUT /account/boxcasters/m9c4ebfb82112
{ "name": "New Name" }

Response

200 OK
{
  "id": "m9c4ebfb82112",
  "name": "New Name",
  "status": "broadcasting",
  "warning": "none",
  "last_seen_at": "2012-10-09T15:44:09Z",
  "next_broadcast_at": "2012-10-09T15:00:00Z",
  "next_broadcast_id": "e3u2Te__7aaAqUNkjvpj",
  "next_broadcast_name": "Smith Wedding 10/9/12",
  "channel_id": "dSUdyxXH1loPJYIlR4F0",
  "static_playlist_url": ""https://play.boxcast.com/p/dSUdyxXH1loPJYIlR4F0/v/all-ext.m3u8?signed=yes"
}

List BoxCasters

Returns summary fields for all BoxCasters on the current account.

GET /account/boxcasters

Valid filters:

  • filter.ids: List of BoxCaster IDs
  • filter.warning: BoxCaster warning status

Valid queries:

  • id: BoxCaster ID
  • name: BoxCaster name

Valid sorts:

  • id: BoxCaster ID
  • name: BoxCaster name

Example

GET /account/boxcasters

Response

200 OK
[
  {
    "id": "m9c4ebfb82112",
    "name": "Main Camera",
    "status": "broadcasting",
    "warning": "none",
    "last_seen_at": "2012-10-09T15:44:09Z",
    "next_broadcast_at": "2012-10-09T15:00:00Z",
    "next_broadcast_id": "e3u2Te__7aaAqUNkjvpj",
    "next_broadcast_name": "Smith Wedding 10/9/12"
  }, {
    "id": "m9c4ebf96d67a",
    "name": "Mobile Camera",
    "status": "ready",
    "warning": "updating_firmware",
    "last_seen_at": "2012-10-09T15:44:17Z",
    "next_broadcast_at": "2012-10-21T10:30:00Z",
    "next_broadcast_id": "wiY7AZb5oA1U52u0mX8k",
    "next_broadcast_name": "First Service"
  }
]

Example with query and sort

GET /account/boxcasters?q=name:*Camera*&s=id

Response

200 OK
[
  {
    "id": "m9c4ebf96d67a",
    "name": "Mobile Camera",
    "status": "ready",
    "warning": "updating_firmware",
    "last_seen_at": "2012-10-09T15:44:17Z",
    "next_broadcast_at": "2012-10-21T10:30:00Z",
    "next_broadcast_id": "wiY7AZb5oA1U52u0mX8k",
    "next_broadcast_name": "First Service"
  }, {
    "id": "m9c4ebfb82112",
    "name": "Main Camera",
    "status": "broadcasting",
    "warning": "none",
    "last_seen_at": "2012-10-09T15:44:09Z",
    "next_broadcast_at": "2012-10-09T15:00:00Z",
    "next_broadcast_id": "e3u2Te__7aaAqUNkjvpj",
    "next_broadcast_name": "Smith Wedding 10/9/12"
  }
]

Broadcasts

A broadcast represents a single audio/video stream with a name, description and start/stop times. A broadcast is always streamed through a specific BoxCaster, and it may have a live stream or recording associated with it or it may be a mere placeholder (i.e. if it is scheduled to start in the future).

FieldTypeDescription
idslug The primary unique identifier.
namestring A human-friendly name for quick identification and display in user interfaces.
channel_idslug An automatically created channel which consists only of this broadcast (even if the broadcast is private).
previewstring A URL to a thumbnail image for the broadcast, if available.
posterstring A URL to a full-size poster image for the broadcast, if available.
stream_sourcetoken The source of the audio and video for the broadcast:
  • boxcaster: Streamed from a BoxCaster.
  • app: Streamed from the Broadcaster app for iOS.
  • switcher: Streamed from Switcher Studio for iOS.
  • rtmp: Streamed from an external RTMP source.
boxcaster_idslug The id of the BoxCaster that streamed or will stream the broadcast. Empty if stream_source is not boxcaster.
boxcaster_namestring The name of the BoxCaster that streamed or will stream the broadcast. Empty if stream_source is not boxcaster.
audio_sourcetoken The audio source the BoxCaster will use when streaming:
  • default: BoxCaster will use the audio source from its configuration.
  • embedded: BoxCaster will use embedded audio. BoxCaster Pro only
  • hdmi: BoxCaster will use HDMI audio. BoxCaster only
  • analog: BoxCaster will use analog audio.
starts_atdatetime The scheduled start time for the broadcast.
stops_atdatetime The scheduled stop time for the broadcast.
timeframetoken An indicator of the timeframe in which this broadcast is scheduled to stream:
  • future: The broadcast is scheduled to stream at some time in the future.
  • preroll: The broadcast is scheduled to start streaming very soon and is preparing now.
  • current: The broadcast is currently scheduled to be streaming now.
  • past: The broadcast was scheduled to stream at some time in the past.
is_privateboolean A public broadcast may be listed and promoted by BoxCast so that a public viewer can find it easily. If a broadcast is private, however, then BoxCast will generate an obfuscated channel for the broadcast and will not promote it or list it in any channels (except for its own channel). This is useful, for example, when creating a test broadcast.
is_ticketedboolean A ticketed broadcast requires a ticket purchase to view the full stream. Some ticketed broadcasts offer a variant stream which is viewable without a ticket purchase (so-called "flex" broadcasts).
ticket_pricenumeric The purchase price in USD for a ticket to view the highest quality version of the broadcast. All values are rounded to two decimal places.
free_varianttoken+ A variant of the broadcast which may be viewed without purchasing a ticket:
  • none: There is no free variant; the stream can only be viewed by purchasing a ticket.
  • best: All variants are free; there is no need to purchase a ticket to view the stream.
  • low: A lower quality (SD-only) variant of the stream is available for free viewing.
  • audio: An audio-only variant of the stream is available for free listening.
  • Other variants may be added to this list without an API version change. Therefore, API clients should handle an unknown variant gracefully.
viewer_urlstring The URL at which BoxCast hosts a web page for viewers to watch the broadcast live or recorded.
total_view_countnumeric The total number of times this broadcast was watched.
total_minutes_viewednumeric The total duration in minutes that this broadcast was watched, across all views.
total_active_viewer_countnumeric The total number of currently active viewers of this broadcast.
the following fields are excluded from summary responses
descriptiontext Additional information to display to viewers about the broadcast.
in_channel_idsarray of strings The IDs of any additional Channels the broadcast has been added to.
static_playlist_urlstring An M3U8 URL that can always be used to play this broadcast.
NOTE: This URL can be used for integration into certain third party app providers. It should never be distributed directly to viewers. Also be aware that the use of this URL for watching the broadcast will skew your analytics. If you would like to retain analytics, your app should be updated to use one of the supported BoxCast SDKs.

Schedule a Broadcast

Creates a new scheduled broadcast from the supplied fields.

POST /account/broadcasts
ParameterTypeDescriptionRemarks
namestring The desired name for the broadcast.Required.
stream_sourceslug The source of the audio and video for the broadcast. Typically this is boxcaster.Required.
boxcaster_idslug The id of the BoxCaster that will stream this broadcast.Required if stream_source is boxcaster.
audio_sourcetoken The audio_source the BoxCaster will use when streaming.Optional
static_rtmp_idslug The id of the RTMP source that will stream this broadcast.Required if stream_source is rtmp.
starts_atdatetime The desired starts_at for the broadcast.Required; can't be in the past. The keyword now may also be used instead of a datetime to start the broadcast as soon as possible.
stops_atdatetime The desired stops_at for the broadcast.Optional; must be after starts_at. The keyword now may also be used instead of a datetime to stop the broadcast as soon as possible.
is_privateboolean Whether or not the broadcast should be private.Optional.
is_ticketedboolean Whether or not the broadcast should be ticketed.Optional.
ticket_pricenumeric The desired ticket_price for the broadcast (ignored if not ticketed).Optional.
free_varianttoken+ The desired free_variant for the broadcast (ignored if not ticketed).Optional.
descriptiontext The desired description for the broadcast.Optional.
in_channel_idsarray of strings The desired list of Channel IDs for the broadcast.Optional.
target_video_resolutionnumeric The desired target video resolution for the broadcast.

Note: This is just a target and the actual video resolution could differ based on source, account limitations, etc.
Optional. For best results use 1080, 720 or 480

Example

POST /account/broadcasts
{
  "name": "Celtics vs Knicks",
  "stream_source": "boxcaster",
  "boxcaster_id": "n9c4ebf123456",
  "starts_at": "2013-04-28T23:00:00Z",
  "stops_at": "2013-04-29T02:00:00Z"
}

Response

200 OK
{
  "id": "Z7a0XjcgnYpUIuKqvxGk",
  "name": "Celtics vs Knicks",
  "channel_id": "celtics-vs-knicks",
  "stream_source": "boxcaster",
  "boxcaster_id": "n9c4ebf123456",
  "boxcaster_name": "Main Camera",
  "starts_at": "2013-04-28T23:00:00Z",
  "stops_at": "2013-04-29T02:00:00Z",
  "timeframe": "future",
  "is_private": false,
  "is_ticketed": false,
  "ticket_price": 0,
  "free_variant": "best",
  "viewer_url": "https://www.boxcast.com/show/#/celtics-vs-knicks",
  "description": "",
  "in_channel_ids": [],
  "static_playlist_url": ""https://play.boxcast.com/p/Z7a0XjcgnYpUIuKqvxGk/v/all-ext.m3u8?signed=yes"
}

Get Broadcast Detail

Returns all fields for the specified broadcast.

GET /account/broadcasts/{id}

Example

GET /account/broadcasts/Z7a0XjcgnYpUIuKqvxGk

Response

200 OK
{
  "id": "Z7a0XjcgnYpUIuKqvxGk",
  "name": "Celtics vs Knicks",
  "channel_id": "celtics-vs-knicks",
  "boxcaster_id": "m9c4ebfb82112",
  "boxcaster_name": "Main Camera",
  "starts_at": "2013-04-28T23:00:00Z",
  "stops_at": "2013-04-29T02:00:00Z",
  "timeframe": "future",
  "is_private": false,
  "is_ticketed": true,
  "ticket_price": 5.95,
  "free_variant": "low",
  "viewer_url": "https://www.boxcast.com/show/#/celtics-vs-knicks",
  "description": "Lorem ipsum dolor sit...",
  "in_channel_ids": [],
  "static_playlist_url": ""https://play.boxcast.com/p/Z7a0XjcgnYpUIuKqvxGk/v/all-ext.m3u8?signed=yes"
}

Update a Broadcast

Updates the supplied fields of the specified broadcast.

PUT /account/broadcasts/{id}
ParameterTypeDescriptionRemarks
namestring The desired name for the broadcast.Optional.
boxcaster_idslug The id of the BoxCaster that will stream this broadcast.Optional.
audio_sourcetoken The audio_source the BoxCaster will use when streaming.Optional
starts_atdatetime The desired starts_at for the broadcast.Optional; can't be in the past.
stops_atdatetime The desired stops_at for the broadcast.Optional; must be after starts_at.
is_privateboolean Whether or not the broadcast should be private.Optional.
is_ticketedboolean Whether or not the broadcast should be ticketed.Optional.
ticket_pricenumeric The desired ticket_price for the broadcast (ignored if not ticketed).Optional.
free_varianttoken+ The desired free_variant for the broadcast (ignored if not ticketed).Optional.
descriptiontext The desired description for the broadcast.Optional.
in_channel_idsarray of strings The desired list of Channel IDs for the broadcast.Optional.

Example

PUT /account/broadcasts/Z7a0XjcgnYpUIuKqvxGk
{
  "name": "The Big Game",
  "description": "This is a really big deal."
}

Response

200 OK
{
  "id": "Z7a0XjcgnYpUIuKqvxGk",
  "name": "The Big Game",
  "channel_id": "celtics-vs-knicks",
  "boxcaster_id": "m9c4ebfb82112",
  "boxcaster_name": "Main Camera",
  "starts_at": "2013-04-28T23:00:00Z",
  "stops_at": "2013-04-29T02:00:00Z",
  "timeframe": "future",
  "is_private": false,
  "is_ticketed": true,
  "ticket_price": 5.95,
  "free_variant": "low",
  "viewer_url": "https://www.boxcast.com/show/#/celtics-vs-knicks",
  "description": "This is a really big deal.",
  "in_channel_ids": [],
  "static_playlist_url": ""https://play.boxcast.com/p/Z7a0XjcgnYpUIuKqvxGk/v/all-ext.m3u8?signed=yes"
}

List Broadcasts

Returns summary fields for all broadcasts on the current account. Please be aware that the results may be paginated.

GET /account/broadcasts
ParameterTypeDescriptionRemarks
qstring Search query.Optional.
pstring Page number.Optional.
lstring Page size limit.Optional.
stoken Sort order.Optional.

Valid filters:

  • filter.ids: List of Broadcast IDs
  • filter.stream_source: Stream Source (e.g. boxcaster, rtmp, app, etc.)
  • filter.stream_sources: List of Stream Sources (e.g. boxcaster, rtmp, app, etc.)
  • filter.private: Filter for private (true) or public (false) broadcasts.
  • filter.free_variant: Filter to find flex ticketed broadcasts (none, best, low)
  • filter.ticketed: Filter to find ticketed broadcasts
  • filter.has_recording: Filter to find only broadcasts with a valid recording. (true, false)

Valid queries:

  • id: Broadcast ID
  • name: Broadcast name
  • description: Broadcast description
  • name_or_description: Broadcast name or description
  • starts_at: Broadcast start time (can be a date range)
  • stops_at: Broadcast stop time (can be a date range)
  • sport: Broadcast sport (if a scoreboard overlay is configured)
  • timeframe: Broadcast timeframe

Valid sorts:

  • name: Broadcast name
  • starts_at: Broadcast start time
  • stops_at: Broadcast stop time

Example

GET /account/broadcasts

Response

200 OK
[
  {
    "id": "Z7a0XjcgnYpUIuKqvxGk",
    "name": "Celtics vs Knicks",
    "channel_id": "celtics-vs-knicks",
    "boxcaster_id": "n9c4ebf123456",
    "boxcaster_name": "Main Camera",
    "starts_at": "2013-04-28T23:00:00Z",
    "stops_at": "2013-04-29T02:00:00Z",
    "is_private": false,
    "is_ticketed": false,
    "ticket_price": 0,
    "free_variant": "best",
    "viewer_url": "https://www.boxcast.com/show/#/celtics-vs-knicks"
  }, {
    "id": "Y9udBwPJhqZvz05xt2As",
    "name": "Internal Test",
    "channel_id": "o2Vbj5UQdNt7aq3XSW4kgRuwfyBeiG9D",
    "boxcaster_id": "n9c4ebf123456",
    "boxcaster_name": "Main Camera",
    "starts_at": "2013-04-28T21:00:00Z",
    "stops_at": "2013-04-28T21:10:00Z",
    "is_private": true,
    "is_ticketed": false,
    "ticket_price": 0,
    "free_variant": "best",
    "viewer_url": "https://www.boxcast.com/show/#/o2Vbj5UQdNt7aq3XSW4kgRuwfyBeiG9D"
  }, {
    "id": "x1LUy0tRVj9mXuOEWP7k",
    "name": "Commencement 2013",
    "channel_id": "commencement-2013",
    "boxcaster_id": "n9c4ebf123456",
    "boxcaster_name": "Main Camera",
    "starts_at": "2013-05-02T14:00:00Z",
    "stops_at": "2013-05-02T22:00:00Z",
    "is_private": false,
    "is_ticketed": true,
    "ticket_price": 5.95,
    "free_variant": "low",
    "viewer_url": "https://www.boxcast.com/show/#/commencement-2013"
  }
]

Example with query

GET /account/broadcasts?q=name:*Celtics*

Response

200 OK
[
  {
    "id": "Z7a0XjcgnYpUIuKqvxGk",
    "name": "Celtics vs Knicks",
    "channel_id": "celtics-vs-knicks",
    "boxcaster_id": "n9c4ebf123456",
    "boxcaster_name": "Main Camera",
    "starts_at": "2013-04-28T23:00:00Z",
    "stops_at": "2013-04-29T02:00:00Z",
    "is_private": false,
    "is_ticketed": false,
    "ticket_price": 0,
    "free_variant": "best",
    "viewer_url": "https://www.boxcast.com/show/#/celtics-vs-knicks"
  }
]

Delete a Broadcast

Deletes a broadcast from the account.

DELETE /account/broadcasts/{id}

Example

DELETE /account/broadcasts/x1LUy0tRVj9mXuOEWP7k

Response

200 OK

Download a Broadcast

Downloading a broadcast as an MP4 is a multi-step process because BoxCast stores only streaming formats. The recording must first be converted to an MP4, then a URL for download is made available. The broadcast.recording_id field is available as part of the Get Broadcast Detail API call results when made with proper Authentication.

Step 1: Prepare the download

POST /account/recordings/{broadcast.recording_id}/download
ParameterTypeDescriptionRemarks
audio_onlyboolean Default is false (downloads as audio+video mp4, vs audio-only m4a).Optional.

Response

201 Created

Step 2: Poll to monitor the download status until a download_url (or audio_download_url, if audio_only was requested) is available.

GET /account/recordings/{broadcast.recording_id}

Response

200 OK
{
  "id": "recording_id",
  "audio_download_status": "",
  "audio_download_url": ""
  "download_status": "requested|failed|processing:50|ready",
  "download_url": "https://...."
}

Channels

A channel represents a collection of broadcasts that are related in some way. It is a way for broadcasters to group and organize their content. Channels also provide an additional monetization option by allowing broadcasters to charge for collections of content.

FieldTypeDescriptionRemarks
idslug The primary unique identifier. 
namestring The desired name for the channel.Optional.
descriptionstring The desired description for the channel.Optional.
is_ticketedboolean Whether or not the channel should be ticketed.Optional.
ticket_pricenumeric The desired ticket_price for the channel (ignored if not ticketed).Optional.
free_varianttoken+ The desired free_variant for the channel (ignored if not ticketed).Optional.
static_playlist_urlstring An M3U8 URL containing any currently-live, public broadcasts from this channel.
NOTE: This M3U8 URL will return a 404 if there is no currently-live, public content.
NOTE: This URL can be used for integration into certain third party app providers. It should never be distributed directly to viewers. Also be aware that the use of this URL for watching the broadcast will skew your analytics. If you would like to retain analytics, your app should be updated to use one of the supported BoxCast SDKs.
Read-only.

Create a Channel

Creates a new channel from the supplied fields.

POST /account/channels
ParameterTypeDescriptionRemarks
namestring The desired name for the channel.Required.
descriptiontext The desired description for the channel.Optional.
is_ticketedboolean Whether or not the channel should be ticketed.Optional.
ticket_pricenumeric The desired ticket_price for the channel (ignored if not ticketed).Optional.
free_varianttoken+ The desired free_variant for the channel (ignored if not ticketed).Optional.

Example

POST /account/channels
{
  "name": "Basketball Channel"
}

Response

200 OK
{
  "id": "Z7a0XjcgnYpUIuKqvxGk",
  "name": "Basketball Channel",
  "is_private": false,
  "is_ticketed": false,
  "ticket_price": 0,
  "free_variant": "best",
  "description": "",
  "static_playlist_url": ""https://play.boxcast.com/p/Z7a0XjcgnYpUIuKqvxGk/v/all-ext.m3u8?signed=yes"
}

Get Channel Detail

Returns all fields for the specified channel.

GET /account/channels/{id}

Example

GET /account/channels/Z7a0XjcgnYpUIuKqvxGk

Response

200 OK
{
  "id": "Z7a0XjcgnYpUIuKqvxGk",
  "name": "2016 Basketball Season",
  "channel_id": "2016-basketball-season",
  "is_ticketed": true,
  "ticket_price": 24.95,
  "free_variant": "",
  "static_playlist_url": ""https://play.boxcast.com/p/Z7a0XjcgnYpUIuKqvxGk/v/all-ext.m3u8?signed=yes"
}

Update a Channel

Updates the supplied fields of the specified channel.

PUT /account/channels/{id}
ParameterTypeDescriptionRemarks
namestring The desired name for the channel.Optional.
is_ticketedboolean Whether or not the channel should be ticketed.Optional.
ticket_pricenumeric The desired ticket_price for the channel (ignored if not ticketed).Optional.
free_varianttoken+ The desired free_variant for the channel (ignored if not ticketed).Optional.

Example

PUT /account/channels/Z7a0XjcgnYpUIuKqvxGk
{
  "name": "Basketball Channel"
}

Response

200 OK
{
  "id": "Z7a0XjcgnYpUIuKqvxGk",
  "name": "Basketball Channel",
  "channel_id": "2016-basketball-season",
  "is_ticketed": true,
  "ticket_price": 24.95,
  "free_variant": "",
  "static_playlist_url": ""https://play.boxcast.com/p/Z7a0XjcgnYpUIuKqvxGk/v/all-ext.m3u8?signed=yes"
}

List Channels

Returns summary fields for all channels on the current account.

GET /account/channels

Valid filters:

  • filter.ids: List of Channel IDs

Valid queries:

  • id: Channel ID
  • name: Channel name

Valid sorts:

  • name: Channel name

Example

GET /account/channels

Response

200 OK
[
  {
    "id": "Z7a0XjcgnYpUIuKqvxGk",
    "name": "Basketball Channel",
    "channel_id": "2016-basketball-season",
    "is_ticketed": true,
    "ticket_price": 24.95,
    "free_variant": ""
  }, {
    "id": "Z7a0XjcgnYpUIuKqvxGk",
    "name": "Football Channel",
    "channel_id": "2016-football-season",
    "is_ticketed": true,
    "ticket_price": 19.95,
    "free_variant": ""
  }, {
    "id": "Z7a0XjcgnYpUIuKqvxGk",
    "name": "Softball Channel",
    "channel_id": "2016-softball-season",
    "is_ticketed": false,
    "ticket_price": 0,
    "free_variant": ""
  }
]

Example with query

GET /account/channels?q=name:*Basketball*

Response

200 OK
[
  {
    "id": "Z7a0XjcgnYpUIuKqvxGk",
    "name": "Basketball Channel",
    "channel_id": "2016-basketball-season",
    "is_ticketed": true,
    "ticket_price": 24.95,
    "free_variant": ""
  }
]

List Channel Broadcasts

Returns minimal fields (id, name, starts_at, stops_at) for all broadcasts included in the specified channel. The list of broadcasts is presented in relevance order, meaning that broadcasts that are very recent (or coming very soon) will be listed ahead of older (or distant future) broadcasts. Any live broadcasts will be at the top of the list. Allows for the same search and pagination behavior as the top-level broadcast list query.

GET /account/channels/{id}/broadcasts

Example

GET /account/channels/dSUdyxXH1loPJYIlR4F0/broadcasts

Response

200 OK
[
  {
    "id": "Z7a0XjcgnYpUIuKqvxGk",
    "name": "Celtics vs Knicks",
    "starts_at": "2013-04-28T23:00:00Z",
    "stops_at": "2013-04-29T02:00:00Z"
  }, {
    "id": "Y9udBwPJhqZvz05xt2As",
    "name": "Internal Test",
    "starts_at": "2013-04-28T21:00:00Z",
    "stops_at": "2013-04-28T21:10:00Z"
  }, {
    "id": "x1LUy0tRVj9mXuOEWP7k",
    "name": "Commencement 2013",
    "starts_at": "2013-05-02T14:00:00Z",
    "stops_at": "2013-05-02T22:00:00Z"
  }
]

Highlights

A highlight represents a portion of a Broadcast that can be viewed independently. Each Broadcast can have multiple highlights.

FieldTypeDescription
idslug The primary unique identifier.
namestring A human-friendly name for quick identification and display in user interfaces.
broadcast_idslug The associated broadcast ID.
previewstring A URL to a thumbnail image for the highlight, if available.
posterstring A URL to a full-size poster image for the highlight, if available.
descriptiontext Additional information to display to viewers about the highlight.
durationnumeric The duration in seconds of the highlight.
the following fields are excluded from public summary responses
start_secondsnumeric Beginning of the highlight in seconds relative to the start of the broadcast's complete recording (unaffected by broadcast trimming).
stop_secondsnumeric End of the highlight in seconds relative to the start of the broadcast's complete recording (unaffected by broadcast trimming).

Create a Highlight

Creates a new highlight from the supplied fields.

POST /account/broadcasts/{broadcast_id}/highlights
ParameterTypeDescriptionRemarks
namestring The desired name for the highlight.Required.
descriptiontext The desired description for the highlight.Optional.
start_secondsnumeric The desired number of seconds relative to the start of the broadcast where the highlight begins.
stop_secondsnumeric The desired number of seconds relative to the start of the broadcast where the highlight ends.
NOTE: The specified stop_seconds is only precise to within a few seconds typically -- it will be aligned to the next keyframe after stop_seconds.

Example

POST /account/broadcasts/Z7a0XjcgnYpUIuKqvxGk/highlights
{
  "name": "Tip-off",
  "start_seconds": 120,
  "stop_seconds": 140
}

Response

200 OK
{
  "id": "h9a0Xacgn7pUIuKqvxHj",
  "name": "Tip-off",
  "broadcast_id": "Z7a0XjcgnYpUIuKqvxGk",
  "description": "",
  "start_seconds": 120,
  "stop_seconds": 140,
  "duration": 20,
  "preview": "https://recordings.boxcast.com/previews/foo/bar/i9a0Xacgn2pUIuKqvxHj.png",
  "poster": "https://recordings.boxcast.com/posters/foo/bar/k9a0Xacgn3pUIuKqvxHj.png"
}

Get Highlight Detail

Returns all fields for the specified highlight.

GET /account/broadcasts/{broadcast_id}/highlights/{id}

Example

GET /account/broadcasts/Z7a0XjcgnYpUIuKqvxGk/highlights/h9a0Xacgn7pUIuKqvxHj

Response

200 OK
{
  "id": "h9a0Xacgn7pUIuKqvxHj",
  "name": "Tip-off",
  "broadcast_id": "Z7a0XjcgnYpUIuKqvxGk",
  "description": "",
  "start_seconds": 120,
  "stop_seconds": 140,
  "duration": 20,
  "preview": "https://recordings.boxcast.com/previews/foo/bar/i9a0Xacgn2pUIuKqvxHj.png",
  "poster": "https://recordings.boxcast.com/posters/foo/bar/k9a0Xacgn3pUIuKqvxHj.png"
}

Update a Highlight

Updates the supplied fields of the specified highlight.

PUT /account/broadcasts/{broadcast_id}/highlights/{id}
ParameterTypeDescriptionRemarks
namestring The desired name for the highlight.Required.
descriptiontext The desired description for the highlight.Optional.
start_secondsnumeric The desired integer number of seconds relative to the start of the broadcast where the highlight begins.
stop_secondsnumeric The desired integer number of seconds relative to the start of the broadcast where the highlight ends.

Example

PUT /account/broadcasts/Z7a0XjcgnYpUIuKqvxGk/highlights/h9a0Xacgn7pUIuKqvxHj
{
  "name": "Tip-off Won By Knicks",
  "description": "Way to start the game!"
  "stop_seconds": 130
}

Response

200 OK
{
  "id": "h9a0Xacgn7pUIuKqvxHj",
  "name": "Tip-off Won By Knicks",
  "broadcast_id": "Z7a0XjcgnYpUIuKqvxGk",
  "description": "Way to start the game!",
  "start_seconds": 120,
  "stop_seconds": 130,
  "duration": 20,
  "preview": "https://recordings.boxcast.com/previews/foo/bar/i9a0Xacgn2pUIuKqvxHj.png",
  "poster": "https://recordings.boxcast.com/posters/foo/bar/k9a0Xacgn3pUIuKqvxHj.png"
}

List Highlights

Returns summary fields for all highlights for the given broadcast. Please be aware that the results may be paginated.

GET /account/broadcasts/{broadcast_id}/highlights
ParameterTypeDescriptionRemarks
qstring Search query.Optional.
pstring Page number.Optional.
lstring Page size limit.Optional.
stoken Sort order.Optional.

Valid queries:

  • name: Highlight name

Valid sorts:

  • streamed_at: The time the highlight occurred

Example

GET /account/broadcasts/Z7a0XjcgnYpUIuKqvxGk/highlights

Response

200 OK
[
  {
    "id": "h9a0Xacgn7pUIuKqvxHj",
    "name": "Tip-off Won By Knicks",
    "broadcast_id": "Z7a0XjcgnYpUIuKqvxGk",
    "description": "Way to start the game!",
    "duration": 20,
    "start_seconds": 120,
    "stop_seconds": 140,
    "preview": "https://recordings.boxcast.com/previews/foo/bar/i9a0Xacgn2pUIuKqvxHj.png",
    "poster": "https://recordings.boxcast.com/posters/foo/bar/k9a0Xacgn3pUIuKqvxHj.png"
  }
]

Delete a Highlight

Deletes a highlight from the broadcast.

DELETE /account/broadcasts/{broadcast_id}/highlights/{id}

Example

DELETE /account/broadcasts/Z7a0XjcgnYpUIuKqvxGk/highlights/h9a0Xacgn7pUIuKqvxHj

Response

200 OK

Download a Highlight

Downloading a highlight as an MP4 is a multi-step process because BoxCast stores only streaming formats. The highlight must first be converted to an MP4, then a URL for download is made available.

Step 1: Prepare the download

POST /account/highlights/{id}/download
Parameter Type Description Remarks
audio_only boolean Default is false (downloads as audio+video mp4, vs audio-only m4a). Optional.

Response

201 Created

Step 2: Poll to monitor the download status until a download_url (or audio_download_url, if audio_only was requested) is available.

GET /account/highlights/{id}

Response

200 OK
{
  "id": "highlight_id",
  "audio_download_status": "",
  "audio_download_url": ""
  "download_status": "requested|failed|processing:50|ready",
  "download_url": "https://...."
}

RTMP Sources

An RTMP source provides a means of feeding RTMP stream data into the BoxCast platform An RTMP source has a human-readable name (listed on the sources page and anywhere a source can be selected); it also has an ingestion URL and stream key that you will plug into your RTMP streaming encoder.

NOTE: your encoder can stream to your RTMP source at any time; however, your content will only stream to viewers when you have a live broadcast configured to use your RTMP source as a source.

FieldTypeDescriptionRemarks
idslug The primary unique identifier. 
namestring The desired name for the RTMP source. 
descriptionstring A user-provided description for the RTMP source. 
server_urlstring The server URL to plug into your RTMP streaming encoder.Read-only.
stream_keyslug The stream key to plug into your RTMP streaming encoder.Read-only.
static_playlist_urlstring An M3U8 URL containing any currently-live, public broadcasts from this RTMP source.
NOTE: This M3U8 URL will return a 404 if there is no currently-live, public content.
NOTE: This URL can be used for integration into certain third party app providers. It should never be distributed directly to viewers. Also be aware that the use of this URL for watching the broadcast will skew your analytics. If you would like to retain analytics, your app should be updated to use one of the supported BoxCast SDKs.
Read-only.

NOTE: different encoders accept URLs and stream keys in different ways; for example, your encoder may require you concatenate URL and stream key together (with a slash in between) as a single parameter. Check your encoder documentation and any available BoxCast help desk articles for more information.


Create an RTMP Source

Creates a new RTMP source from the supplied fields.

POST /account/static_rtmps
ParameterTypeDescriptionRemarks
namestring The desired name for the RTMP source.
descriptionstring The desired description for the RTMP source.

Example

POST /account/static_rtmps
{
  "name": "Wirecast",
  "description": "Production booth Wirecast computer"
}

Response

200 OK
{
  "id": "Q9b1VkadIxkdsI93nkdco",
  "name": "Wirecast",
  "description": "Production booth Wirecast computer",
  "server_url": "rtmps://rtmp.boxcast.com/live",
  "stream_key": "Qid9aksdhlk9eiSKNd",
  "static_playlist_url": ""https://play.boxcast.com/p/Q9b1VkadIxkdsI93nkdco/v/all-ext.m3u8?signed=yes"
}

Get RTMP Source

Returns all fields for the specified RTMP source.

GET /account/static_rtmps/{id}

Example

GET /account/static_rtmps/Q9b1VkadIxkdsI93nkdco

Response

200 OK
{
  "id": "Q9b1VkadIxkdsI93nkdco",
  "name": "Wirecast",
  "description": "Production booth Wirecast computer",
  "server_url": "rtmps://rtmp.boxcast.com/live",
  "stream_key": "Qid9aksdhlk9eiSKNd",
  "static_playlist_url": ""https://play.boxcast.com/p/Q9b1VkadIxkdsI93nkdco/v/all-ext.m3u8?signed=yes"
}

Update an RTMP Source

Updates the supplied fields of the specified RTMP source.

PUT /account/static_rtmps/{id}
ParameterTypeDescriptionRemarks
namestring The desired name for the RTMP source.Optional.
descriptionstring The desired description for the RTMP source.
regenerate_stream_keyboolean Set to true to generate a new stream key.Optional.

Example

PUT /account/static_rtmps/Q9b1VkadIxkdsI93nkdco
{ "name": "New Name" }

Response

200 OK
{
  "id": "Q9b1VkadIxkdsI93nkdco",
  "name": "New Name",
  "description": "Production booth Wirecast computer",
  "server_url": "rtmps://rtmp.boxcast.com/live",
  "stream_key": "Qid9aksdhlk9eiSKNd",
  "static_playlist_url": ""https://play.boxcast.com/p/Q9b1VkadIxkdsI93nkdco/v/all-ext.m3u8?signed=yes"
}

List RTMP Sources

Returns summary fields for all RTMP sources on the current account.

GET /account/static_rtmps

Valid filters:

  • filter.ids: List of RTMP Source IDs
  • filter.stream_key: RTMP Source Stream Key
  • filter.stream_keys: List of RTMP Source Stream Keys

Valid queries:

  • id: RTMP Source ID
  • name: RTMP Source name
  • description: RTMP Source description

Valid sorts:

  • id: RTMP Source ID
  • name: RTMP Source name
  • stream_key: RTMP Source stream_key

Example

GET /account/static_rtmps

Response

200 OK
[
  {
    "id": "Q9b1VkadIxkdsI93nkdco",
    "name": "Wirecast",
    "description": "Production booth Wirecast computer",
    "server_url": "rtmps://rtmp.boxcast.com/live",
    "stream_key": "Qid9aksdhlk9eiSKNd"
  }
]

Example with query

GET /account/static_rtmps?q=name:*Wirecast*

Response

200 OK
[
  {
    "id": "Q9b1VkadIxkdsI93nkdco",
    "name": "Wirecast",
    "description": "Production booth Wirecast computer",
    "server_url": "rtmps://rtmp.boxcast.com/live",
    "stream_key": "Qid9aksdhlk9eiSKNd"
  }
]

Delete an RTMP Source

Deletes an RTMP source from the account.

DELETE /account/static_rtmps/{id}

Example

DELETE /account/static_rtmps/Q9b1VkadIxkdsI93nkdco

Response

200 OK

Uploads

Uploads can be used to provide additional media for broadcasts.


Create an Upload

Creates a new upload from the supplied fields.

POST /account/uploads
ParameterTypeDescriptionRemarks
filenamestring The file name for the upload.Required.
filesizenumeric The size, in bytes, of the upload.Required.
mimetypetext The MIME type of the upload.Required.
slottoken The slot for the upload. Valid slots:
  • overlay: Upload can be used as an overlay during the broadcast.
Required.

Example

POST /account/uploads
{
  "filename": "overlay.png",
  "filesize": 123,
  "mimetype": "image/png",
  "slot": "overlay"
}

Response

201 Created
{
  "id": "e0lbabxqsqfetjjc5bfs",
  "signed_upload": {
      "url": "https://s3.amazonaws.com/uploads.boxcast.com",
      "params": {
          "key": "overlay.png",
          "Content-Type": "image/png",
          "policy": "policy",
          "x-amz-credential": "credential",
          "x-amz-algorithm": "AWS4-HMAC-SHA256",
          "x-amz-date": "20201218T000000Z",
          "x-amz-security-token": "token",
          "x-amz-signature": "signature"
      }
  }
}

Upload Media

Uploads the media for the specified upload. This is a multipart/form-data request.

Example

POST https://s3.amazonaws.com/uploads.boxcast.com Content-Type: multipart/form-data; boundary=----BOUNDARY
------BOUNDARY
Content-Disposition: form-data; name="key"

overlay.png
----BOUNDARY
Content-Disposition: form-data; name="Content-Type"

image/png
----BOUNDARY
Content-Disposition: form-data; name="policy"

policy
----BOUNDARY
Content-Disposition: form-data; name="x-amz-credential"

credential
----BOUNDARY
Content-Disposition: form-data; name="x-amz-algorithm"

AWS4-HMAC-SHA256
----BOUNDARY
Content-Disposition: form-data; name="x-amz-date"

20201218T000000Z
----BOUNDARY
Content-Disposition: form-data; name="x-amz-security-token"

token
----BOUNDARY
Content-Disposition: form-data; name="x-amz-signature"

signature
----BOUNDARY
Content-Disposition: form-data; name="file"; filename="overlay.png"
Content-Type: image/png


----BOUNDARY--

Response

204 No Content

Notify Uploaded

Once the media has been uploaded the upload status needs to be updated.

PUT /account/uploads/{id}
ParameterTypeDescriptionRemarks
statustoken The status for the upload.Required.

Example

PUT /account/uploads/e0lbabxqsqfetjjc5bfs
{
  "status": "uploaded"
}

Response

200 OK
{
  "id": "e0lbabxqsqfetjjc5bfs",
  "filename": "overlay.png",
  "filesize": 123,
  "mimetype": "image/png",
  "created_at": "2020-12-18T00:00:00Z",
  "description": "",
  "slot": "overlay",
  "view_url": "https://uploads.boxcast.com/overlay.png",
  "status": "uploaded"
}

Get Upload Details

Returns all fields for the specified upload.

GET /account/uploads/{id}

Example

GET /account/uploads/e0lbabxqsqfetjjc5bfs

Response

200 OK
{
  "id": "e0lbabxqsqfetjjc5bfs",
  "filename": "overlay.png",
  "filesize": 123,
  "mimetype": "image/png",
  "created_at": "2020-12-18T00:00:00Z",
  "description": "",
  "slot": "overlay",
  "view_url": "https://uploads.boxcast.com/overlay.png",
  "status": "uploaded"
}

List Uploads

Returns summary fields for all uploads on the current account.

GET /account/uploads

Valid filters:

  • filter.slot: Category of slot

Valid sorts:

  • created_at: Date upload was created at

Example

GET /account/uploads

Response

200 OK
[
  {
    "id": "e0lbabxqsqfetjjc5bfs",
    "filename": "overlay.png",
    "filesize": 123,
    "mimetype": "image/png",
    "created_at": "2020-12-18T00:00:00Z",
    "description": "",
    "slot": "overlay",
    "view_url": "https://uploads.boxcast.com/overlay.png",
    "status": "uploaded"
  }
]

Example with filter for just overlays

GET /account/uploads?filter.slot=overlay

Response

200 OK
[
  {
    "id": "e0lbabxqsqfetjjc5bfs",
    "filename": "overlay.png",
    "filesize": 123,
    "mimetype": "image/png",
    "created_at": "2020-12-18T00:00:00Z",
    "description": "",
    "slot": "overlay",
    "view_url": "https://uploads.boxcast.com/overlay.png",
    "status": "uploaded"
  }
]

Viewer Analytics

Viewer Analytics provide a detailed look at the viewers of a Broadcast or a Channel.


Get Broadcast Viewer Analytics

Gets the viewer analytics for a broadcast with the supplied date range.

GET /account/viewer_analytics/{broadcast_id}
ParameterTypeDescriptionRemarks
since date Start date for viewer analytics. Optional. If not provided, the default is shortly before the broadcast start time in the account's time zone.
until date Cutoff date for viewer analytics. Optional. If not provided, the default is now.
include_viewer_timeseries boolean true to include viewer time-series data in the response. Optional. Defaults to false.

Example

GET /account/viewer_analytics/gnz2vfaodkceal0sk3ot&since=2020-03-11T00:00:00-04:00&until=2020-04-11T00:00:00-04:00

Response

200 OK
{
    "live_view_count": 0,
    "live_view_seconds": 0,
    "live_buffer_seconds": 0,
    "recorded_view_count": 7,
    "recorded_view_seconds": 13,
    "recorded_buffer_seconds": 6,
    "unique_viewer_count": 2,
    "viewed_broadcast_count": 1,
    "daily_view_counts": [0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
    "weekday_hourly_view_counts": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    "view_counts_by_quality": {
        "240p": 1,
        "720p": 6
    },
    "view_counts_by_host": {
        "boxcast.tv": 6,
        "dashboard.boxcast.com": 1
    },
    "view_counts_by_geohash": {
        "dpmguzcp94h8": 7
    },
    "view_counts_by_region_code": {
          "OH-US": 7
    },
    "view_counts_by_browser": {
        "Safari 13.0.5": 6,
        "Safari 13.1": 1
    },
    "view_counts_by_os": {
        "OS X 10.15.3": 6,
        "OS X 10.15.4": 1
    },
    "view_durations_by_quality": {
        "240p": 27,
        "720p": 342
    },
    "most_popular_broadcasts": [
        {
            "broadcast_id": "gnz2vfaodkceal0sk3ot",
            "view_count": 7,
            "total_view_count": 7,
            "broadcast_name": "Rocket Launch",
            "broadcast_starts_at": "2019-05-13T16:00:00Z",
            "broadcast_stops_at": "2019-05-13T16:05:00Z"
        }
    ],
    "active_viewer_log": null
}

Get Channel Viewer Analytics

Gets the viewer analytics for a channel with the supplied date range.

GET /account/viewer_analytics/{channel_id}
ParameterTypeDescriptionRemarks
since date Start date for viewer analytics. Optional. If not provided, the default is 28 days (4 weeks) ago.
until date Cutoff date for viewer analytics. Optional. If not provided, the default is now.
include_viewer_timeseries boolean true to include viewer time-series data in the response. Optional. Defaults to false.

Example

GET /account/viewer_analytics/12345&since=2020-03-11T00:00:00-04:00&until=2020-04-11T00:00:00-04:00

Response

200 OK
{
    "live_view_count": 0,
    "live_view_seconds": 0,
    "live_buffer_seconds": 0,
    "recorded_view_count": 7,
    "recorded_view_seconds": 13,
    "recorded_buffer_seconds": 6,
    "unique_viewer_count": 2,
    "viewed_broadcast_count": 1,
    "daily_view_counts": [0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
    "weekday_hourly_view_counts": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    "view_counts_by_quality": {
        "240p": 1,
        "720p": 6
    },
    "view_counts_by_host": {
        "boxcast.tv": 6,
        "dashboard.boxcast.com": 1
    },
    "view_counts_by_geohash": {
        "dpmguzcp94h8": 7
    },
    "view_counts_by_region_code": {
          "OH-US": 7
        },
    "view_counts_by_browser": {
        "Safari 13.0.5": 6,
        "Safari 13.1": 1
    },
    "view_counts_by_os": {
        "OS X 10.15.3": 6,
        "OS X 10.15.4": 1
    },
    "view_durations_by_quality": {
        "240p": 27,
        "720p": 342
    },
    "most_popular_broadcasts": [
        {
            "broadcast_id": "gnz2vfaodkceal0sk3ot",
            "view_count": 7,
            "total_view_count": 7,
            "broadcast_name": "Rocket Launch",
            "broadcast_starts_at": "2019-05-13T16:00:00Z",
            "broadcast_stops_at": "2019-05-13T16:05:00Z"
        }
    ],
    "active_viewer_log": null
}

Code Samples

The following code samples are meant to help you get started using our API.

We use the following (non-functional) OAuth credentials: client ID cid1000 and secret secret9999. Once you have applied for and received your client ID and secret, replace the values with yours.


Use Client Credentials to Acquire Access Token

First, get your client ID and secret from the dashboard. Then use them as the user/password in the basic auth request to acquire a token.

$ export BOXCAST_CLIENT_ID=cid1000
$ export BOXCAST_SECRET=secret9999

$ curl -u "${BOXCAST_CLIENT_ID}:${BOXCAST_SECRET}" \
      -d "grant_type=client_credentials" \
      "https://auth.boxcast.com/oauth2/token"

{
"token_type":"bearer",
"access_token":"YKLCJ-EJHnFXV4TThF7YNPdkyz3ia29UmCJY3vZOB",
"expires_in":604800,
"scope":"owner"
}
import requests
response = requests.post('https://rest.boxcast.com/oauth2/token', data={
  'grant_type': 'client_credentials',
}, auth=('cid1000', 'secret9999'))
print response.json()

{
  u'token_type': u'bearer',
  u'access_token': u'YKLCJ-EJHnFXV4TThF7YNPdkyz3ia29UmCJY3vZOB',
  u'expires_in': 604800,
  u'refresh_token': u'kLHS6MTwTid9DxKK5r9ouzFEfT8PwQY1ZfONidd4',
  u'scope': u'owner'
}
var request = require('request');
request.post({
  url: 'https://rest.boxcast.com/oauth2/token',
  form: {
    grant_type: 'client_credentials',
  },
  auth: {
    user: 'cid1000',
    pass: 'secret9999'
  }
}, (err, response, body) => {
  if (!err && response.statusCode == 200) {
    console.log(JSON.parse(body));
  } else {
    console.error(err, JSON.parse(body));
  }
});

You now have an access token along with the number of seconds before it expires.


Exchange Authorization Code for Token

This is not needed for client credentials grants. It is only required if you have an authorized partner integration with BoxCast and are using the Authorization Code grant.

First, direct browser to https://auth.boxcast.com/oauth2/auth?response_type=code&client_id=cid1000&redirect_uri=https%3A%2F%2Fexample.org%2Fcb&scope=owner&state=8CMZoxf6. Then, after the user is sent back to your configured redirect URL, grab the code e.g. c123456789 from the URL.

$ export BOXCAST_CLIENT_ID=cid1000
$ export BOXCAST_SECRET=secret9999
$ export CODE_FROM_URL=c123456789
$ export REDIRECT_URI=https://example.org/cb

$ curl -u "${BOXCAST_CLIENT_ID}:${BOXCAST_SECRET}" \
      -d "grant_type=authorization_code" \
      -d "code=${CODE_FROM_URL}" \
      -d "redirect_uri=${REDIRECT_URI}" \
      "https://auth.boxcast.com/oauth2/token"

{
"token_type":"bearer",
"access_token":"YKLCJ-EJHnFXV4TThF7YNPdkyz3ia29UmCJY3vZOB",
"expires_in":604800,
"refresh_token":"kLHS6MTwTid9DxKK5r9ouzFEfT8PwQY1ZfONidd4",
"scope":"owner"
}
import requests
response = requests.post('https://rest.boxcast.com/oauth2/token', data={
  'grant_type': 'authorization_code',
  'code': 'c123456789',
  'redirect_uri': 'https://example.org/cb'
}, auth=('cid1000', 'secret9999'))
print response.json()

{
  u'token_type': u'bearer',
  u'access_token': u'YKLCJ-EJHnFXV4TThF7YNPdkyz3ia29UmCJY3vZOB',
  u'expires_in': 604800,
  u'refresh_token': u'kLHS6MTwTid9DxKK5r9ouzFEfT8PwQY1ZfONidd4',
  u'scope': u'owner'
}
var request = require('request');
request.post({
  url: 'https://rest.boxcast.com/oauth2/token',
  form: {
    grant_type: 'authorization_code',
    code: 'c123456789',
    redirect_uri: 'https://example.org/cb'
  },
  auth: {
    user: 'cid1000',
    pass: 'secret9999'
  }
}, (err, response, body) => {
  if (!err && response.statusCode == 200) {
    console.log(JSON.parse(body));
  } else {
    console.error(err, JSON.parse(body));
  }
});

You now have an access token along with the number of seconds before it expires.


Use Access Token To List 5 Broadcasts

Using the access token acquired above, you can query the rest of the BoxCast API on behalf of the authenticated user.

Here we search for broadcasts using the search filter timeframe:relevant and ask for the 1st page sorted from newest to oldest.

$ export ACCESS_TOKEN=YKLCJ-EJHnFXV4TThF7YNPdkyz3ia29UmCJY3vZOB

$ curl -H "Authorization: Bearer ${ACCESS_TOKEN}" \
       -G \
       --data-urlencode "q=timeframe:relevant" \
       --data-urlencode "s=-starts_at" \
       --data-urlencode "l=5" \
       "https://rest.boxcast.com/account/broadcasts"

[
    {
        "admin_token": "c376bof7sbkairssvnfh",
        "boxcaster_id": "",
        "boxcaster_name": "",
        "stream_source": "app",
        "channel_id": "hockey-game-vs-st-marks-166959",
        "description": "",
        "free_variant": "best",
        "id": "1",
        "is_private": false,
        "is_ticketed": false,
        "name": "Hockey Game vs St. Marks (Audio Only)",
        "preview": "https://assets.boxcast.com/latest/static/audio-only.png",
        "poster": "https://assets.boxcast.com/latest/static/audio-only.png",
        "starts_at": "2016-12-01T12:30:00Z",
        "stops_at": "2016-12-02T14:30:00Z",
        "tags": [],
        "ticket_price": 0,
        "total_active_viewer_count": 0,
        "total_minutes_viewed": 0,
        "total_view_count": 0,
        "transcoder_profile": "audio",
        "viewer_url": "https://boxcast.tv/view/hockey-game-vs-st-marks-166959"
    },
    ...
]
import requests
response = requests.get('https://rest.boxcast.com/account/broadcasts', params={
  'q': 'timeframe:relevant',
  's': '-starts_at',
  'l': '5'
}, headers={'Authorization': 'Bearer YKLCJ-EJHnFXV4TThF7YNPdkyz3ia29UmCJY3vZOB'}
print response.json()


[
    {
        u'admin_token': u'c376bof7sbkairssvnfh',
        u'boxcaster_id': u'',
        u'boxcaster_name': u'',
        u'stream_source': u'app',
        u'channel_id': u'hockey-game-vs-st-marks-166959',
        u'description': u'',
        u'free_variant': u'best',
        u'id': u'1',
        u'is_private': false,
        u'is_ticketed': false,
        u'name': u'Hockey Game vs St. Marks (Audio Only)',
        u'preview': u'https://assets.boxcast.com/latest/static/audio-only.png',
        u'poster': u'https://assets.boxcast.com/latest/static/audio-only.png',
        u'starts_at': u'2016-12-01T12:30:00Z',
        u'stops_at': u'2016-12-02T14:30:00Z',
        u'tags': [],
        u'ticket_price': 0,
        u'total_active_viewer_count': 0,
        u'total_minutes_viewed': 0,
        u'total_view_count': 0,
        u'transcoder_profile': u'audio',
        u'viewer_url': u'https://boxcast.tv/view/hockey-game-vs-st-marks-166959'
    },
    ...
]
var request = require('request');
request.get({
  url: 'https://rest.boxcast.com/account/broadcasts',
  qs: {
    q: 'timeframe:relevant',
    s: '-starts_at',
    l: '5'
  },
  auth: {
    bearer: 'YKLCJ-EJHnFXV4TThF7YNPdkyz3ia29UmCJY3vZOB'
  }
}, (err, response, body) => {
  if (!err && response.statusCode == 200) {
    console.log(JSON.parse(body));
  } else {
    console.error(err, JSON.parse(body));
  }
});