Official reference repository · API v1.0.0

FaceSwapAI API reference clients

Runnable Node.js, Python and cURL examples for asynchronous image, video, GIF and multiple-face tasks. The repository exposes the HTTP contract instead of hiding it behind generated SDK code.

01Create a server-side API key

02Submit media with consent=true

03Receive a task ID

04Poll to COMPLETED or FAILED

4generation workflows
3client formats
3.1OpenAPI contract
0live calls in tests

Choose a client

Run the smallest useful example

Every client sends the same bearer authentication, multipart media and explicit consent field to the production v1 routes.

Production contract

Supported v1 routes

These values are pinned to release v1.0.0. Check the live OpenAPI contract before a new integration.

MethodRouteCurrent costInput boundary
POST / GET /api/v1/face-swap/imageImage 13 credits per paid task Two images, up to 30 MB each
POST / GET /api/v1/face-swap/videoVideo max(5, ceil(seconds)) credits Image plus video, up to 300 seconds and 100 MB
POST / GET /api/v1/face-swap/gifGIF max(10, ceil(seconds), ceil(frames / 10)) credits Image plus GIF, up to 30 seconds and 30 MB
POST / GET /api/v1/face-swap/multipleMultiple face 13 credits per task Group image plus 1-10 replacement faces
GET /api/v1/tasksTask history No generation charge Optional pagination, status and task-type filters

Quick start

Submit and poll an image task

Set the key in a protected server environment. Never embed it in browser JavaScript, a mobile binary or a public repository.

  • A verified FaceSwapAI account is required.
  • Every identifiable person must have permitted the edit.
  • Generation is queue-dependent; tests use mocked responses only.
  • Task media is scheduled for deletion after 24 hours and may be removed earlier.
image-swap.mjsView source
import { FaceSwapAIClient } from './src/node/client.mjs';

const client = new FaceSwapAIClient({
  apiKey: process.env.FACESWAPAI_API_KEY,
});

const accepted = await client.submitImage({
  sourceImage: './source.jpg',
  targetImage: './target.jpg',
});

const task = await client.waitForTask('image', accepted.taskId);
console.log(task.result?.url);

Release integrity

Pin the contract you reviewed

The v1.0.0 release includes an OpenAPI snapshot and SHA-256 digest. Software Heritage separately preserves the release-bearing repository snapshot; this remains a publisher-controlled project, not an independent certification.