Skip to main content
This guide walks through the smallest useful integration:
  1. Create a developer app and get your credentials
  2. Choose the right auth flow for your app
  3. Get an access token
  4. Send your first playback event
  5. Read now-playing state
  6. Refresh the access token when needed

Before you begin

You need:
  • A PunchPlay account
  • A developer app from Get API key
  • Your app’s client_id
  • Your app’s client_secret if you created a confidential client

1. Create a developer app

Sign in to Get API key, then create either:
  • A confidential client for server-backed apps that can safely store a secret
  • A public client for native or browser-based apps that must not embed a secret
Also:
  • register your redirect URIs if you plan to use OAuth
  • choose the minimum allowed_scopes your app should ever request
  • save the secret immediately if you created a confidential client

2. Choose your auth flow

Use:
  • authorization code + PKCE for browser, website, and native apps that can receive a callback
  • device code for TV, desktop, CLI, and clients without a convenient browser callback

3A. Apps with callbacks: authorization code + PKCE

Redirect the user to:
After PunchPlay redirects back with code, exchange it for tokens:

3B. Apps without callbacks: device code

Request a device code:
Public clients send client_id only. Confidential clients send both client_id and client_secret. The example requests only playback scopes. A full native client normally requests the scope set documented in the Native App API. Example response:
Display the user_code or open verification_uri_complete for the user, then poll:
While approval is pending, the API returns:
Once approved, both auth flows produce bearer credentials shaped like this:

4. Send your first playback event

Expected response:

5. Read now-playing state

Example response:

6. Refresh the access token when needed

Web and browser apps can refresh through the OAuth token endpoint:
Successful refresh returns a rotated refresh token. Replace the old one immediately.
Device-code clients can refresh here:
Successful refresh returns a rotated refresh token. Replace the old one immediately.

Common errors

  • authorization_pending: the user has not approved the device code yet
  • invalid_scope: the request asked for a scope outside the app policy
  • invalid_client: the provided app credentials are wrong
  • insufficient_scope: the token cannot access the endpoint you called
  • 429: you are polling or sending events too aggressively
Platform failures include request_id in the body and X-PunchPlay-Request-Id in the headers. Log that value so you can send it to support.

Next steps

  • Read Authentication for both auth flows, token lifecycle, and security guidance.
  • Read Native App API for title, history, ratings, lists, collection, calendar, and Continue Watching endpoints.
  • Read Playback API for payload design, event ordering, and multi-episode behavior.
  • Read Live Events to subscribe to playback changes in real time.