Introduction
Welcome to the RapidStream API
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "https://api.rapidstream.video" \
-H 'Authorization: Bearer ACCESSTOKEN' \
Make sure to replace
ACCESSTOKEN
with your API key.
In order to use the RapidStream API, you must authenticate yourself with an API key.
You can create a new API key at our customer panel. Make sure to save the key somewhere safe, as you won't be able to see it again.
Never share or commit your API key to a public repository. If you think your API key has been compromised, you can regenerate it at any time.
Authorization: Bearer ACCESSTOKEN
Ingest
Ingest EPG Catalog
curl -X "POST" "https://api.rapidstream.video/epg-ingest/catalog" \
-H 'idempotency-key: YOUR-CUSTOM-UUID' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESSTOKEN' \
The request body:
[
{
"id": "string",
"title": "string",
"episode": "string | undefined",
"season": "string | undefined",
"series": "string | undefined",
"productionYear": "string | undefined",
"duration": "string | undefined",
"parentalRatings": "string | undefined",
"ratings": "string | undefined",
"language": "string | undefined",
"keywords": "string | undefined",
"genres": "string | undefined",
"iabCategories": "string | undefined",
"channelName": "string | undefined",
"description": "string | undefined"
}
]
This endpoint ingests a catalog of content.
HTTP Request
POST https://api.rapidstream.video/epg-ingest/catalog
Returns
204 - No Content
Query Headers
Parameter | Default | Description |
---|---|---|
idempotency-key | - | A unique uuid to ensure idempotency of the request |
Content-Type | 'application/json' | |
Authorization | Bearer ACCESSTOKEN | Replace with your access token |
JSON Body
Parameter | Mandatory | Description |
---|---|---|
id | x | A unique id for the content |
title | x | Content title |
episode | Content episode | |
season | Content season | |
series | Content series | |
productionYear | Content production year | |
duration | Content duration | |
parentalRatings | Content parental ratings | |
ratings | Content ratings | |
language | Content language | |
keywords | Content keywords | |
genres | Content genres | |
iabCategories | Content iab categories | |
channelName | Content channel name | |
description | Content description |
VAST
In general there are two ways to request a VAST document. You call the synchronous or asynchronous endpoints.
- The synchronous endpoint will return a VAST document as response.
- The asynchronous endpoints will run the job in the background and call the webhook url you provide.
Input parameters
Mandatory URL parameters
However you call the API, you need to provide the following information:
Parameter | Description |
---|---|
adBreakDuration | The duration of the ad break in seconds. |
Well-known URL parameters
Next to this you may provide the following information:
Parameter | Description |
---|---|
userId | The user id of the viewer to retrieve personalized information from DMP or apply frequency capping. |
epgId | The epg id of the content the viewer is currently watching to resolve information from the epg catalog like title, genre, etc. See ingest fo EPG catalog. |
tcf | The TCF string forwarded from the player containing the viewer's consent information - see IAB Transparency & Consent Framework. |
country | The country code of the viewer as ISO 3166-1 alpha-2 code. |
vendor | The vendor id or name of the stream - useful criterion in AdRule defintions. |
deviceId | The device id of the player. |
usPrivacy | The US privacy string forwarded from the player containing the viewer's consent information regarding CPPA. |
ifa | The identifier for advertising from IAB Tech lab. |
ifaType | The type of the identifier for advertising from IAB Tech lab. |
lmt | The limit ad tracking flag from IAB Tech lab. |
All additional key-value pairs are valid and can be put into the url, once. Multiple values for the same key are not supported. Only the latest value is used.
Request VAST synchronously
Get a VAST document synchronously
curl -X "GET" "https://api.rapidstream.video/vast/sync" \
-H 'idempotency-key: YOUR-CUSTOM-UUID' \
-H 'Authorization: Bearer ACCESSTOKEN' \
-H 'User-Agent: VIEWER_USER_AGENT' \
-H 'X-Forwarded-For: VIEWER_IP_ADDRESS'
The response will look like this:
<VAST version="4.0">
<Ad id="-m7LC9Ze" sequence="1">
<InLine>
...
</InLine>
</Ad>
</VAST>
GET https://api.rapidstream.video/vast/sync
Returns
200 - OK
Query Headers
Parameter | Default | Description |
---|---|---|
Authorization | Bearer ACCESSTOKEN | Replace with your access token |
idempotency-key | - | A unique uuid to ensure idempotency of the request |
User-Agent | - | The user agent of the viewer |
X-Forwarded-For | - | The ip address of the viewer |
URL Parameters
Please see VAST / Input parameters for more information.
Request VAST asynchronously
Request a VAST document asynchronously and receive a VAST document by webhook.
curl -X "POST" "https://api.rapidstream.video/vast/async/webhook/in-body" \
-H 'idempotency-key: YOUR-CUSTOM-UUID' \
-H 'Authorization: Bearer ACCESSTOKEN' \
-H 'User-Agent: VIEWER_USER_AGENT' \
-H 'X-Forwarded-For: VIEWER_IP_ADDRESS'
The request body should look like this:
{
"url": "WEBHOOK_URL",
"secret": "WEBHOOK_SECRET"
}
The webhook call you will receive with the VAST document on success.
{
"status": "success",
"vastId": "0f6bbdbce0fedf518b8792dd50d50ee5",
"vast": "<VAST version=\"4.0\">...</VAST>"
}
The webhook call you will receive with the VAST document on failure.
{
"status": "failure",
"vastId": "0f6bbdbce0fedf518b8792dd50d50ee5",
"message": "error description"
}
GET https://api.rapidstream.video/vast/async/webhook/in-body
Returns
204 - No content
Query Headers
Parameter | Default | Description |
---|---|---|
Authorization | Bearer ACCESSTOKEN | Replace with your access token |
idempotency-key | - | A unique uuid to ensure idempotency of the request |
User-Agent | - | The user agent of the viewer |
X-Forwarded-For | - | The ip address of the viewer |
JSON Body
Parameter | Description |
---|---|
webhook_url | The url we are supposed to send the webhook request to |
webhook_secret | The secret we are supposed to send with the webhook request to validate the request |
URL Parameters
Please see VAST / Input parameters for more information.
Errors
The RapidStream API uses the following error codes:
The error response body will look like this:
{
"status": "number", // HTTP status code
"title": "string",
"type": "string",
"detail": "string",
"key": "values" // Additional information about the error,
// e.g. list of invalid fields
}
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid - please provide valid JSON. |
401 | Unauthorized -- Your ACCESS_TOKEN key is wrong. |
402 | Payment Required -- You tried to access a paid resource without paying for it. Please add a valid payment method to your account in the customer panel. |
404 | Not Found -- The specified route could not be found. |
405 | Method Not Allowed -- You tried to access a route with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
409 | Conflict -- Some business rule cannot be applied - action declined. |
422 | Unprocessable Entity -- Your request is valid JSON, but some parameters are invalid. See response body for details. |
429 | Too Many Requests -- You're requesting the API too much! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |