Skip to content

anmoldhingra1/rerato-api-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rerato API Examples

Safe public examples for integrating with the Rerato API.

Rerato turns documents, URLs, transcripts, or topics into voiced AI-hosted experiences: quizzes, lessons, training modules, presentations, podcasts, onboarding flows, and branded activations.

This repo is intentionally not production Rerato code. It contains integration patterns only: API request shape, idempotency, webhook verification, and a minimal Node example.

What This Shows

  • Create source, host, experience, session, and webhook resources
  • Use Authorization: Bearer $RERATO_API_KEY
  • Send Idempotency-Key headers for retry-safe writes
  • Verify HMAC-SHA256 webhook signatures
  • Keep API keys on the server, never in browser code

Prerequisites

  • Node.js 20+
  • A Rerato API key from the Rerato console
  • A backend environment where secrets are safe
export RERATO_API_KEY="rto_test_..."
export RERATO_API_BASE_URL="https://api.rerato.ai/v1"

Quick Start

git clone https://github.com/anmoldhingra1/rerato-api-examples.git
cd rerato-api-examples
npm install
npm run create-experience

cURL Example

RERATO_API_BASE_URL="${RERATO_API_BASE_URL:-https://api.rerato.ai/v1}"

curl -s -X POST "$RERATO_API_BASE_URL/sources" \
  -H "Authorization: Bearer $RERATO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: source-demo-$(date +%s)" \
  -d '{
    "type": "topic",
    "title": "Apollo 11",
    "content": "Create a short, accurate quiz about Apollo 11 for a general audience."
  }'

Node Example

See examples/node-create-experience.mjs.

The example uses a small helper:

async function rerato(path, options = {}) {
  const baseUrl = process.env.RERATO_API_BASE_URL || "https://api.rerato.ai/v1";
  const apiKey = process.env.RERATO_API_KEY;

  if (!apiKey) {
    throw new Error("Missing RERATO_API_KEY");
  }

  const response = await fetch(`${baseUrl}${path}`, {
    ...options,
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
      ...options.headers,
    },
  });

  if (!response.ok) {
    throw new Error(`${response.status} ${await response.text()}`);
  }

  return response.json();
}

Webhook Verification

Rerato webhooks are signed with HMAC-SHA256. Verify the raw request body before parsing JSON.

See examples/verify-webhook.mjs.

Security Notes

  • Never expose RERATO_API_KEY in browser JavaScript.
  • Store webhook signing secrets in your server environment or secret manager.
  • Use idempotency keys for retries after network failures.
  • Log API key prefixes, not full keys.
  • Treat generated experience content as user-visible output and review before publishing in high-stakes workflows.

About Rerato

Rerato is the voice-AI orchestration layer behind Trivana.ai, a public alpha for AI-hosted gameshows and voiced interactive experiences.

Voice is not the moat. Orchestration is.

About

Safe public examples for integrating with the Rerato API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors