#Slatebox API

#Introduction

The Slatebox API is a server-side API available to Slatebox PRO teams. The API lets you interact with your organization's slates programmatically, as well as manage your organization and its members. With a single prompt, you can produce editable slates for your users, programmatically integrating Slatebox visualizations with your own ecosystem.

#Authentication

Once you sign up for the Slatebox Private Team beta, you will be provisioned API credentials. Use the API credentials with the below code samples to authenticate with the Slatebox API.

import "https://deno.land/std@0.184.0/dotenv/load.ts"; import { hmac } from "https://deno.land/x/hmac@v2.0.1/mod.ts"; import { crypto } from "https://deno.land/std@0.193.0/crypto/crypto.ts"; import { decode as base64Decode, encode as base64Encode, } from "https://deno.land/std@0.166.0/encoding/base64.ts"; import process from "https://deno.land/std@0.177.0/node/process.ts"; const publicKey = Deno.env.get("YOUR_PUBLIC_KEY"); const secretKey = Deno.env.get("YOUR_SECRET_KEY"); const baseUrl = "https://api.slatebox.com/v1; const timestamp = new Date().toISOString(); const token = hmac( "sha256", secretKey, `${publicKey}:${timestamp}`, "utf8", "base64" ); // Once you have the token above, ensure both the token and the timestamp are included as headers on the call // headers: { authorization: token, timestamp: timestamp, accept: "application/json", content-type: "application/json" }