Create or update Pika account information

Table of contents

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

For your convenience, you can specify your Pika configuration values under your account. If you specify multiple Pika accounts, the API will automatically perform load balancing by randomly selecting an account with available capacity before making calls to Discord / Pika.

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

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

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

  • maxJobs is required. Currently, it should be between 1 and 10.

Responses
  • 204 No Content

  • 400 Bad Request

    {
      "error": 
        "Required param discord is missing or empty"
        "Required param channel is missing or empty"
        "Required param channel (<channel>) is not valid Discord channel id"
        "Required param channel (<channel>) not matching to /pika/account/<channel>"
        "Required param maxJobs is missing or empty"
        "Required param maxJobs <maxJobs> can't be more that <maxConcurrentJobs>"
        "Channel <channel> configuration has same discord value"
      "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
Model
{ // TypeScript, all fields are optional
  discord: string, 
  channel: string,
  maxJobs: number,
  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/pika/account/<channel> \
         -d '{"discord": "…", "channel": "…", "maxJobs": …}'
    
  • const channel = "Discord channel id";      
    const apiUrl = `https://api.useapi.net/v1/pika/account/${channel}`; 
    const token = "API token";
    const discord = "Discord token";
    const maxJobs = 10;
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      discord, channel, maxJobs
    });
    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/pika/account/{channel}" 
    token = "API token"
    discord = "Discord token"
    maxJobs = 10
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    body = {
        "discord": f"{discord}", 
        "channel": f"{channel}",
        "maxJobs": maxJobs
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It