Modsift API Documentation

Comprehensive API reference for content moderation endpoints

Authentication

API Key Authentication

Use API keys for server-to-server communication and programmatic access to the Modsift API. This is the recommended method for production applications and automated workflows.

Include your API key in the Authorization header:

curl -X GET https://api.modsift.com/v1/endpoint \
  -H "Authorization: your-api-key"

Cognito Authentication

Use Cognito authentication for web application access through the Modsift dashboard. This method is used when users interact with the platform through the browser interface.

For web application access, endpoints are available with the _cognito_ suffix after user login (e.g., /api/v1/moderation/moderate_cognito_)

Core Concepts

Severity Levels

The severity scale represents how serious a policy violation is. Each policy evaluates content and assigns a severity level from none (no violation) to very_high (critical violation).

none → very_low → low → medium → high → very_high

Policy Types

Modsift currently supports managed policies, which are professionally designed and maintained detection rules for common moderation scenarios.

Managed Policies: Pre-built by the platform (e.g., "Harassment Detection", "Profanity Detection")

Thresholds

Thresholds control the sensitivity of each policy by defining the minimum severity level that will trigger a flag. For example, setting a threshold to "medium" means only violations rated medium or higher will be flagged.

Determine when a detected violation should trigger an action. Can be set per policy within each profile and falls back to default_threshold if not specified.

Profiles

Profiles allow you to create different moderation strategies for different contexts. For example, you might use a strict profile for public comments and a lenient profile for private messages.

Collections of policies with specific threshold configurations. Enable different moderation strategies for different use cases. Can be set as account default or specified per request.

Types & Enums

SeverityLevel

Represents how serious a policy violation is. Used in moderation responses to indicate the detected severity.

"none" | "very_low" | "low" | "medium" | "high" | "very_high"

ThresholdValue

Defines the minimum severity level that will trigger a flag. Content with severity at or above the threshold will be flagged.

"very_low" | "low" | "medium" | "high" | "very_high"

PolicyType

Indicates whether a policy is a pre-built managed policy or a user-defined custom policy.

"managed" | "custom"

AttachedPolicy Object

Represents a policy attached to a profile with its configuration.

{
  "name": string,            // Policy name
  "policy_type": PolicyType, // "managed" or "custom"
  "threshold": ThresholdValue // Threshold for this policy
}

Core Moderation

POST
/v1/moderate

Primary moderation endpoint for analyzing content against configured policies

Request Body Parameters

NameTypeRequiredDescriptionDefault
contentstring
Yes
The text content to moderate-
profilestring
No
Profile name to use for moderationUser's default profile
policy_overridesobject
No
Threshold overrides per policy. Object with policy names as keys and ThresholdValue as values{}
include_reasoningboolean
No
Include reasoning in response (not yet implemented)true

Request Example

curl -X POST https://api.modsift.com/v1/moderate \
  -H "Authorization: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "text to moderate",
    "profile": "ecommerce_strict",
    "policy_overrides": {
      "Harassment Detection": "high",
      "Spam Detector": "very_high"
    },
    "include_reasoning": false
  }'

Response Fields

FieldTypeDescription
request_idstringUnique request identifier (format: req_{12_hex_chars})
timestampstringISO 8601 timestamp of the request
overall_flaggedbooleanTrue if any policy triggered a flag
policiesobjectResults per policy with name, policy_type, flagged, severity, threshold_used, reasoning, and relevant_excerpt
metadata.total_units_usednumberAPI units consumed by this request

Response Example

{
  "request_id": "req_789xyz456abc",
  "timestamp": "2025-05-26T10:30:05Z",
  "overall_flagged": true,
  "policies": {
    "HarassmentDetection": {
      "name": "HarassmentDetection",
      "policy_type": "managed",
      "flagged": true,
      "severity": "high",
      "threshold_used": "medium",
      "reasoning": "Content contains threatening language",
      "relevant_excerpt": "threatening excerpt"
    }
  },
  "metadata": {
    "total_units_used": 2
  }
}

Profile Management

POST
/v1/profiles

Create a new moderation profile with policies and thresholds

Request Body Parameters

NameTypeRequiredDescriptionDefault
namestring
Yes
Profile name

Validation: Alphanumeric, hyphens, underscores only. Cannot start with '__'

-
descriptionstring
No
Profile description""
attached_policiesobject
No
Policies to attach. Object with policy names as keys and AttachedPolicy objects as values{}
default_thresholdThresholdValue
No
Default threshold for policies without explicit threshold"medium"
is_defaultboolean
No
Set as account default profilefalse

Request Example

