InsightFaceSwap /listid command
Table of contents
Use this endpoint to submit the InsightFaceSwap /listid command to your InsightFaceSwap Discord channel. The result will be returned in the response body and can also be sent as a callback to an optional replyUrl
.
This is a blocking call, you will not be able to make another call to the same InsightFaceSwap Discord channel until the current call is completed. The average execution time is approximately 3 to 10 seconds. If you expect high load and need to make multiple concurrent calls, please consider setting up multiple InsightFaceSwap accounts.
It is important not to use the InsightFaceSwap account setup for API access for any purposes other than its intended use, such as executing /listid
or any other InsightFaceSwap commands manually or in conjunction with any other automation tools. The useapi.net API internally tracks the usage of the InsightFaceSwap account, including the number of currently active executions. Using it for other activities may cause API to function incorrectly.
https://api.useapi.net/v1/faceswap/listid
Request Headers
Authorization: Bearer {API token}
Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"channel": "Discord channel id"
}
-
channel
is optional when only one faceswap/account configured. However, if you have multiple accounts configured, this parameter becomes required. -
replyUrl
is optional, if not provided value from account will be used.
Place here your callback URL. API will call the providedreplyUrl
once job completed or failed.
Maximum length 1024 characters.
We recommend using sites like webhook.site to test callback URL functionality. -
replyRef
is optional, place here your reference id which will be stored and returned along with this job response / result.
Maximum length 1024 characters.
Responses
-
Field
content
contains message generated by InsightFaceSwap.{ "jobid": "<jobid>", "verb": "faceswap-listid", "status": "completed", "created": "2023-09-09T02:04:49.667Z", "updated": "2023-09-09T02:04:53.490Z", "discord": "<ABC…secured…xyz>", "server": "<Discord server id>", "channel": "<Discord channel id>", "replyUrl": "https://webhook.site/abc", "replyRef": "<your optional reference id>", "messageId": "<Discord message id>", "content": "{'id-list': ['ttt']}\n{'current-idname': 'ttt'}\n{'subscription': 'Free'}\n{'credits': '0/50'}", "timestamp": "2023-09-09T02:04:51.926000+00:00", "code": 200 }
-
{ "error": "Optional param replyRef is too long" "Optional param replyUrl is too long" "Required param channel is missing or empty" "Configuration not found for channel <channel>, to create POST v1/faceswap/account/<channel>" "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "Account has no subscription or subscription expired", "code": 402 }
-
Wait in a loop for at least 10..30 seconds and retry again.
There are two possible cases for API response 429.
- API query is full and can not accept new faceswap/listid requests.
{ "error": "Unable to lock Discord after <attempts> attempts", "code": 429 }
- The API received an HTTP status 429 from the Discord API when it attempted to POST to the
/interactions
endpoint. Under normal circumstances, this should be a rare occurrence because the API is designed to strictly adhere to Discord rate limits. However, in certain scenarios, Discord may still issue a 429 response.{ "error": "Discord /interactions failed with HTTP status 429", "errorDetails": "{\"global\":true,\"message\":\"You are being rate limited.\",\"retry_after\":10}", "code": 429 }
- API query is full and can not accept new faceswap/listid requests.
Model
{ // TypeScript, all fields are optional
jobid: string,
verb: 'faceswap-listid',
status: 'completed' | 'failed',
created: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
updated: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
discord: string, // Provided for debugging purposes only, contains the first 3 and the last 3 characters of the original value
server: string,
channel: string,
replyUrl: string,
replyRef: string,
messageId: string,
content: string, // Contains message generated by InsightFaceSwap
timestamp: string,
error: string,
errorDetails: string,
code: number
}
Examples
-
curl -H "Accept: application/json" \ -H "Authorization: Bearer …" \ -X POST https://api.useapi.net/v1/faceswap/listid \ -F "channel=<Discord channel id>"
-
const main = async () => { const apiUrl = "https://api.useapi.net/v1/faceswap/listid"; const token = "API token"; const channel = "Discord channel"; const data = { method: 'POST', headers: { 'Authorization': `Bearer ${token}` } }; const formData = new FormData(); formData.append("channel", channel); data.body = formData; const response = await fetch(apiUrl, data); const result = await response.json(); console.log("response", { response, result }); }; main()
-
import requests api_url = "https://api.useapi.net/v1/faceswap/listid" token = "API token" channel = "Discord channel" headers = { 'Authorization': f'Bearer {token}' } files = { 'channel': (None, channel) } response = requests.post(api_url, headers=headers, files=files) print(response, response.json())