Face Swap API
Documentation on our cost-friendly, state-of-the-art Face Swap API (alpha test)!
GoAPI now offers Faceswap API for you to integrate into your app!
Example
Pricing
This API is will be pay-as-you-go for all users, see details: Face Swap API | PPU Quota | Endpoint Usage!
Async API
Each image must contain only one face.
This is an async request, you will need to fetch the result after submit this task.
If you are experiencing server errors when using this endpoint, please switch to a different available domain(s) shown here.
This is an async request, you will need to fetch the result after submit this task.
If you are experiencing server errors when using this endpoint, please switch to a different available domain(s) shown here.
Request Example
curl --location 'https://api.goapi.xyz/api/face_swap/v1/async' \
--header 'X-API-Key: {YOUR-GOAPI-KEY}' \
--header 'Content-Type: application/json' \
--data '{
"target_image": "https://hips.hearstapps.com/hmg-prod/doc-images/ariana_grande_photo_jon_kopaloff_getty_images_465687098.jpg",
"swap_image": "https://imageio.forbes.com/specials-images/imageserve/6474d985fece284f32569957/0x0.jpg?format=jpg&width=1200",
"result_type": "url"
}'
Response Example
You need
task_id
later in fetch api to get the final result.{
"code": 200,
"data": {
"task_id": "bfc30d05-006d-462f-a58e-8edf6e7021db"
},
"message": "success"
}
Error Message
Message | possible root cause |
---|---|
invalid request | input image is not an url or valid Base64 image string. Url not ends in jpg ,jpeg ,png or webp |
invalid request, no face found in the image | failed to find a face in the input image |
task not found | no such task_id |
internal error | goapi internal error |
unknown generation error, please contact us for help | unknown error |
Fetch API
Use this Fetch endpoint with the async endpoint.
Request Example
curl --location 'https://api.goapi.xyz/api/face_swap/v1/fetch' \
--header 'X-API-Key: {YOUR-GOAPI-KEY}' \
--header 'Content-Type: application/json' \
--data '{
"task_id": "bfc30d05-006d-462f-a58e-8edf6e7021db"
}'
Response Example
status
reflects the actual progress of the task.{
"code": 200,
"data": {
"status": "success",
"image": "https://img.midjourneyapi.xyz/temp/bf055b3b-37ee-4f94-a60c-43fe18916a6b",
"used_credits": 7
},
"message": "success"
}
Status List
Status | description |
---|---|
pending | the task is in wait queue of GoAPI |
starting | the task is beginning to procceed |
processing | rendering the task |
success | task finished |
failed | task failed |
retry | this usually happens if your image url is hard to download |