InsightFaceSwap Apps/INSwapper command

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

Use this endpoint to submit the InsightFaceSwap Apps/INSwapper 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.

If you already have a message in your channel with an attached image, you can use this endpoint to perform a face swap on the image contained in that message. You need returned by messages GET request (article).

You can also use field messageId returned by Midjouney API v2.

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 /inswapper or any other InsightFaceSwap commands manually or in conjunction with any other automation tools. The 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.

Request Headers
Authorization: Bearer {API token}
Content-Type: multipart/form-data
Request Body
    "channel": "Discord channel id",
    "targetMessageId": "Discord message id with attached image"
  • channel is optional when only one faceswap/account configured. However, if you have multiple accounts configured, this parameter becomes required.

  • targetMessageId is required, Discord message id with an attached image. The message must be located in the channel specified by the channel param mentioned above.

  • replyUrl is optional, if not provided value from account will be used.
    Place here your callback URL. API will call the provided replyUrl once job completed or failed.
    Maximum length 1024 characters.
    We recommend using sites like 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.

  • 200 OK

    Field content contains message generated by InsightFaceSwap. Attachments array contains generated image.

        "jobid": "<jobid>",
        "verb": "faceswap-inswapper",
        "status": "completed",
        "targetMessageId": "1106423469968976446",
        "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": "",
        "replyRef": "<your optional reference id>",
        "messageId": "<Discord message id>",
        "content": "Picsi.Ai ver.2.0 [SaveID: 'me'] [<@Discord user id>] (90/200 credits used)",
        "attachments": [
            "url": "<generated image url>",
            "proxy_url": "<generated proxy image url>",
            "width": 2048,
            "height": 2048,
            "content_type": "<generated image type>",
            "id": "<Discord image id>",
            "filename": "<generated image name>",
            "size": 7204115
        "timestamp": "2023-09-09T02:04:51.926000+00:00",
        "code": 200
  • 400 Bad Request

          "Required param targetMessageId is missing or empty"
          "Required param targetMessageId (<targetMessageId>) is not valid Discord message id"
          "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
  • 401 Unauthorized

        "error": "Unauthorized",
        "code": 401
  • 402 Payment Required

        "error": "Account has no subscription or subscription expired",
        "code": 402
  • 404 Not Found

          "Unable to locate message <targetMessageId> is channel <channel>"
          "Unable to locate attachments for message <targetMessageId>"
        "code": 404
  • 429 Too Many Requests

    Wait in a loop for at least 10..30 seconds and retry again.

    There are two possible cases for API response 429.

    1. API query is full and can not accept new faceswap/inswapper requests.
       "error": "Unable to lock Discord after <attempts> attempts",
       "code": 429
    2. 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
{ // TypeScript, all fields are optional
  jobid: string, 
  verb: 'faceswap-inswapper',
  status: 'completed' | 'failed',
  targetMessageId: string,
  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 
  attachments: [
          id: string,
          content_type: string,
          filename: string,
          url: string,
          proxy_url: string,
          size: number,
          width: number,
          height: number
  timestamp: string,
  error: string,
  errorDetails: string,
  code: number
  • curl -H "Accept: application/json" \
         -H "Authorization: Bearer …" \
         -X POST \
         -F "channel=<Discord channel id>" \
         -F "targetMessageId=<Discord message id>" 
  • const main = async () => {
        const apiUrl = "";
        const token = "API token";
        const targetMessageId = "Discord message id";
        const channel = "Discord channel";
        const data = {
            method: 'POST',
            headers: {
                'Authorization': `Bearer ${token}`
        const formData = new FormData();
        formData.append("targetMessageId", targetMessageId);
        formData.append("channel", channel);
        data.body = formData;
        const response = await fetch(apiUrl, data);
        const result = await response.json();
        console.log("response", { response, result });
  • import requests
    api_url = ""
    token = "API token"
    targetMessageId = "Discord message id"
    channel = "Discord channel"
    headers = {
        'Authorization': f'Bearer {token}'
    files = {
        'targetMessageId': (None, targetMessageId),
        'channel': (None, channel)
    response =, headers=headers, files=files)
    print(response, response.json())
Try It