API Dark Pn

Social+ APIs and Services

Integrate powerful administrative capabilities directly into your applications with Social+ REST APIs. Access the same functionality available in the console programmatically, enabling automated workflows, custom integrations, and advanced community management features.
Server-Side Only: These APIs are designed for server-to-server communication and require admin-level authentication. Never expose admin credentials in client-side applications.

Core API Categories

Administrative Functions

  • User Management: Create, update, and manage user accounts
  • Content Operations: Bulk content management and moderation actions
  • Network Configuration: Application settings and policy management
  • Reporting: Generate and export analytics data

Moderation Automation

  • Content Review: Automated flagging and approval workflows
  • User Actions: Programmatic bans, warnings, and restrictions
  • Policy Enforcement: Custom rules and violation handling
  • Appeal Processing: Automated appeal workflows and notifications

Analytics & Insights

  • Usage Metrics: Access MAU, DAU, and engagement statistics
  • Content Analytics: Performance data for posts, comments, and media
  • Moderation Reports: Safety metrics and policy effectiveness data
  • Custom Reporting: Generate tailored reports for business needs

Real-Time Events

  • Webhook Integration: Receive real-time notifications for platform events
  • Pre-Hook Events: Intercept and modify events before processing
  • Custom Workflows: Build automated response systems and integrations

Getting Started

1

Obtain Admin Access Token

Generate an admin access token from your console under SettingsAdmin Users
2

Choose Authentication Method

Select between admin tokens for server operations or user tokens for user-context actions
3

Configure API Client

Set up your server environment with proper authentication and regional endpoints
4

Test Integration

Start with simple API calls to verify connectivity and permissions

Authentication Methods

Admin API Access Token

For server-to-server API calls with full administrative privileges:
1

Generate Token

Navigate to Console → SettingsSecurityAdmin API Access Token
2

Configure Permissions

Set appropriate scopes and expiration for your integration
3

Secure Storage

Store the token securely and rotate regularly
Admin tokens provide full access to your application. Never expose them in client-side code or public repositories.
curl -X 'GET' \
  'https://apix.<region>.amity.co/api/v3/users' \
  -H 'accept: application/json' \
  -H 'x-admin-token: <your-admin-token>'

Token Management

Common Use Cases

Regional Endpoints

Different regions have specific API endpoints for optimal performance:
RegionAPI Endpoint
US Easthttps://apix.us-east-1.amity.co
Europehttps://apix.eu-central-1.amity.co
Singaporehttps://apix.ap-southeast-1.amity.co
Performance Optimization: Always use the regional endpoint closest to your server infrastructure for best performance and lowest latency.

Integration Examples

Automated Content Review

import requests
import json

class AmityModerationAPI:
    def __init__(self, admin_token, region='us-east-1'):
        self.admin_token = admin_token
        self.base_url = f'https://apix.{region}.amity.co'
        self.headers = {
            'accept': 'application/json',
            'x-admin-token': admin_token
        }
    
    def get_flagged_content(self, limit=50):
        """Retrieve content pending moderation review"""
        response = requests.get(
            f'{self.base_url}/api/v3/moderation/queue',
            headers=self.headers,
            params={'limit': limit, 'status': 'pending'}
        )
        return response.json()
    
    def moderate_content(self, content_id, action, reason):
        """Take moderation action on content"""
        payload = {
            'action': action,  # 'approve', 'remove', 'escalate'
            'reason': reason,
            'moderator_id': 'automated_system'
        }
        response = requests.post(
            f'{self.base_url}/api/v3/moderation/content/{content_id}/action',
            headers=self.headers,
            json=payload
        )
        return response.json()

User Analytics Export

const axios = require('axios');

class AmityAnalyticsAPI {
    constructor(adminToken, region = 'us-east-1') {
        this.adminToken = adminToken;
        this.baseURL = `https://apix.${region}.amity.co`;
        this.headers = {
            'accept': 'application/json',
            'x-admin-token': adminToken
        };
    }
    
    async getUserMetrics(startDate, endDate) {
        try {
            const response = await axios.get(`${this.baseURL}/api/v3/analytics/users`, {
                headers: this.headers,
                params: {
                    start_date: startDate,
                    end_date: endDate,
                    metrics: ['dau', 'mau', 'retention']
                }
            });
            return response.data;
        } catch (error) {
            console.error('Analytics API Error:', error.response?.data || error.message);
            throw error;
        }
    }
    
    async exportUserData(filters = {}) {
        const response = await axios.post(`${this.baseURL}/api/v3/export/users`, {
            filters,
            format: 'csv'
        }, { headers: this.headers });
        
        return response.data.export_url;
    }
}

Webhook Event Handling

// Example webhook handler for real-time events
const express = require('express');
const app = express();

app.use(express.json());

app.post('/webhook', (req, res) => {
    const { event, data, timestamp } = req.body;
    
    switch (event) {
        case 'content.flagged':
            handleContentFlagged(data);
            break;
        case 'user.registered':
            handleUserRegistration(data);
            break;
        case 'post.created':
            handlePostCreated(data);
            break;
        default:
            console.log(`Unhandled event: ${event}`);
    }
    
    res.status(200).json({ status: 'received' });
});

function handleContentFlagged(data) {
    // Implement automated moderation logic
    console.log(`Content flagged: ${data.content_id}`);
    // Could trigger automated review or escalation
}

Next Steps

Production Considerations: Test all API integrations thoroughly in a development environment before deploying to production. Monitor API usage and implement proper error handling and logging.

Need help implementing a specific API integration? Check our developer community or contact support for guidance.