API Reference

The Swapzy API allows you to integrate AI-powered face swap capabilities into your applications. Access requires a Developer or Enterprise subscription.

Base URL

https://api.swapzy.pro/v1

Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Generate API keys in your account settings.

Rate Limiting

API requests are rate-limited based on your subscription tier:

Developer

100 req/min

10,000 req/day

Enterprise

Custom

Contact sales

Code Examples

Quick examples to get started with the Swapzy API:

Generate Image Face Swap
Create a face swap from two images
curl -X POST https://api.swapzy.pro/v1/generate/image \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_url": "https://example.com/face.jpg",
    "target_url": "https://example.com/target.jpg",
    "enhancements": {
      "face_restoration": true,
      "color_correction": true
    }
  }'

Endpoints

POST/api/v1/generate/image
Generate an image face swap

Request Body

source_url string - URL of the source face image

target_url string - URL of the target image

face_index number (optional) - Index of face to swap (default: 0)

enhancements object (optional)

face_restoration boolean - Enable face restoration (+1 token)

color_correction boolean - Enable color correction (+0.5 tokens)

seamless_blending boolean - Enable seamless blending (+0.5 tokens)

Response

{
  "id": "gen_abc123",
  "status": "processing",
  "type": "image",
  "created_at": "2024-01-15T10:30:00Z",
  "cost": 3.5
}
POST/api/v1/generate/video
Generate a video face swap

Request Body

source_url string - URL of the source face image

target_url string - URL of the target video

output_resolution string - "original", "720p", or "1080p"

output_fps string - "original", "24", or "30"

enhancements object

Response

{
  "id": "gen_xyz789",
  "status": "queued",
  "type": "video",
  "created_at": "2024-01-15T10:30:00Z",
  "estimated_cost": 45.0
}
GET/api/v1/generation/{id}
Get generation status and result

Response

{
  "id": "gen_abc123",
  "status": "completed",
  "type": "image",
  "result_url": "https://...",
  "thumbnail_url": "https://...",
  "created_at": "2024-01-15T10:30:00Z",
  "completed_at": "2024-01-15T10:30:05Z",
  "cost": 3.5
}
GET/api/v1/balance
Get current token balance

Response

{
  "tokens": 1500,
  "monthly_allocation": 2000,
  "allocation_resets_at": "2024-02-01T00:00:00Z"
}

Error Handling

The API uses standard HTTP status codes. Error responses include a JSON body with details:

{
  "error": {
    "code": "INSUFFICIENT_TOKENS",
    "message": "Not enough tokens for this operation",
    "details": {
      "required": 10,
      "available": 5
    }
  }
}

400Bad Request - Invalid parameters

401Unauthorized - Invalid or missing API key

403Forbidden - API access not enabled for your plan

429Too Many Requests - Rate limit exceeded

500Internal Server Error