> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Server-to-server APIs for programmatic administration, moderation, automation, and real-time event processing

<img src="https://mintcdn.com/social-b97141fb/GwxJ1rNsHt4d_rCz/images/API-Dark.png?fit=max&auto=format&n=GwxJ1rNsHt4d_rCz&q=85&s=513474964021de2532ac183132f93236" alt="API Dark Pn" width="1024" height="360" data-path="images/API-Dark.png" />

Integrate powerful administrative capabilities directly into your applications with social.plus REST APIs. Access the same functionality available in the console programmatically, enabling automated workflows, custom integrations, and advanced community management features.

<Info>
  **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.
</Info>

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="#authentication-methods">
    Admin and user access tokens, secure mode, and API authentication
  </Card>

  <Card title="Moderation APIs" icon="shield-check" href="#moderation-automation">
    Programmatic content moderation, user management, and safety controls
  </Card>

  <Card title="Analytics APIs" icon="chart-bar" href="#analytics--insights">
    Access community metrics, user data, and business intelligence programmatically
  </Card>

  <Card title="Webhook Integration" icon="webhook" href="/analytics-and-moderation/social+-apis-and-services/webhook-event">
    Real-time event notifications and automated response systems
  </Card>
</CardGroup>

## 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

<Steps>
  <Step title="Obtain Admin Access Token">
    Generate an admin access token from your console under **Settings** → **Admin Users**
  </Step>

  <Step title="Choose Authentication Method">
    Select between admin tokens for server operations or user tokens for user-context actions
  </Step>

  <Step title="Configure API Client">
    Set up your server environment with proper authentication and regional endpoints
  </Step>

  <Step title="Test Integration">
    Start with simple API calls to verify connectivity and permissions
  </Step>
</Steps>

## Authentication Methods