curl -X POST https://api.modsift.com/v1/profiles \
  -H "Authorization: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ecommerce_strict",
    "description": "Strict moderation for e-commerce reviews",
    "attached_policies": {
      "HarassmentDetectionPolicy": {
        "name": "HarassmentDetectionPolicy",
        "policy_type": "managed",
        "threshold": "medium"
      }
    },
    "default_threshold": "medium",
    "is_default": false
  }'

Response Fields

FieldTypeDescription
namestringCreated profile name
created_atstringISO 8601 timestamp of creation

Response Example

{
  "name": "ecommerce_strict",
  "created_at": "2025-05-26T10:30:00Z"
}
GET
/v1/profiles

List all moderation profiles for the authenticated user

Request Example

curl -X GET https://api.modsift.com/v1/profiles \
  -H "Authorization: your-api-key"

Response Fields

FieldTypeDescription
profilesarrayList of profile summaries
totalnumberTotal number of profiles

Response Example

{
  "profiles": [
    {
      "name": "ecommerce_strict",
      "description": "Strict moderation for e-commerce reviews",
      "is_default": false,
      "attached_policies_count": 3,
      "managed_policies_count": 3,
      "created_at": "2025-05-26T10:30:00Z",
      "last_modified": "2025-05-26T10:30:00Z"
    }
  ],
  "total": 1
}
GET
/v1/profiles/{profile_id}

Get detailed information about a specific profile

Path Parameters

NameTypeRequiredDescriptionDefault
profile_idstring
Yes
Name of the profile to retrieve-

Request Example

curl -X GET https://api.modsift.com/v1/profiles/ecommerce_strict \
  -H "Authorization: your-api-key"

Response Fields

FieldTypeDescription
namestringProfile name
descriptionstringProfile description
attached_policiesobjectAttached policies with configurations
default_thresholdThresholdValueDefault threshold
is_defaultbooleanWhether this is the default profile
created_atstringCreation timestamp
last_modified_atstringLast modification timestamp

Response Example

{
  "name": "ecommerce_strict",
  "description": "Strict moderation for e-commerce reviews",
  "attached_policies": {
    "HarassmentDetectionPolicy": {
      "name": "HarassmentDetectionPolicy",
      "policy_type": "managed",
      "threshold": "medium"
    }
  },
  "default_threshold": "medium",
  "is_default": false,
  "created_at": "2025-05-26T10:30:00Z",
  "last_modified_at": "2025-05-26T10:30:00Z"
}
PUT
/v1/profiles/{profile_id}

Update an existing profile's configuration

Path Parameters

NameTypeRequiredDescriptionDefault
profile_idstring
Yes
Current profile name-

Request Body Parameters

NameTypeRequiredDescriptionDefault
namestring
No
New profile name (for renaming)

Validation: Alphanumeric, hyphens, underscores only. Cannot start with '__'

-
descriptionstring
No
Updated description-
default_thresholdThresholdValue
No
New default threshold-
is_defaultboolean
No
Set/unset as default-
attached_policiesobject
No
Replace all attached policies-

Request Example

curl -X PUT https://api.modsift.com/v1/profiles/ecommerce_strict \
  -H "Authorization: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ecommerce_very_strict",
    "attached_policies": {
      "HarassmentDetectionPolicy": {
        "name": "HarassmentDetectionPolicy",
        "policy_type": "managed",
        "threshold": "medium"
      }
    },
    "default_threshold": "low",
    "is_default": true
  }'

Response Fields

FieldTypeDescription
namestringProfile name (possibly new)
updated_atstringUpdate timestamp
statusstringAlways "updated"

Response Example

{
  "message": "Profile updated successfully"
}
DELETE
/v1/profiles/{profile_id}

Delete a moderation profile

Path Parameters

NameTypeRequiredDescriptionDefault
profile_idstring
Yes
Profile to delete-

Request Example

curl -X DELETE https://api.modsift.com/v1/profiles/ecommerce_strict \
  -H "Authorization: your-api-key"

Response Fields

FieldTypeDescription
namestringDeleted profile name
statusstringAlways "deleted"
deleted_atstringDeletion timestamp

Response Example

{
  "message": "Profile deleted successfully"
}
POST
/v1/profiles/{profile_id}/policies

Attach one or more policies to a profile

Path Parameters

NameTypeRequiredDescriptionDefault
profile_idstring
Yes
Profile to attach policies to-

Request Body Parameters

NameTypeRequiredDescriptionDefault
namestring
Yes
Policy name (in each policy object)-
policy_typePolicyType
Yes
"managed" or "custom" (in each policy object)-
thresholdThresholdValue
Yes
Threshold for this policy (in each policy object)-

Request Example

curl -X POST https://api.modsift.com/v1/profiles/ecommerce_strict/policies \
  -H "Authorization: your-api-key" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "name": "HarassmentDetectionPolicy",
      "policy_type": "managed",
      "threshold": "medium"
    },
    {
      "name": "ViolenceDetectionPolicy",
      "policy_type": "managed",
      "threshold": "medium"
    }
  ]'

