Create or update Riffusion API account configuration

February 17, 2025

Table of contents

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

See Setup Riffusion for details.

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

https://api.useapi.net/v1/riffusion/accounts

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Request Body
{
    "cookie": "Riffusion cookie",
    "maxJobs": 1-10,
}
  • cookie is required. Please see Setup Riffusion for details.

  • maxJobs is required. Currently, it should be between 1 and 10.
    We recommend setting this value to 6.

Responses
  • 201 Created

    {
      "user_id": "b511d6f4-1e33-45c3-885d-0fa094dd5d70",
      "maxJobs": 6,
      "jwt": {
        "expires_at": 1781234765,
        "expires_in": 604800,
        "refresh_token": "…secured…",
        "access_token": "…secured…",
        "expires_at_UTC": "2025-04-18T12:50:45.000Z",
        "token_type": "bearer",
        "user": {
          "id": "b511d6f4-1e33-45c3-885d-0fa094dd5d70"
        }
      }
    }
    
  • 400 Bad Request

    {
      "error": "<Error message>",
      "code": 400
    }
    
Model
{ // TypeScript, all fields are optional
  user_id: string
  maxJobs: number
  jwt: {
    access_token: string
    token_type: string
    expires_in: number
    expires_at: number
    refresh_token: string
    expires_at_UTC: string
    user: {
      id: string
    }
  }
}
Examples
  • curl -H "Accept: application/json" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer …" \
         -X POST https://api.useapi.net/v1/riffusion/accounts \
         -d '{"cookie": "…", "maxJobs": …}'
    
  • const apiUrl = `https://api.useapi.net/v1/riffusion/accounts`; 
    const api_token = "API token";
    const cookie = "Riffusion cookie";      
    const maxJobs = 6;
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${api_token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      cookie, maxJobs
    });
    const response = await fetch(apiUrl, data);
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    apiUrl = f"https://api.useapi.net/v1/riffusion/accounts" 
    api_token = "API token"
    cookie = "Riffusion cookie"
    maxJobs = 6
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {api_token}"
    }
    body = {
        "cookie": f"{cookie}",
        "maxJobs": maxJobs
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It