Skip to content
Last updated

Authentication and Brand Access

Authentication

RubyPlay Public API uses HTTP Basic Authentication. Every request must include an Authorization header with Base64-encoded credentials:

Authorization: Basic <base64(username:password)>

Credentials are issued by RubyPlay during integration.

User Types

Every set of credentials has a user type. It determines how many brands you can act on, which endpoint path you use, and which endpoints are available to you. Your type is returned by the /api/v1/self endpoint.

TypeDescription
INDIVIDUALA single brand of an operator. This is the original integration setup and the type most current integrations use.
PARTNERAn operator or aggregator acting on several brands with one set of credentials.
THIRD_PARTYAn external supplier acting on the data of the brands it has been granted.

Endpoint Paths

Most endpoints are available via two paths:

PathBrand
/api/v1/{endpoint}Implicit (Without brandId). The brand is resolved from your credentials.
/api/v1/brands/{brandId}/{endpoint}Explicit (With brandId). The brand is specified in the path.

Which path you use depends on your user type:

TypeBrandsPath
INDIVIDUALExactly oneBoth paths. The brand is resolved from your credentials when you omit brandId.
PARTNEROne or moreExplicit only. A request without brandId is rejected with 400 BRAND_REQUIRED.
THIRD_PARTYOne or moreExplicit only. A request without brandId is rejected with 400 BRAND_REQUIRED.

A request for a brand your account does not cover is rejected with 403 BRAND_NOT_ALLOWED.

On each endpoint page, the Without brandId and With brandId tabs show the request for both paths.

Checking Your Account Details

To find out your user type and which brands your account covers, call the /api/v1/self endpoint. It returns your principalType and the brands your credentials are allowed to operate on, together with the brandId values to use in the explicit-brand path.

This endpoint describes the account you authenticate with, so it takes no brandId of its own and is available to every account.

API Call Sample:

curl -i -X GET \
  -u '<username>:<password>' \
  https://asia.stage.rubyplay.io/api/v1/self
Response
{ "allowedBrands": [ { "id": 1, "name": "Brand" } ], "principalType": "INDIVIDUAL" }

Response Schema:

allowedBrandsArray of objects(BrandDto)
principalTypestring

Type of principal the account belongs to.

Enum:"INTERNAL""THIRD_PARTY""INDIVIDUAL"
Example:"INDIVIDUAL"

Use principalType to determine which endpoint path applies to your account, and the id of the brand you are acting on as the brandId in the explicit-brand path.