Response Fields

FieldTypeDescription
namestringProfile name
attached_policiesarrayList of attachment results with name, status, and attached_at
messagestringSuccess message

Response Example

{
  "message": "Policies attached successfully"
}
DELETE
/v1/profiles/{profile_id}/policies/{policy_name}

Detach a policy from a profile

Path Parameters

NameTypeRequiredDescriptionDefault
profile_idstring
Yes
Profile name-
policy_namestring
Yes
Policy to detach (must be attached)-

Request Example

curl -X DELETE https://api.modsift.com/v1/profiles/ecommerce_strict/policies/HarassmentDetectionPolicy \
  -H "Authorization: your-api-key"

Response Fields

FieldTypeDescription
namestringProfile name
policy_namestringDetached policy name
statusstringAlways "detached"
detached_atstringDetachment timestamp

Response Example

{
  "message": "Policy detached successfully"
}
PUT
/v1/profiles/{profile_id}/policies/{policy_name}

Update the threshold for a specific policy within a profile

Path Parameters

NameTypeRequiredDescriptionDefault
profile_idstring
Yes
Profile name-
policy_namestring
Yes
Policy to update (must be attached)-

Request Body Parameters

NameTypeRequiredDescriptionDefault
thresholdThresholdValue
Yes
New threshold value

Validation: Must be: very_low, low, medium, high, or very_high

-

Request Example

curl -X PUT https://api.modsift.com/v1/profiles/ecommerce_strict/policies/HarassmentDetectionPolicy \
  -H "Authorization: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "threshold": "high"
  }'

Response Fields

FieldTypeDescription
namestringProfile name
policy_namestringUpdated policy name
thresholdThresholdValueNew threshold
statusstringAlways "updated"
updated_atstringUpdate timestamp

Response Example

{
  "message": "Policy threshold updated successfully"
}

Managed Policies

GET
/v1/policies/managed

List all available pre-built managed policies

Query Parameters

NameTypeRequiredDescriptionDefault
searchstring
No
Search by name or description-
limitinteger
No
Max results to return20
offsetinteger
No
Pagination offset0

Request Example

curl -X GET https://api.modsift.com/v1/policies/managed \
  -H "Authorization: your-api-key"

# With query parameters
curl -X GET "https://api.modsift.com/v1/policies/managed?limit=10&offset=0" \
  -H "Authorization: your-api-key"

Response Fields

FieldTypeDescription
policiesarrayList of managed policy objects with name, description, rules, created_at, and last_updated
totalnumberTotal matching policies
paginationobjectPagination info with limit, offset, and has_more

Response Example

{
  "policies": [
    {
      "name": "HarassmentDetectionPolicy",
      "description": "Detects harassment, bullying, and targeted attacks",
      "rules": [
        "Identifies direct personal attacks and insults",
        "Detects threatening or intimidating language",
        "Identifies attempts to share or find personal information"
      ],
      "created_at": "2025-01-15T10:00:00Z",
      "last_updated": "2025-05-20T14:30:00Z"
    },
    {
      "name": "ProfanityDetectionPolicy",
      "description": "Detects offensive language and profanity",
      "rules": [
        "Identifies explicit profanity and vulgar language",
        "Detects offensive slurs and derogatory terms",
        "Recognizes filter bypass attempts"
      ],
      "created_at": "2025-01-15T10:00:00Z",
      "last_updated": "2025-06-10T09:15:00Z"
    }
  ],
  "total": 2,
  "pagination": {
    "limit": 20,
    "offset": 0,
    "has_more": false
  }
}
GET
/v1/policies/managed/{policy_name}

Get detailed information about a specific managed policy

Path Parameters

NameTypeRequiredDescriptionDefault
policy_namestring
Yes
Managed policy name

Validation: Must exist in available managed policies

-

Request Example

curl -X GET https://api.modsift.com/v1/policies/managed/HarassmentDetectionPolicy \
  -H "Authorization: your-api-key"

Response Fields

FieldTypeDescription
namestringPolicy name
descriptionstringPolicy description
rulesarrayArray of detection rules
created_atstringCreation timestamp
last_updatedstringLast update timestamp

Response Example

{
  "name": "HarassmentDetectionPolicy",
  "description": "Detects harassment, bullying, and targeted attacks",
  "rules": [
    "Identifies direct personal attacks and insults",
    "Detects threatening or intimidating language",
    "Identifies attempts to share or find personal information"
  ],
  "created_at": "2025-01-15T10:00:00Z",
  "last_updated": "2025-05-20T14:30:00Z"
}