<Tabs>
  <Tab title="Admin Access">
    ### Admin API Access Token

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

    <Steps>
      <Step title="Generate Token">
        Navigate to Console → **Settings** → **Security** → **Admin API Access Token**
      </Step>

      <Step title="Configure Permissions">
        Set appropriate scopes and expiration for your integration
      </Step>

      <Step title="Secure Storage">
        Store the token securely and rotate regularly
      </Step>
    </Steps>

    <Warning>
      Admin tokens provide full access to your application. Never expose them in client-side code or public repositories.
    </Warning>

    ```bash theme={null}
    curl -X 'GET' \
      'https://apix.<region>.amity.co/api/v3/users' \
      -H 'accept: application/json' \
      -H 'x-admin-token: <your-admin-token>'
    ```
  </Tab>

  <Tab title="User Access">
    ### User Access Token

    For user-context API calls with scoped permissions:

    <Steps>
      <Step title="Get Authentication Token">
        Use your server key to generate an authentication token for the user
      </Step>

      <Step title="Create User Session">
        Register a session using the authentication token
      </Step>

      <Step title="Extract Access Token">
        Use the returned access token for API calls
      </Step>
    </Steps>

    ```bash theme={null}
    # 1. Get authentication token with server key
    curl -X 'GET' \
      'https://apix.<region>.amity.co/api/v3/authentication/token?userId=<userId>' \
      -H 'x-server-key: <your-server-key>'

    # 2. Create user session
    curl -X 'POST' \
      'https://apix.<region>.amity.co/api/v3/sessions' \
      -H 'x-api-key: <api-key>' \
      -H 'Content-Type: application/json' \
      -d '{
        "userId": "<userId>",
        "deviceId": "server",
        "authToken": "<authentication-token>"
      }'
    ```

    <Info>
      User Access tokens are valid for 30 days but will be invalidated if a different user ID registers with the same device.
    </Info>
  </Tab>

  <Tab title="Secure Mode">
    ### Secure Mode Authentication

    Enhanced security with server key authentication:

    * **Additional Security Layer**: Requires server-level authentication
    * **Token Generation**: Server key needed to generate user tokens
    * **Enterprise Feature**: Available for production deployments

    ```javascript theme={null}
    // Generate user token in secure mode
    const response = await fetch(`https://apix.${region}.amity.co/api/v3/authentication/token`, {
      method: 'GET',
      headers: {
        'x-server-key': process.env.AMITY_SERVER_KEY
      },
      params: {
        userId: 'user123'
      }
    });
    ```
  </Tab>
</Tabs>

## Token Management

<AccordionGroup>
  <Accordion title="Token Security Best Practices">
    * **Secure Storage**: Use environment variables or secure key management systems
    * **Regular Rotation**: Implement automated token rotation procedures
    * **Scope Limitation**: Use minimum required permissions for each token
    * **Monitoring**: Log and monitor API usage patterns and anomalies
    * **Revocation**: Implement emergency token revocation procedures
    * **HTTPS Only**: Always use HTTPS for API communications
    * **IP Whitelisting**: Implement IP restrictions where possible
  </Accordion>

  <Accordion title="Token Validation and Revocation">
    **Validate Tokens**

    ```javascript theme={null}
    const validateToken = async (token) => {
      try {
        const response = await fetch('https://apix.region.amity.co/api/v3/users/me', {
          headers: { 'Authorization': `Bearer ${token}` }
        });
        return response.ok;
      } catch (error) {
        return false;
      }
    };
    ```

    **Revoke User Access Tokens**
    Admin tokens can revoke user access tokens using the Revoke API:

    ```bash theme={null}
    curl -X DELETE "https://apix.region.amity.co/api/v4/sessions" \
      -H "x-admin-token: YOUR_ADMIN_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"userId": "user123"}'
    ```
  </Accordion>

  <Accordion title="Rate Limiting and Error Handling">
    **Rate Limiting**

    * Respect API rate limits to avoid throttling
    * Implement exponential backoff for retry logic
    * Use batch operations when available for efficiency
    * Cache responses appropriately to reduce API calls

    **Error Handling**

    * Implement comprehensive error handling for all API calls
    * Log errors with sufficient detail for debugging
    * Provide graceful degradation when APIs are unavailable
    * Monitor API response times and success rates
  </Accordion>
</AccordionGroup>

## Common Use Cases

<AccordionGroup>
  <Accordion title="Automated Moderation">
    **Content Monitoring**

    * Set up automated scanning for new content
    * Apply custom moderation rules based on community guidelines
    * Integrate with external moderation services
    * Handle bulk content operations efficiently

    **User Behavior Management**

    * Automatically flag suspicious user patterns
    * Implement graduated response systems
    * Handle coordinated abuse or spam campaigns
    * Maintain audit trails for compliance
  </Accordion>

  <Accordion title="Business Intelligence">
    **Custom Analytics**

    * Export data to business intelligence tools
    * Create custom reports for stakeholders
    * Track KPIs specific to your business model
    * Integrate with existing analytics platforms

    **Growth Analysis**

    * Monitor user acquisition and retention
    * Track feature adoption and usage patterns
    * Analyze community health indicators
    * Generate executive dashboards
  </Accordion>

  <Accordion title="Workflow Automation">
    **User Lifecycle Management**

    * Automate user onboarding processes
    * Handle account verification and upgrades
    * Manage subscription and billing integrations
    * Implement custom user journey flows

    **Content Operations**

    * Bulk import/export of content
    * Automated content promotion and featuring
    * Cross-platform content synchronization
    * Content archival and cleanup processes
  </Accordion>

  <Accordion title="Real-Time Integration">
    **Webhook Automation**

    * Receive real-time notifications for platform events
    * Trigger automated workflows based on user actions
    * Integrate with external systems and services
    * Build custom notification and alert systems

    **Event Processing**

    * Process content creation, modification, and deletion events
    * Handle user registration, login, and activity events
    * Implement custom business logic with pre-hook events
    * Create audit trails and compliance reporting
  </Accordion>
</AccordionGroup>

## Regional Endpoints

Different regions have specific API endpoints for optimal performance:

| Region        | API Endpoint               |
| ------------- | -------------------------- |
| **US East**   | `https://apix.us.amity.co` |
| **Europe**    | `https://apix.eu.amity.co` |
| **Singapore** | `https://apix.sg.amity.co` |

<Tip>
  **Performance Optimization**: Always use the regional endpoint closest to your server infrastructure for best performance and lowest latency.
</Tip>

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="book" href="https://api-docs.amity.co/">
    Complete API documentation with endpoints and examples
  </Card>

  <Card title="Webhook Setup" icon="webhook" href="/analytics-and-moderation/social+-apis-and-services/webhook-event">
    Configure real-time event notifications and automated responses
  </Card>

  <Card title="Pre-Hook Events" icon="zap" href="/analytics-and-moderation/social+-apis-and-services/pre-hook-event">
    Intercept and modify events before they're processed
  </Card>

  <Card title="User Activity Reports" icon="chart-line" href="/analytics-and-moderation/social+-apis-and-services/generate-user-last-activity-report">
    Generate comprehensive user activity and engagement reports
  </Card>
</CardGroup>

## Related Services

<CardGroup cols={2}>
  <Card title="Network Settings" icon="network-wired" href="/analytics-and-moderation/social+-apis-and-services/network-settings">
    Configure platform-wide settings and policies
  </Card>

  <Card title="Activity Reports" icon="file-chart-column" href="/analytics-and-moderation/social+-apis-and-services/generate-user-last-activity-report">
    Generate comprehensive user activity and engagement reports
  </Card>
</CardGroup>

<Warning>
  **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.
</Warning>

***

<Tip>
  Need help implementing a specific API integration? Check our [developer community](https://community.amity.co) or contact support for guidance.
</Tip>
