Schemas & Components
Define the structure of content you submit for moderation
A Schema is a blueprint that describes the fields in your content (for example: title, body, images). Each field is a Component with a type (Text or Image). Requests must match the schema to pass validation.
Purpose
A Schema is a mandatory blueprint that defines the structure of content you want to moderate. It acts as a contract between your application and Outharm, ensuring that every moderation request follows a predictable format.
Schemas are semantic objects that represent real-world content types in your application. They describe what fields your content has (like title, body, images) and how to send them to our API. Without a schema, moderation requests cannot be processed.
Every moderation request - whether automated AI moderation or manual human review - must reference a schema via schema_id
. This ensures consistent validation, processing, and results across your entire content moderation workflow.
Schema Structure
Each schema can contain up to 20 components. Every component has a unique name within the schema and can be one of two types:
TText Components
Accept arrays of strings for textual content
- • Titles, descriptions, comments
- • Article content, user bios
- • Any text-based data
IImage Components
Accept arrays of image references
- • Public URLs pointing to images
- • Base64 encoded data URLs
- • Profile pictures, content images
Array-Based Format
All component values in your JSON requests must be arrays, even for single items. This design supports multiple elements per field (e.g., multiple images, several text blocks) and allows you to send as many elements as your request size limit supports.
Flexible Component Usage
All components in a schema are optional - you don't need to include every component in your request. However, at least one component must be provided for the request to be valid.
Creating a Schema
Schemas are created through the Console interface. The process is straightforward and provides immediate feedback with example JSON:
Navigate to Schemas
Open your project in Console and go to the Schemas section
Create New Schema
Click New Schema and enter a descriptive name that represents your content type
Add Components
For each field in your content, add a component. Choose Text or Image type and set the exact component name you'll use as the JSON key
Save & Copy Example
Save the schema and view its details page to copy a ready-to-use JSON example for your API requests
Example: Blog Post Schema
Here's a practical example of a blog post schema with three components. Notice how the component names become the keys in your API request:
Schema Components
API Request Example
{
"schema_id": "your-blog-post-schema-id",
"content": {
"title": ["My Blog Post Title"],
"content": ["This is the main article content..."],
"images": [
"https://example.com/featured-image.jpg",
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..."
]
}
}
Using Schemas in API Requests
Schemas are mandatory for both automated and manual moderation endpoints. Include the schema_id
in your request and structure your content according to the schema's components:
Automated Moderation
POST https://api.outharm.com/moderation/automated
Authorization: Bearer your-api-token
Content-Type: application/json
{
"schema_id": "your-schema-id",
"content": {
"title": ["Content title"],
"images": ["https://example.com/image.jpg"]
}
}
Manual Moderation
POST https://api.outharm.com/moderation/manual
Authorization: Bearer your-api-token
Content-Type: application/json
{
"schema_id": "your-schema-id",
"content": {
"title": ["Content title"],
"images": ["https://example.com/image.jpg"]
}
}
Managing Schemas
The Console provides several operations for managing your schemas:
Important: Schemas are Immutable
Once created, schemas cannot be edited directly. To modify a schema, duplicate it, make your changes, and update your application to use the new schema_id
. This design ensures that existing moderation requests remain consistent and prevents breaking changes to your integration.
Available Operations
- • View: See components and copy example JSON
- • Duplicate: Create a copy to modify
- • Delete: Remove unused schemas
Best Practices
- • Use descriptive schema names
- • Plan component names carefully
- • Test with example JSON before integration
Common Schema Examples
Schemas represent semantic content types in your application. Here are comprehensive examples with actual JSON payloads:
Flexible Usage
Remember, you can send only the components you need. For example, a blog post schema with title, content, and images can be used with just title and content, or just images, as long as at least one component is included.
📱Social Media Post
API Request
{
"schema_id": "social-media-post-schema-id",
"content": {
"caption": ["Check out this amazing sunset! 🌅"],
"images": [
"https://example.com/sunset.jpg",
"https://example.com/beach.jpg"
],
"hashtags": ["#sunset", "#beach", "#nature", "#photography"]
}
}
🛍️Product Listing
API Request
{
"schema_id": "product-listing-schema-id",
"content": {
"name": ["Vintage Leather Jacket"],
"description": [
"High-quality vintage leather jacket in excellent condition.
Perfect for casual wear or special occasions."
],
"photos": [
"https://example.com/jacket-front.jpg",
"https://example.com/jacket-back.jpg",
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..."
]
}
}
💬User Comment
API Request
{
"schema_id": "user-comment-schema-id",
"content": {
"text": [
"This is an amazing feature! Thanks for implementing it.
Here's a screenshot showing the issue I mentioned."
],
"attachments": [
"https://example.com/screenshot.png"
]
}
}
👤User Profile
API Request
{
"schema_id": "user-profile-schema-id",
"content": {
"display_name": ["Alex Rodriguez"],
"bio": [
"Full-stack developer passionate about building great user experiences.
Love hiking and photography in my free time!"
],
"avatar": [
"https://example.com/alex-profile.jpg"
]
}
}
Ready to Get Started?
Create your first schema and start structuring content for moderation with our flexible component system.
Console Walkthrough
Learn how to create schemas in the console
Console Walkthrough
Learn how to create schemas in Console
Related Documentation
- • Quick Start Guide - Get up and running quickly
- • Categories - What content types can be detected
- • Projects & Tokens - Project and authentication setup
- • Automated Moderation - Configure AI-powered moderation