LogoLogo
  • Rad TV Creator and Streaming Docs
  • Getting Started - Creators, Studios, Publishers
    • Create Your Rad TV Channel
    • Upload and Monetize Videos
    • Sell Individual Videos
    • Sell Subscription Video
    • Create Content Playlists
    • Create a FAST Channel
    • Publish RSS From Outside Server
    • Get Verified
    • Get Approved for Subscription Payments
    • Pricing Onchain Art
    • Maximize Your Earnings
    • VR and Portrait Content FAQ
  • Getting Started - Subscribers, Viewers
    • Premium and Free On-Demand Video, and Free TV
    • Rad TV for Web
    • Rad TV for PS5 / PS VR2
      • Sideloading
      • DLNA/UPnP
      • RSS Feeds
      • Video Encoding
      • File Naming Conventions
      • Controls for VR Version
      • Changelog for VR Version
    • Rad TV for PS4 / PS VR
      • Sideloading
    • Rad TV for iOS / Apple TV
    • Rad TV for Android / Android TV / Chromecast
    • Rad TV for Meta Quest
      • Sideloading
    • Local Media Servers and DLNA/UPnP
    • Adding External RSS Feeds to Your Library
  • Getting Started - Developer API
    • Authentication
    • GraphQL Basics
    • Managing Content
    • Managing Playlists
    • Managing Channels
  • Premium Subscriptions
    • Unlock Rad TV Premium with a Stream Pass NFT
  • Earn Free Premium Benefits via Referrals
  • Rad TV Partnerships for Businesses
  • Rad TV Blockchain Integrations
  • Rad TV Technical Support
Powered by GitBook
On this page
  • Getting Started with Authentication
  • Authentication Overview
  • Steps to Authenticate
  1. Getting Started - Developer API

Authentication

PreviousGetting Started - Developer APINextGraphQL Basics

Last updated 4 months ago

Check out our custom Rad TV Developer API . (free or premium OpenAI account required)

Getting Started with Authentication

The Rad TV Developer API uses API keys for authentication. These API keys are required for all requests to the API and ensure secure communication between your application and the Rad TV platform.

Authentication Overview

Each API request must include your API key in the Authorization header. The API key identifies and authenticates your application with the Rad TV backend.

Key Concepts

  • API Key: A unique string provided to you in your account settings.

  • Bearer Token Format: The API key is included in the Authorization header as a "Bearer" token.

Steps to Authenticate

1. Generate Your API Key

You can generate your API key by logging into your and navigating to the Developer API section. Keep your key secure and do not share it publicly.

2. Include Your API Key in Requests

To authenticate API requests, include your API key in the Authorization header using the Bearer scheme.

Example Request

const fetch = require('node-fetch'); // Ensure to install this in Node.js environments

const query = `
  query {
    me {
      id
      username
      email
    }
  }
`;

fetch("https://api.rad.live/graphql", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <your-api-key>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ query })
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
curl 'https://api.rad.live/graphql' -H 'Authorization: Bearer <your-api-key>' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'Origin: https://api.rad.live/graphql' --data-binary '{"query":"query {me {id username email}}","variables":{}}' --compressed

Example Response

{
  "data": {
    "me": {
      "id": "did:rad.live:user/1234-abcd",
      "username": "raduser",
      "email": "raduser@example.com"
    }
  }
}

3. Error Handling

Handle cases where the API key might be invalid or missing. Common error responses include:

Missing or Invalid API Key

If the Authorization header is missing or contains an invalid API key, the API will return:

{
  "errors": [
    {
      "message": "Unauthorized",
      "extensions": {
        "code": "UNAUTHENTICATED"
      }
    }
  ]
}

4. Best Practices

  • Keep Your API Key Secure: Never hardcode your API key into publicly accessible source code or expose it in logs.

  • Use HTTPS: Always use HTTPS to encrypt your requests and protect your API key.

By following these steps, you can successfully authenticate and start using the Rad TV API.

chatbot here
Rad TV Premium account