API Reference/REST API

REST API

Integrate Thumbfa.st into any application using the REST API

The Thumbfa.st API lets you integrate thumbnail generation into any application.

Base URL: https://thumbfa.st/api/v1

Authentication

All requests require an API key in the Authorization header:

Authorization: Bearer tf_your_api_key_here

Get your API key from Settings → Developer in your dashboard.

Tool Discovery

List All Tools

GET /api/v1/tools

Returns all available tools with their schemas.

Response:

{
  "tools": [
    {
      "name": "generate_thumbnail",
      "description": "Generate YouTube thumbnails from a text prompt",
      "category": "generation",
      "endpoint": "/api/v1/tools/generate_thumbnail",
      "method": "POST",
      "meta": {
        "creditCost": 1,
        "rateLimit": 10
      }
    }
  ],
  "totalCount": 21
}

Making Requests

Tool Execution

All tools are available at:

POST /api/v1/tools/{toolName}

Example: Generate a thumbnail

curl -X POST https://thumbfa.st/api/v1/tools/generate_thumbnail \
  -H "Authorization: Bearer tf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A YouTuber looking shocked at their laptop",
    "count": 2,
    "model": "gemini"
  }'

Response:

{
  "success": true,
  "data": {
    "promptId": "prompt_abc123",
    "generationId": "gen_xyz789",
    "count": 2,
    "message": "Generating 2 thumbnail(s). Use get_generation_status to check progress."
  }
}

Error Handling

All errors follow this format:

{
  "success": false,
  "error": "Human-readable error message",
  "code": "ERROR_CODE",
  "details": {}
}

Common Error Codes

CodeHTTP StatusDescription
UNAUTHORIZED401Invalid or missing API key
FORBIDDEN403No permission for this resource
NOT_FOUND404Resource not found
VALIDATION_ERROR400Invalid request body
INSUFFICIENT_CREDITS400Not enough thumbnails
RATE_LIMITED429Too many requests
INTERNAL_ERROR500Server error

Rate Limits

PlanRequests/minute
Free10
Pro60
Enterprise300

Rate limit headers are included in responses:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1706526000

Code Examples

Node.js / TypeScript

const response = await fetch(
  "https://thumbfa.st/api/v1/tools/generate_thumbnail",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer tf_your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      prompt: "A YouTuber looking shocked",
      count: 2,
      model: "gemini",
    }),
  },
);

const result = await response.json();
console.log(result.data.generationId);

Python

import requests

response = requests.post(
    "https://thumbfa.st/api/v1/tools/generate_thumbnail",
    headers={
        "Authorization": "Bearer tf_your_api_key",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "A YouTuber looking shocked",
        "count": 2,
        "model": "gemini",
    },
)

result = response.json()
print(result["data"]["generationId"])

cURL

curl -X POST https://thumbfa.st/api/v1/tools/generate_thumbnail \
  -H "Authorization: Bearer tf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A YouTuber looking shocked",
    "count": 2,
    "model": "gemini"
  }'

Thumbnail Costs

OperationCost
Generate thumbnail1 thumbnail per image
Create inspiration0.1 thumbnails
Upload image (with AI description)0.05 thumbnails
Enhance prompt0.1 thumbnails

Check your balance anytime:

curl https://thumbfa.st/api/v1/tools/get_credits \
  -H "Authorization: Bearer tf_your_api_key"

Webhooks (Coming Soon)

Receive notifications when thumbnails are generated. Contact support if you need early access.

Next Steps