Getting started

Platform API is designed for Server-to-Server integrations. It uses a jwt for authentication and provides functionality such as:

  • Finding and editing users
  • Listing and editing viewables
  • Initiating transcoding
  • and much more...

Making Your First API Call to the Magine Pro Platform

Follow the steps below to successfully authenticate and make your first API call against the Magine Pro Platform.


1. Generate a Key Pair

Generate an RSA key pair using the following commands (requires openssl and ssh-keygen):

# Generate a 4096-bit RSA private key (no passphrase)
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS512.key

# Extract the public key in PEM format
openssl rsa -in jwtRS512.key -pubout -outform PEM -out jwtRS512.key.pub
  • 🔐 Store jwtRS512.key securely (e.g., in a key management system).
  • 🚫 Do not share the private key.
  • 📤 Share only the public key (jwtRS512.key.pub) with your contact at Magine Pro.

2. Receive Required Credentials from Magine Pro

After sharing your public key, Magine Pro will provide the following:

  • Issuer
    Used in the JWT iss field to validate ownership.

  • Access Token
    Used in the Magine-AccessToken header for all API requests. It ensures your requests are routed to the correct partner universe.


3. Generate a JWT

Although the following example uses Node.js, you may use any language that supports JWT.

Initialize a Node.js Project

npm init

Follow the prompts in your terminal.

Install Dependencies

npm install --save jsonwebtoken

Create index.js with the Following Code

⚠️ Remember to replace the iss, with the Issuer you received by your Magine Pro contact

const jwt = require('jsonwebtoken');
const fs = require('fs');

const privateKey = fs.readFileSync('jwtRS512.key');

const token = jwt.sign({
  iss: 'PROVIDED_BY_MAGINE_PRO_IN_STEP_2',
  iat: Math.floor(Date.now() / 1000) - (60 * 60), // issued 1 hour ago
  exp: Math.floor(Date.now() / 1000) + (60 * 60 * 24) // expires in 24 hours
}, privateKey, { algorithm: 'RS512' });

console.log(token);

Run the Script

node index.js

This will output a valid JWT in your terminal.


4. Test the API

Use the generated JWT together with the Access Token to test any of the API endpoints 🎉

⚠️ When adding the JWT to test the endpoints, make sure that it's in the form ofBearer {jwt}