Vipsac API Documentation

The Vipsac API allows you to transcode standard images into highly optimized, native AVIF binaries.

Authentication

The API uses API keys for authentication. Pass your secret key in the HTTP header of all requests.

Endpoint: Transcode Image

Converts standard image formats (JPEG, PNG, WebP) into compressed, web-optimized AVIF files.

Request Details

Request Body

Field Name Type Required Description
image Binary File Yes The raw image file to be transcoded. Supports JPEG, PNG, and WebP.

Core Processing Behaviors

Code Examples

JavaScript / Node.js (Fetch API)

const formData = new FormData();
formData.append('image', imageFileBuffer);

const response = await fetch('https://api.vipsac.dev/v1/transcode/image', {
  method: 'POST',
  headers: {
    'X-API-Key': 'your_sk_live_key_here'
  },
  body: formData
});

if (response.ok) {
  const avifBuffer = await response.arrayBuffer();
  // Serve or upload to S3/R2
}

Python (Requests Library)

import requests

files = {'image': open('photo.jpg', 'rb')}
headers = {'X-API-Key': 'your_sk_live_key_here'}

response = requests.post('https://api.vipsac.dev/v1/transcode/image', headers=headers, files=files)

if response.status_code == 200:
    with open('optimized.avif', 'wb') as f:
        f.write(response.content)

Limits & Throttling

To ensure platform stability and prevent abuse, the following guardrails are strictly enforced:

1. Rate Limits (Token-Bucket)

2. File Size Limits by Tier

Payload sizes are evaluated at the edge. Any payload exceeding the absolute maximum of 30MB is dropped immediately.

Subscription Tier Maximum File Size
Starter 10 MB
Growth 20 MB
Pro 30 MB

3. Concurrency & Queueing

4. Dimensional Limits (Anti-Bomb Protection)

To protect the processing cores against malicious decompression bombs (e.g., heavily compressed files that expand to massive resolutions), the engine enforces a strict dimensional ceiling.

Any image with a width or height exceeding 5000 pixels will be instantly rejected with a 400 Bad Request before being allocated to memory.

Response Codes

Success (200)

Status Code Type Description
200 OK image/avif Returns the raw AVIF binary bytes directly in the response body.

Client Errors (4xx)

Status Code Type Description
400 Bad Request Standard Error The image file/dimensions are corrupted, or the file size exceeds your tier's limit.
401 Unauthorized Standard Error The X-API-Key header is missing, invalid, or expired.
402 Payment Required Standard Error The subscription attached to the API key has expired.
429 Too Many Requests Standard Error Rate limit exceeded. The sustained limit of 5 req/sec has been tripped.

Server Errors (5xx)

Status Code Type Description
503 Service Unavailable Standard Error Temporary server overload, or the concurrency queue is full. Retrying after a short delay is recommended.