Docs Menu

API Documentation

API tokens are authentication credentials that allow programmatic access to Problembo services. Use tokens to integrate our AI services into your applications, scripts, or workflows.

API Tokens Documentation

Overview

API tokens are authentication credentials that allow programmatic access to Problembo services. Use tokens to integrate our AI services into your applications, scripts, or workflows.

Getting Started

Creating a Token

  1. Log in to your Problembo account and navigate to the API
  2. Click the "Create Token" button
  3. Enter a descriptive name for your token
  4. Select an expiration period (or set "Never expires")
  5. Click "Create" to generate the token
  6. Important: Copy the token immediately - you won't be able to see it again!

Token Security

  • Never share tokens with other people
  • Don't add tokens to version control systems (Git, SVN, etc.)
  • Use environment variables to store tokens in applications
  • Regularly rotate tokens for improved security
  • Revoke compromised tokens immediately

API Usage

Base URL

https://problembo.com/apis/v1/client

Endpoints

  • POST /apis/v1/client/tasks - Create a new task
  • GET /apis/v1/client/tasks/{taskId} - Get task status and result

Authentication

Include your API token in the Authorization header of each request:

Authorization: Bearer YOUR_API_TOKEN

Request Structure

All task creation requests have a unified structure:

{
  "taskType": "task_type",
  "payload": {
    // task-specific parameters
  }
}

Getting JSON Examples

💡 Important: JSON examples for specific task types can be obtained directly in the interface of each service through the "Json for API" button. This is the easiest way to learn the correct request structure for the service you need.

Available Task Types

Main task types (taskType):

  • com.problembo.proto.SdImageClientTaskPr - Image generation
  • com.problembo.proto.VideoGenClientTaskPr - Video generation
  • com.problembo.proto.SongGenClientTaskPr - Music generation
  • com.problembo.proto.TtsGenClientTaskPr - Text-to-Speech synthesis
  • com.problembo.proto.UpscaleSimpleClientTaskPr - Image upscaling
  • com.problembo.proto.BgRemoveClientTaskPr - Background removal
  • com.problembo.proto.VideoEnhanceClientTaskPr - Video enhancement
  • and others

Request Examples

Creating a Task (POST)

Request:

curl -X POST https://problembo.com/apis/v1/client/tasks \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "taskType": "com.problembo.proto.SdImageClientTaskPr",
    "payload": {
      "base": {
        "prompt": "1girl, beautiful anime character",
        "negativePrompt": "nsfw, low quality",
        "imageQuantity": 1,
        "model": "SdModel_WaifuStudio_1",
        "aspectRatioPreset": "ASPECT_RATIO_VERTICAL_16_9",
        "performanceMode": "SD_IMAGE_GEN_MODE_SPEED"
      },
      "promptMode": "PromptMode_default"
    }
  }'

Response (successful creation):

{
  "taskCreated": {
    "taskId": "00331b93-31bd-4e33-b28c-cc46793a911f",
  }
}

Getting Result (GET)

Request:

curl -X GET https://problembo.com/apis/v1/client/tasks/00331b93-31bd-4e33-b28c-cc46793a911f \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response (task in progress):

{
  "taskId": "00331b93-31bd-4e33-b28c-cc46793a911f",
  "status": "EXECUTING",
  "ready": false
}

Response (task completed successfully):

{
  "taskId": "00331b93-31bd-4e33-b28c-cc46793a911f",
  "status": "END_SUCCESS",
  "ready": true,
  "completedAt": "2025-11-04T07:14:33Z",
  "result": {
    "@type": "type.googleapis.com/com.problembo.proto.SdImageClientTaskPr.Result",
    "taskResult": [
      {
        "origFilename": "problembo-result-20251104071432.jpg",
        "url": "https://prbo.gateway.storjshare.io/910e1b85-4677-49d4-abd3-41218733ab60.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&..."
      }
    ]
  }
}

Response (execution error):

