v1.0 — Public Beta

API Reference

The Diversity AI REST API gives your applications access to 7 specialised AI tools for inclusion, empathy, and bias awareness. All endpoints return JSON and require an x-api-key header.

Base URL (dev): http://localhost:3001 · https://api.diversity.network

Quick Start

JavaScript / TypeScript
// 1. Create account at /developer/register
// 2. Generate API key in your dashboard
// 3. Make your first call:

const res = await fetch('https://api.diversity.network/v1/ai/language', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'dk_live_your_key_here'
  },
  body: JSON.stringify({ text: 'He is a very manly leader.', tone: 'professional' })
});

const data = await res.json();
// data.suggestions      → array of inclusive alternatives
// data.revisedText      → full rewritten text
// data.inclusivityScore → 0-100
// data._meta.tokensUsed → Diversity tokens charged
1Create account2Generate API key3Call an endpoint

Authentication

All /v1/* endpoints require an API key in the format dk_live_xxxx generated in your dashboard.

Required header
// Required on every request:
fetch(url, {
  headers: {
    'x-api-key': 'dk_live_your_key_here'
  }
})
Security: API keys are hashed (SHA-256) on creation and never stored in plain text. Store your full key securely — it cannot be retrieved after creation.

Token System

Every API call deducts Diversity Tokens from your prepaid balance based on actual AI processing cost.

Exchange rate

1 : 1.5

Gemini → Diversity

Typical call

200–700

Diversity tokens

Top-up range

$5 – $89

for 5k – 150k tokens

Token response
// Every response includes token info:

// Body:
"_meta": { "tokensUsed": 312, "tokensRemaining": 13688, "plan": "GROWTH" }

// Headers:
X-Tokens-Used: 312
X-Tokens-Remaining: 13688
X-Plan: GROWTH

Authentication & Info

Plan A — Starter

Plan B — Growth

Plan C — Pro

Error Codes

200

OK

Request successful.

401

Unauthorized

Missing or invalid x-api-key header.

402

Payment Required

Insufficient Diversity Tokens. Top up your balance.

403

Forbidden

Your plan does not include this endpoint. Upgrade required.

429

Too Many Requests

Rate limit exceeded (60 req/min). Retry after a short delay.

500

Internal Server Error

AI processing failed. Error message is included in the body.

Error response
// Error response shape (4xx / 5xx):
{
  "error": "This tool requires the Growth plan or higher.",
  "code": "PLAN_UPGRADE_REQUIRED",
  "requiredPlan": "GROWTH",
  "currentPlan": "STARTER",
  "upgradeUrl": "https://yourdomain.com/developer/dashboard?tab=plan"
}

Rate Limits

All /v1/* endpoints are limited to 60 requests per minute per API key.

Starter

60 req/min · 2 API keys

Growth

60 req/min · 5 API keys

Pro

60 req/min · 10 API keys

Ready to integrate?

Create your developer account and get API keys in 60 seconds.

Get API KeyDashboard