API Documentation

Complete technical documentation for integrating Safora.io content moderation APIs into your applications.

Getting Started

Quick Start Guide

Get up and running with Safora.io APIs in minutes

1

Sign up for an API key

Create your account and get your API key from the dashboard

2

Make your first API call

Test the API with a simple NSFW detection request

3

Integrate into your app

Use our SDKs or direct API calls to add content moderation

Base URL

https://api.safora.io

Authentication

API Key Authentication

All API requests require authentication using your API key

Include your API key in the Authorization header of every request:

Authorization: Bearer your-api-key-here

Security Note

Never expose your API key in client-side code. Always make API calls from your backend server.

API Endpoints

NSFW Content Detection

POST

Detect inappropriate visual content with high accuracy

Endpoint

POST /v1/detect/nsfw

Parameters

image
file/url
Required

Image file or URL to analyze

threshold
float

Confidence threshold (0.0-1.0)

return_labels
boolean

Return detailed labels

Content Type Analysis

POST

Classify content type and appropriateness level

Endpoint

POST /v1/analyze/content-type

Parameters

image
file/url
Required

Image file or URL to analyze

detailed
boolean

Return detailed analysis

Sensitivity Scoring

POST

Measure content sensitivity with granular scoring

Endpoint

POST /v1/analyze/sensitivity

Parameters

image
file/url
Required

Image file or URL to analyze

metrics
array

Specific metrics to analyze

Video Analysis (Beta)

POST
Beta

Multi-layered video content analysis

Endpoint

POST /v1/analyze/video

Parameters

video
file/url
Required

Video file or URL to analyze

analyze_audio
boolean

Include audio analysis

frame_interval
integer

Seconds between frame analysis

Audio Moderation

POST

Real-time audio content moderation

Endpoint

POST /v1/moderate/audio

Parameters

audio
file/url
Required

Audio file or URL to analyze

language
string

Audio language (auto-detect if not specified)

Harmful Content Detection

POST

Detect violence, self-harm, and dangerous content

Endpoint

POST /v1/detect/harmful

Parameters

image
file/url
Required

Image file or URL to analyze

categories
array

Specific harm categories to check

SDKs & Libraries

Official SDKs and libraries to integrate Safora.io APIs into your preferred programming language.

🟨JavaScript/Node.js

Installation

npm install @safora/sdk

Example Usage

import { SaforaClient } from '@safora/sdk';

const client = new SaforaClient({
  apiKey: 'your-api-key'
});

const result = await client.detectNSFW({
  image: 'https://example.com/image.jpg'
});

console.log(result);

🐍Python

Installation

pip install safora-python

Example Usage

from safora import SaforaClient

client = SaforaClient(api_key='your-api-key')

result = client.detect_nsfw(
    image='https://example.com/image.jpg'
)

print(result)

🐘PHP

Installation

composer require safora/php-sdk

Example Usage

<?php
require_once 'vendor/autoload.php';

use Safora\SaforaClient;

$client = new SaforaClient('your-api-key');

$result = $client->detectNSFW([
    'image' => 'https://example.com/image.jpg'
]);

var_dump($result);

🌐cURL

Installation

Available on all systems

Example Usage

curl -X POST https://api.safora.io/v1/detect/nsfw \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://example.com/image.jpg",
    "threshold": 0.8
  }'

Rate Limits

API Rate Limits

Understanding request limits and best practices

1,000
Free Tier
requests/month
100
Pro Plan
requests/minute
1,000
Enterprise
requests/minute

Rate Limit Headers

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

Best Practices

  • • Implement exponential backoff for rate limit errors
  • • Cache results when possible to reduce API calls
  • • Monitor rate limit headers in responses

Error Handling

HTTP Status Codes

Standard HTTP status codes returned by the API

200
OK
Request successful
400
Bad Request
Invalid request parameters
401
Unauthorized
Invalid or missing API key
403
Forbidden
API key lacks required permissions
429
Too Many Requests
Rate limit exceeded
500
Internal Server Error
Server error occurred

Error Response Format

{
  "error": {
    "code": "INVALID_IMAGE",
    "message": "The provided image URL is not accessible",
    "details": "Please ensure the image URL is publicly accessible"
  }
}

Webhooks

Webhook Integration

Receive real-time notifications for content analysis results

Webhook Events

content.analyzed
Triggered when content analysis is complete
content.flagged
Triggered when content is flagged as inappropriate

Webhook Payload Example

{
  "event": "content.analyzed",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "id": "analysis_123456",
    "content_url": "https://example.com/image.jpg",
    "result": {
      "nsfw_probability": 0.85,
      "is_nsfw": true,
      "confidence": 0.92
    }
  }
}

Need Help?

Our team is here to help you integrate successfully