{
  "taskId": "00331b93-31bd-4e33-b28c-cc46793a911f",
  "status": "END_ERR",
  "ready": true,
  "error": {
    "errorKey": "SD_PROMPT_NOT_SAFE",
    "text": "Prompt contains unsafe content"
  }
}

Task Statuses

A task can be in one of the following statuses:

  • PENDING - Task created and awaiting processing
  • ASSIGN_TO_WORKER - Task being assigned to worker
  • EXECUTING - Task is executing
  • END_SUCCESS - Task completed successfully
  • END_ERR - Task completed with error
  • END_TIMEOUT - Execution timeout exceeded

The ready field indicates whether the task is completed (regardless of result).

Complete Workflow

Typical API workflow scenario:

# 1. Create task
TASK_ID=$(curl -X POST https://problembo.com/apis/v1/client/tasks \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"taskType": "...", "payload": {...}}' \
  | jq -r '.taskCreated.taskId')

echo "Task ID: $TASK_ID"

# 2. Poll status
while true; do
  RESPONSE=$(curl -s https://problembo.com/apis/v1/client/tasks/$TASK_ID \
    -H "Authorization: Bearer $API_TOKEN")

  STATUS=$(echo $RESPONSE | jq -r '.status')
  READY=$(echo $RESPONSE | jq -r '.ready')

  echo "Status: $STATUS"

  if [ "$READY" = "true" ]; then
    if [ "$STATUS" = "END_SUCCESS" ]; then
      echo "Task completed successfully!"
      echo $RESPONSE | jq '.result'
    else
      echo "Task failed!"
      echo $RESPONSE | jq '.error'
    fi
    break
  fi

  sleep 5
done

Token Management

Token Naming

Give tokens meaningful names to identify their purpose:

  • production-server
  • development-testing
  • mobile-app-v2

Expiration Settings

Choose appropriate expiration based on your use case:

  • 30 days: Testing and development
  • 90 days: Short-term projects
  • 1 year: Long-term applications
  • Never expires: Critical infrastructure (rotate manually)

Token Status

Tokens can have the following statuses:

  • Active: Token is valid and can be used
  • Disabled: Temporarily disabled, can be re-enabled
  • Expired: Expiration period passed, cannot be used
  • Revoked: Permanently invalidated

Rate Limiting

API uses distributed rate limiting to protect against overload:

Endpoint Limits

  • POST /apis/v1/client/tasks: 15 requests per 60 seconds
  • GET /apis/v1/client/tasks/{id}: 120 requests per 60 seconds

Rate Limit Response

When you exceed the limit, you'll receive HTTP status 429 Too Many Requests:

HTTP/1.1 429 Too Many Requests
Retry-After: 60
Content-Type: application/json

{
  "error": "rate_limit_exceeded"
}

The Retry-After header indicates how many seconds to wait before retrying.

Note: Rate limiting may be disabled by default. Check current limits with support.

Error Codes

HTTP Status Codes

  • 200 OK - Request processed successfully
  • 400 Bad Request - Invalid request or validation error
  • 401 Unauthorized - Invalid or missing token
  • 404 Not Found - Task not found
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Internal server error

Task Error Codes (errorKey)

When task execution fails, the response will contain an error field with an error code:

Access and Billing Errors

  • BILLING_ACCESS_DENIED - Insufficient balance
  • IP_BILLING_ACCESS_DENIED - IP address blocked
  • IP_BAN - IP address banned
  • ANONYMOUS_USER - Authentication required
  • NOT_PAID_USER - Feature available only to paid users

Validation Errors

  • PARSE_TASK - JSON request parsing error
  • INVALID_INPUT_FILE - Invalid input file
  • SD_EMPTY_PROMPT - Empty prompt
  • SD_PROMPT_TOO_LONG - Prompt too long
  • SD_NO_LATIN_PROMPT - Prompt must be in Latin characters
  • SD_PROMPT_NOT_SAFE - Prompt contains unsafe content

