API Reference

CautionLabs API

Send text, get instant moderation scores across twelve harm categories. One endpoint, simple JSON, production-ready.

RESTJSONHTTPShttps://api.cautionlabs.com/v1

Introduction

The CautionLabs API analyzes user-generated text and returns confidence scores from 0 (safe) to 1 (high confidence of violation) for each moderation category. Use it to filter chat, comments, reviews, UGC, and any text-heavy product surface.

All requests are made over HTTPS. Responses are JSON. There is a single primary endpoint — no versioning sprawl, no graph of micro-endpoints to learn.

Base URL: https://api.cautionlabs.com/v1
Need an API key? from the dashboard.

Quickstart

Make your first moderation request in under a minute.

  1. Create a free account and copy your API key from the API Keys page.
  2. Replace YOUR_API_KEY in the examples below.
  3. Send a POST request to /moderate with a JSON body containing text.
curl -X POST https://api.cautionlabs.com/v1/moderate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, world!"}'

Authentication

Authenticate every request with your API key in the Authorization header using the Bearer scheme:

JSON
Authorization: Bearer YOUR_API_KEY

Keep your key secure

  • Never expose API keys in client-side code or public repositories.
  • Call the API from your backend or a trusted proxy.
  • Rotate compromised keys immediately via Roll API Key in the dashboard.

Moderate text

Analyze a string of text and receive scores for all twelve moderation categories.

POST/moderate

Request body

FieldTypeRequiredDescription
textstringYesThe text content to analyze. UTF-8 encoded.

Example request

curl -X POST https://api.cautionlabs.com/v1/moderate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your content to analyze"}'

Example response

Returns 200 OK with a JSON object. Each key is a category field with a float score between 0 and 1.

{
  toxic: 0.02,
  profanity: 0.05,
  hate: 0.01,
  harassment: 0.03,
  self_harm: 0.0,
  adult: 0.0,
  violence: 0.01,
  drugs: 0.0,
  weapons: 0.0,
  pii: 0.0,
  spam: 0.12,
  minor: 0.0,
}

Headers

HeaderRequiredDescription
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json

Response fields

Every successful response includes all twelve category scores. Set your own thresholds per category based on your product's risk tolerance.

FieldCategoryDescription
toxicToxicityGeneral toxicity score from 0 (safe) to 1 (highly toxic)
profanityProfanityProfanity confidence score from 0 (clean) to 1 (highly explicit)
hateHate SpeechHate speech score from 0 (no hate) to 1 (strong hate)
harassmentHarassmentHarassment score from 0 (safe) to 1 (severe harassment)
self_harmSelf-HarmSelf-harm content score from 0 (safe) to 1 (high risk)
adultAdult ContentAdult content score from 0 (safe) to 1 (highly explicit)
violenceViolenceViolence score from 0 (non-violent) to 1 (graphic/threatening)
drugsDrug ContentDrug content score from 0 (safe) to 1 (drug-related)
weaponsWeaponsWeapons content score from 0 (safe) to 1 (weapons-related)
piiPII DetectionPII presence score from 0 (clean) to 1 (contains PII)
spamSpamSpam confidence score from 0 (genuine) to 1 (definite spam)
minorMinor SafetyMinor safety risk score from 0 (safe) to 1 (critical risk)
Tip: Scores are continuous, not binary. A score of 0.85 on toxic means high confidence of toxic content; 0.12 is likely safe. Tune cutoffs per surface (e.g. stricter in DMs than in public posts).

Errors

Errors use standard HTTP status codes. The response body includes an error object with code and message fields.

{
  error: {
    code: 'insufficient_credits',
    message: 'Your account has no remaining credits.',
  },
}
StatusCodeDescription
400invalid_requestMissing or malformed request body (e.g. empty `text`).
401unauthorizedMissing, invalid, or revoked API key.
402insufficient_creditsAccount has no remaining credits for moderation requests.
429rate_limit_exceededToo many requests. Retry after the time indicated in headers.
500internal_errorUnexpected server error. Retry with exponential backoff.

Rate limits

Requests are rate-limited per API key to ensure fair usage and platform stability. When you exceed the limit, the API returns 429 Too Many Requests.

  • Check the Retry-After response header for when to retry.
  • Implement exponential backoff in your client for transient errors.
  • High-volume needs? Contact us for enterprise limits after you're on a paid plan.

Credits & billing

Each moderation request consumes credits from your account balance. New accounts include a free tier to get started.

  • Purchase additional credits from the Buy Credits page (minimum $5 USD).
  • Approximately 3,000 credits per $1 USD.
  • When credits are exhausted, requests return 402 Payment Required with code insufficient_credits.