SafeGen API Docs

Create a free account, generate a v2 API key in your portal, and send prompts to SafeGen for infringement risk scoring and intent-preserving sanitized rewrites.

Quick Start

1. Sign Up

Create a free SafeGen account with 500 monthly API calls.

2. Create Key

Open your account portal and create a v2 API key. Copy it when shown.

3. Call API

Send prompts to /api/v2/analyze using the x-api-key header.

Analyze Prompt

POST /api/v2/analyze

Use this endpoint for customer SaaS accounts. TeeGen legacy v1 access remains separate at /api/analyze.

curl -X POST https://safegenapi.com/api/v2/analyze \
  -H "Content-Type: application/json" \
  -H "x-api-key: sg_your_customer_key" \
  -d '{"prompt":"create a louis vuitton style shirt with the exact LV logo"}'

Request Body

prompt

Required string. The user prompt SafeGen should analyze and sanitize if needed.

metadata

Optional object. Add your internal order, user, or product context when useful.

threshold

Optional number. Use your account default when omitted.

{
  "prompt": "make a disney princess style design for a kids hoodie",
  "metadata": {
    "source": "storefront",
    "productType": "hoodie"
  }
}

Response

SafeGen returns structured fields your app can use to approve, rewrite, block, or send a request to review.

{
  "riskScore": 2,
  "flagged": true,
  "decision": "rewrite",
  "reasons": [
    "Potential protected brand or character reference"
  ],
  "sanitizedPrompt": "Create an original fairytale princess-inspired kids hoodie design with a magical castle mood, soft colors, and no protected characters or brand references.",
  "matchedRules": [
    { "term": "disney", "category": "franchise", "risk_level": 2 }
  ],
  "aiFallbackUsed": true
}

Review Decisions

SafeGen may return decision: "review" when a request looks like a possible local business, store, band, or merchant name without a confirmed active protected-content rule. Review decisions preserve the original prompt so platforms can place the job into draft or manual review instead of rewriting away a legitimate customer request.

{
  "riskScore": 1,
  "flagged": true,
  "decision": "review",
  "reviewRequired": true,
  "reviewReason": "Possible business name detected, but no confirmed active trademark rule matched. Original prompt preserved for manual production review.",
  "sanitizedPrompt": "Can you add the words SMOKING CROW above the image and MORA, NM below the image"
}

Partner Integrations

Some platform integrations use private server-to-server provisioning and account isolation flows. Those contracts are shared directly with approved partners and are not part of the public API surface.

Limits And Accounts

Free Plan

Free accounts start with 500 monthly API calls for beta testing.

Starter

$29/month for 5,000 monthly prompt checks once the Stripe price ID is configured.

Growth

$99/month for 25,000 monthly prompt checks once the Stripe price ID is configured.

Accounts And Billing

Customer Keys

Logged-in customers only see their own account, usage, request logs, settings, and API keys.

Admin Access

The admin panel is separate and only available through the SafeGen admin login.

Stripe Checkout

Paid upgrade buttons are wired to Stripe Checkout after Stripe secret and price IDs are added to the server env.

Webhook endpoint: https://safegenapi.com/api/stripe/webhook