Quickstart
In this tutorial you sign in, get an access token and call the API with it. It takes about five minutes.
What you need¶
- A PlayTelly user name and password, and your organization's company code (web sign-in only). Ask your PlayTelly contact if you don't have them.
curl.
Base URLs¶
The examples use <AUTH_HOST> (sign-in) and <API_HOST> (everything else). Replace them with the hosts for your
environment from API conventions.
1. Get an access token¶
Send your credentials to AuthAPI. The PlayTelly-Platform: mobile header makes
it return the tokens in the response body, which is what scripts and server
integrations need. (Without it, the tokens arrive as browser cookies.)
curl -s -X POST "https://<AUTH_HOST>/api/v1/login" \
-H "Content-Type: application/json" \
-H "PlayTelly-Platform: mobile" \
-d '{"username": "<USERNAME>", "password": "<PASSWORD>"}'
You get a 200 response like this:
{
"access_token": "<ACCESS_TOKEN>",
"refresh_token": "<REFRESH_TOKEN>",
"expires_in": 900,
"token_type": "Bearer",
"user": { "id": "<uuid>", "username": "<USERNAME>", "email": "<EMAIL>", "org_id": "<uuid>", "password_change_required": false },
"org": { "org_id": "<uuid>", "org_slug": "<slug>", "role": "ORG_MEMBER" }
}
Keep the access_token. It expires after expires_in seconds (900 by default,
15 minutes). See Authentication for refreshing it.
Company code
The company_code field is only required for web sign-in. The mobile
sign-in above uses the organization already bound to your account.
2. Make your first call¶
Send the token in the Authorization header. This call asks who you are signed in as:
A 200 response means your token works. A 401 means the token is missing,
expired or invalid. Refresh it once (see Authentication) and retry; if it
fails again, sign in again.
The response describes you and your organization. This is an example of its fields, not a captured response:
{
"user_id": "<uuid>",
"email": "<EMAIL>",
"username": "<USERNAME>",
"first_name": "<FIRST_NAME>",
"last_name": "<LAST_NAME>",
"platform_role": null,
"platform_permissions": null,
"org": {
"org_id": "<uuid>",
"org_name": "<ORG_NAME>",
"org_slug": "<slug>",
"org_role": "<role>",
"org_permissions": ["<permission>"],
"workspaces": [
{
"workspace_id": "<uuid>",
"workspace_name": "<WORKSPACE_NAME>",
"app_ids": ["<app>"],
"role": "<role>",
"permissions": ["<permission>"]
}
],
"default_app": ""
},
"onboarded": true
}
3. Find your workspace ID and call a domain endpoint¶
Most routes include the workspace or organization they act on, for example
/api/v1/playback/{workspaceId}/channels.
- Your workspace ID is
org.workspaces[].workspace_idin the response above. - Your organization ID is
org.org_id. permissionson each workspace lists what your role may do there. A route that needs a permission you don't have returns403.
Then call a route with that ID, for example the channels in your workspace:
curl -s "https://<API_HOST>/api/v1/playback/<WORKSPACE_ID>/channels" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
Not verified
The response bodies of domain routes differ by domain today; see API conventions. For an example of a list response, see Playback API: Lists.
Next steps¶
- Authentication: tokens, refresh and errors
- API conventions: URLs, errors and permissions
- API reference: every domain