Task: Face Swap (swap_face)
Overview
- API:
POST /mj/insight-face/swap - Description: Submit two images ( source face and target image ) for face fusion/swap processing.
- Content-Type:
application/json
Authentication
- Use HTTP Bearer Token, Example:
Authorization: Bearer sk-xxxxx
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| sourceBase64 | string | Yes | Source face image (base64 encoded) |
| targetBase64 | string | Yes | Target image (base64 encoded) |
| accountFilter | object | No | Account filtering information, e.g., instanceId (optional) |
| notifyHook | string | No | Callback URL; if empty, uses global notifyHook |
| state | string | No | Custom parameter passed through callback or task status |
Default field order: sourceBase64, targetBase64, accountFilter, notifyHook, state.
Request Example
json
{
"sourceBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgA...",
"targetBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgA...",
"accountFilter": { "instanceId": "instance-123" },
"notifyHook": "https://example.com/callback",
"state": "swap-001"
}curl
bash
curl -X POST "https://api.gpt.ge/mj/insight-face/swap" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{"sourceBase64":"data:image/jpeg;base64,/9j/4AAQSkZJRgA...","targetBase64":"data:image/jpeg;base64,/9j/4AAQSkZJRgA...","accountFilter":{"instanceId":"instance-123"},"notifyHook":"https://example.com/callback","state":"swap-001"}'JavaScript (fetch)
javascript
fetch('https://api.gpt.ge/mj/insight-face/swap', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer sk-xxxx' },
body: JSON.stringify({ sourceBase64: 'data:image/jpeg;base64,/9j/4AAQSkZJRgA...', targetBase64: 'data:image/jpeg;base64,/9j/4AAQSkZJRgA...', accountFilter: { instanceId: 'instance-123' }, notifyHook: 'https://example.com/callback', state: 'swap-001' })
}).then(r => r.json()).then(console.log)Python (requests)
python
import requests
payload = {
'sourceBase64': 'data:image/jpeg;base64,/9j/4AAQSkZJRgA...',
'targetBase64': 'data:image/jpeg;base64,/9j/4AAQSkZJRgA...',
'accountFilter': { 'instanceId': 'instance-123' },
'notifyHook': 'https://example.com/callback',
'state': 'swap-001'
}
resp = requests.post('https://api.gpt.ge/mj/insight-face/swap', headers={'Content-Type':'application/json','Authorization':'Bearer sk-xxxx'}, json=payload)
print(resp.json())Response Example (200)
json
{
"code": 1,
"description": "success",
"properties": null,
"result": "1725015179182153"
}