Limits

  • MAX_PARALLEL_TASKS_PER_IP - Parallel tasks per IP limit exceeded
  • MAX_TASKS_PER_USER - User tasks limit exceeded

System Errors

  • SERVICE_DISABLED - Service temporarily disabled
  • MAINTENANCE - Maintenance in progress
  • BUSY - System overloaded
  • TIMEOUT - Task execution timeout exceeded
  • NOT_FOUND - Task not found
  • UNKNOWN_ERROR - Unknown error

Best Practices

  1. Use separate tokens for different applications or environments
  2. Set appropriate expiration periods for your use case
  3. Implement polling with reasonable intervals (3-5 seconds recommended)
  4. Handle all possible task statuses in your code
  5. Implement retry logic with exponential backoff for rate limiting
  6. Check balance before sending large numbers of tasks
  7. Cache results when possible to avoid redundant requests
  8. Handle errors gracefully - log errorKey for debugging
  9. Monitor token usage in the statistics section

Troubleshooting

Token Not Working

  • Ensure the token is active and not expired
  • Check the header format is correct: Authorization: Bearer TOKEN
  • Ensure the account has sufficient credits
  • Check that the token starts with prefix pbo_pat_

401 Unauthorized Error

Possible causes:

  • Token is invalid, expired, or revoked
  • Incorrect Authorization header format
  • Extra spaces or characters in token
  • Token not copied completely

Solution:

# Correct
curl -H "Authorization: Bearer pbo_pat_..."

# Incorrect
curl -H "Authorization: pbo_pat_..."  # missing "Bearer"
curl -H "Authorization: Bearer  pbo_pat_..."  # double space

429 Too Many Requests Error

You've exceeded the rate limit.

Solution:

  1. Wait for the time specified in Retry-After header
  2. Implement exponential backoff between retries
  3. Optimize task status polling frequency
  4. Use batching for bulk operations

BILLING_ACCESS_DENIED Error

Insufficient balance.

Solution:

  1. Check balance in your account
  2. Top up balance
  3. Ensure correct pricing plan is selected

SD_PROMPT_NOT_SAFE Error

Prompt contains unsafe or prohibited content.

Solution:

  1. Check prompt for prohibited words
  2. Use more neutral phrasing
  3. Contact support if you believe the prompt is appropriate

Task Stuck in EXECUTING Status

Task is taking longer than usual.

Solution:

  1. Continue polling status - some tasks can take 5-10 minutes
  2. Check system status on monitoring page
  3. If task doesn't complete after 15 minutes, contact support with taskId

Examples in Other Languages

JavaScript/TypeScript

const API_TOKEN = "pbo_pat_your_token";
const BASE_URL = "https://problembo.com/apis/v1/client/tasks";

const headers = {
  "Authorization": `Bearer ${API_TOKEN}`,
  "Content-Type": "application/json"
};

// Create task
async function createTask() {
  const response = await fetch(BASE_URL, {
    method: "POST",
    headers,
    body: JSON.stringify({
      taskType: "com.problembo.proto.SdImageClientTaskPr",
      payload: {
        base: {
          prompt: "beautiful landscape",
          imageQuantity: 1,
          model: "SdModel_XL_anime"
        }
      }
    })
  });

  const data = await response.json();
  return data.taskCreated.taskId;
}

// Poll status
async function waitForTask(taskId: string) {
  while (true) {
    const response = await fetch(`${BASE_URL}/${taskId}`, { headers });
    const data = await response.json();

    console.log(`Status: ${data.status}`);

    if (data.ready) {
      return data;
    }

    await new Promise(resolve => setTimeout(resolve, 5000));
  }
}

// Usage
const taskId = await createTask();
console.log(`Task created: ${taskId}`);

const result = await waitForTask(taskId);
if (result.status === "END_SUCCESS") {
  console.log("Success!", result.result);
} else {
  console.log("Failed!", result.error);
}

Support

Need help? Contact our support team:


Last updated: November 2025