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.
Quick Start
// 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 chargedAuthentication
All /v1/* endpoints require an API key in the format dk_live_xxxx generated in your dashboard.
// Required on every request:
fetch(url, {
headers: {
'x-api-key': 'dk_live_your_key_here'
}
})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
// Every response includes token info:
// Body:
"_meta": { "tokensUsed": 312, "tokensRemaining": 13688, "plan": "GROWTH" }
// Headers:
X-Tokens-Used: 312
X-Tokens-Remaining: 13688
X-Plan: GROWTHAuthentication & Info
Plan A — Starter
Plan B — Growth
Plan C — Pro
Error Codes
OK
Request successful.
Unauthorized
Missing or invalid x-api-key header.
Payment Required
Insufficient Diversity Tokens. Top up your balance.
Forbidden
Your plan does not include this endpoint. Upgrade required.
Too Many Requests
Rate limit exceeded (60 req/min). Retry after a short delay.
Internal Server Error
AI processing failed. Error message is included in the body.
// 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.