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
}

Limits And Accounts

Free Plan

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

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 paid subscriptions are planned next; this version focuses on free SaaS account testing and v2 API access.