API docs
Authentication

Get started

Authentication

Authenticate Shiur Reader API requests with a bearer API Key: create, revoke and track keys.

Every request carries an API Key: a named, revocable secret that belongs to your Organization. The request acts for that Organization. It sees only that Organization's Builds and Readers, and its Builds count toward that Organization's Audio Hours.

Send the key#

Put the key in the Authorization header as a bearer token:

Header
Authorization: Bearer sr_...

curl

curl https://app.shiurreader.com/api/v1/builds/cd4e2fd751c84d659936cdf0e0002da0 \
  -H "Authorization: Bearer sr_..."

Python

import os
import requests

session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['SHIUR_READER_API_KEY']}"

JavaScript

const HEADERS = { Authorization: `Bearer ${process.env.SHIUR_READER_API_KEY}` };

A missing, unknown or revoked key gets 401 with the code invalid_api_key and a WWW-Authenticate: Bearer header:

401 Unauthorized
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API Key is missing, invalid or revoked. Send it as 'Authorization: Bearer <key>'."
  }
}

Create a key#

Only Owners manage API Keys (Editors cannot see them). Sign in, open API Keys, give the key a name of up to 100 characters (for example the site or system that will use it) and select Create key.

The key is shown once

Copy it right away. We keep only a hash of it, so nobody (not even we) can show it again. If it is lost, create a new key and revoke the old one.

Keys look like sr_ followed by 43 random characters. The list on the API Keys page shows each key's name, its first characters (sr_abc1234…), when it was created and when it was last used.

Give each site or system its own key. Then you can revoke one without stopping the others, and rate limits apply to each key separately.

Last used#

Every request with a valid key updates its Last used time (to the minute, in UTC), even if the request then fails. A key that says "Never used" has never sent a valid request. Use this to find keys that can be revoked.

Revoke a key#

Select Revoke next to the key on the API Keys page. It stops working at once: the next request with it gets 401 invalid_api_key. Builds already started with it carry on, and their webhooks are still sent. A revoked key cannot be turned back on.

Keep keys secret#

The webhook signing secret (whsec_...) is a different secret, also on the API Keys page. See Webhooks.