Skip to main content

Getting Started

Welcome to the Stingray API! This guide is designed to help you begin using our API services quickly and efficiently.

Requesting your API credentials​

Before you can start making API calls, you'll need to obtain your unique API credentials. These credentials are essential for authenticating with our API and ensuring secure communication between your application and our services. If you've already received your credentials from Stingray, you're all set to move on to the next step. However, if you haven't received them or are unsure about your credentials, please follow these instructions:

  1. Contact Stingray Support: Reach out to our support team here. Please provide your company and contact information, along with a brief description of how you plan to use the API.
  2. Wait for a Response: Our support team will review your request and provide you with a set of credentials, consisting of a client ID and a client secret.

Obtaining a JWT​

Once you have your credentials, the next step is to authenticate with our authentication server. This process will grant you a JSON Web Token (JWT), which is required for making API calls.

To obtain a JWT, make a POST request to https://login.stingray.com/loginapi/oauth/deviceLogin using your client ID and client secret.

Steps:

  1. Encode your client ID and client secret in Base64 format. The structure should appear as client_id:client_secret.

  2. Send a POST request to https://login.stingray.com/loginapi/oauth/deviceLogin with the necessary headers and parameters.

Headers

Content-Type: application/x-www-form-urlencoded
Authorization: Basic {encoded_credentials}

Parameters

(required) deviceId: Identifier of the device accessing the API
(optional) partnerId: Partner id for tracking purposes

Sample Request:

curl -X POST https://login.stingray.com/loginapi/oauth/deviceLogin \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic {encoded_credentials}' \
--data-urlencode 'deviceId=myDevice'

In this sample request, replace {encoded_credentials} with the Base64 encoded string of your client ID and client secret.

Response

The response will include a JWT which you will use in the next step to authenticate with the Music API. The response structure should appear as:

{
"access_token": "your_jwt_token",
"expires_in": 86400,
"token_type": "Bearer"
}

Using the Music API​

With your JWT in hand, you're ready to start calling the Music API at https://music-service.stingray.com/api/v2. Remember to include the JWT in the Authorization header of your HTTP requests.

Headers

Content-Type: application/json
Authorization: Bearer {jwt_token}

Sample Request

curl -X GET https://music-service.stingray.com/api/v2/{your_endpoint} \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {jwt_token}'

For this sample request, replace {jwt_token} with the JWT obtained in the previous step and {your_endpoint} with the required endpoint.

For additional information regarding available endpoints and their specific uses, please refer to the API section of this documentation or the official swagger.