Skip to content

API Reference

UniSync exposes a comprehensive REST API built with FastAPI.

Base URL

http://localhost:8000/api

In production: https://api.unisync.ai/api

Interactive Documentation

FastAPI automatically generates interactive API documentation:

  • Swagger UI: {base_url}/docs
  • ReDoc: {base_url}/redoc

Authentication

Most endpoints require a JWT bearer token.

Obtaining a Token

http
POST /api/auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "your_password"
}

Response:

json
{
  "access_token": "eyJ...",
  "token_type": "bearer",
  "user": { ... }
}

Using the Token

Include the token in the Authorization header:

http
Authorization: Bearer eyJ...

Token Refresh

http
POST /api/auth/refresh
Authorization: Bearer {current_token}

Response Format

All API responses follow a consistent structure:

Success

json
{
  "data": { ... },
  "message": "Operation successful"
}

Error

json
{
  "detail": "Error description"
}

Common HTTP Status Codes

CodeMeaning
200Success
201Created
400Bad request (validation error)
401Unauthorized (invalid/missing token)
403Forbidden (insufficient role)
404Resource not found
422Validation error
500Internal server error

Role-Based Access

Endpoints enforce role requirements:

RoleAccess Level
super_adminAll endpoints
adminAll except system-level
editorContent and agent management
viewerRead-only endpoints

API Groups

GroupPrefixEndpoints
Authentication/api/authLogin, register, profile, 2FA
Agents/api/agentsCRUD, assignments, execution
Environments/api/environmentsCRUD, configuration
Configurations/api/configurationsAPI credentials
SEO Intelligence/api/seoKeywords, campaigns, scout, strategies
Content Intelligence/api/cieArchetypes
OpenChat/api/openchatConversations, messages
Live Agents/api/live-agentsSessions, generation
WordPress Posts/api/wordpress-postsPost management
Astro Posts/api/astro-postsPost CRUD
CMS/api/cmsCategories, tags
Token Analytics/api/token-analyticsUsage, costs
AutoPilot/api/autopilotAutomation control
Backup/api/backupBackup/restore
Search Phrases/api/search-phrasesAutomation
Web Sources/api/web-sourcesAutomation
Settings/api/settings/ai-contentAI content config
Notifications/api/notificationsUser notifications
Messages/api/messagesMessaging

Rate Limits

UniSync does not enforce internal rate limits, but external API providers do. Monitor usage through Token Analytics.

UniSync Documentation