Getting Started with TomYaYa API

API 5 min read Updated November 2024

Automate media management tasks using TomYaYa's powerful API.

Overview

TomYaYa's API allows you to:

  • Integrate compression into your workflows
  • Automate duplicate detection
  • Build custom applications
  • Process files in batch via command line

Authentication

All API requests require an API key. Generate one in TomYaYa:

  1. Open TomYaYa Settings
  2. Go to API Keys
  3. Click "Generate New Key"
  4. Copy and store your key securely
Important: Keep your API key secret. Never commit it to version control or share it publicly.

Quick Start

Making Your First Request

Test your API key with a simple request:

curl -X GET "http://localhost:9090/api/status" \
  -H "Authorization: Bearer YOUR_API_KEY"

Successful response:

{
  "status": "ok",
  "version": "1.0.0",
  "uptime": 3600
}

Compress a File

curl -X POST "http://localhost:9090/api/compress" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "/path/to/image.jpg",
    "output": "/path/to/output.avif",
    "quality": 75
  }'

Find Duplicates

curl -X POST "http://localhost:9090/api/scan" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "paths": ["/path/to/folder"],
    "recursive": true
  }'

Response Format

All responses are JSON with this structure:

{
  "success": true,
  "data": { ... },
  "error": null
}

Error responses:

{
  "success": false,
  "data": null,
  "error": {
    "code": "INVALID_INPUT",
    "message": "Input file not found"
  }
}

Rate Limits

  • Free tier: 100 requests/hour
  • Pro tier: 1,000 requests/hour
  • Business tier: Unlimited

Next Steps