Create or update InsightFaceSwap account information

Table of contents

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

Before you start using the API, you must configure at least one InsightFaceSwap Discord account. You may specify multiple InsightFaceSwap accounts, the API will automatically perform load balancing by randomly selecting an account with available credits before making calls to InsightFaceSwap Discord bot.

https://api.useapi.net/v1/faceswap/account/channel

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Request Body
{
    "discord": "Discord token",
    "server": "Discord server id",
    "channel": "Discord channel id"
}
  • discord, channel and server are required. Please see Setup InsightFaceSwap for details.

  • channel value specified in the request body must match the channel value specified in the URL path https://api.useapi.net/v1/faceswap/account/channel.

Responses
  • 204 No Content

  • 400 Bad Request

    {
      "error": 
        "Required param discord is missing or empty"
        "Required param server is missing or empty"
        "Required param channel is missing or empty"
        "Required param channel (<server>) is not valid Discord channel id"
        "Required param channel (<channel>) is not valid Discord channel id"
        "Required param channel (<channel>) not matching to /faceswap/account/<channel>"
        "Channel <channel> configuration has same discord value"
        "Channel <channel> configuration has same server value"
      "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
Model
{ // TypeScript, all fields are optional
  discord: string, 
  server: string,
  channel: string,
  error: string,
  errorDetails: string,
  code: number
}
Examples
  • curl -H "Accept: application/json" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer …" \
         -X POST https://api.useapi.net/v1/faceswap/account/<channel> \
         -d '{"discord": "…", "server": "…", "channel": …}'
    
  • const channel = "Discord channel id";      
    const apiUrl = `https://api.useapi.net/v1/faceswap/account/${channel}`; 
    const token = "API token";
    const discord = "Discord token";
    const server = "Discord server id";      
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      discord, server, channel
    });
    const response = await fetch(apiUrl, data);
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    channel = "Discord channel id"
    apiUrl = f"https://api.useapi.net/v1/faceswap/account/{channel}" 
    token = "API token"
    discord = "Discord token"
    server = "Discord server id"
    maxJobs = 10
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    body = {
        "discord": f"{discord}", 
        "server": f"{server}",
        "channel": f"{channel}"
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It