API Documentation
The Photova API provides powerful AI image editing capabilities through a simple REST interface. Background removal, upscaling, restoration, colorization, and more.
Quick Start
Create an account to get your API key, then make your first request in seconds.
Installation
Self-host the Photova API on your own infrastructure. Requires PHP 8.2+ and PostgreSQL.
Requirements
- PHP 8.2 or higher
- Composer
- PostgreSQL 14+ (or Docker)
- At least one AI provider API key (Replicate, fal.ai, or remove.bg)
Quick Start with Docker
The fastest way to get started using Docker for PostgreSQL:
# Clone the repository
git clone https://github.com/phishy/photova.git
cd photova
# Start PostgreSQL via Docker
docker compose up postgres -d
# Setup Laravel
cd packages/photova-api
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate
# Start the server
php artisan serve
Environment Variables
Configure your .env file with the following:
| Variable | Description |
|---|---|
DB_CONNECTION |
Database driver (pgsql) |
DB_HOST |
Database host (default: 127.0.0.1) |
DB_DATABASE |
Database name |
AUTH_ENABLED |
Enable API key auth (true/false) |
REPLICATE_API_KEY |
Replicate API key (recommended) |
FAL_API_KEY |
fal.ai API key (optional) |
REMOVEBG_API_KEY |
remove.bg API key (optional fallback) |
Provider Configuration
Configure which provider handles each operation in config/photova.php:
'operations' => [
'background-remove' => [
'provider' => 'replicate',
'fallback' => 'removebg', // Optional fallback
],
'upscale' => ['provider' => 'replicate'],
'unblur' => ['provider' => 'replicate'],
'colorize' => ['provider' => 'replicate'],
'inpaint' => ['provider' => 'replicate'],
'restore' => ['provider' => 'replicate'],
],
Storage Configuration
Configure asset storage buckets in config/photova.php. Each bucket can use a different storage backend.
Available Disks
| Disk | Path | Description |
|---|---|---|
local |
storage/app/private | Private storage, served through API only |
public |
storage/app/public | Public storage, directly accessible via URL |
s3 |
S3 bucket | S3-compatible storage (AWS, MinIO, R2) |
Multiple Buckets Example
'storage' => [
'default' => 'assets',
'buckets' => [
'assets' => [
'disk' => 'local', // Private, API-only access
'path' => 'assets',
],
'thumbnails' => [
'disk' => 'public', // Direct URL access
'path' => 'thumbs',
],
'cloud' => [
'disk' => 's3', // S3-compatible storage
'path' => 'uploads',
],
],
],
S3 Environment Variables
To use the s3 disk, configure these in your .env:
# AWS S3
AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=my-bucket
# For MinIO or other S3-compatible services
AWS_ENDPOINT=http://localhost:9000
AWS_USE_PATH_STYLE_ENDPOINT=true
Using Buckets
Specify which bucket to use with the bucket query parameter:
# Upload to default bucket
curl -X POST /api/assets -F 'file=@image.png'
# Upload to specific bucket
curl -X POST /api/assets?bucket=cloud -F 'file=@image.png'
# List assets in bucket
curl /api/assets?bucket=cloud
You're all set!
Your API is now running at http://localhost:8000. Create an account and API key to start making requests.
Authentication
All API requests require authentication using an API key. You can create and manage your API keys from the Dashboard.
Include your API key in the Authorization header using the Bearer scheme:
Authorization: Bearer br_live_xxxxx
Alternatively, you can use the X-API-Key header:
X-API-Key: br_live_xxxxx
Base URL
All API requests should be made to:
https://api.photova.app
Errors
The API uses conventional HTTP response codes to indicate success or failure.
| Code | Description |
|---|---|
200 |
Success |
400 |
Bad Request - Invalid parameters |
401 |
Unauthorized - Invalid or missing API key |
429 |
Rate limited - Too many requests |
500 |
Server error |
Error responses include a JSON body with details:
{
"error": "Invalid API key",
"requestId": "req_abc123"
}
Operations
AI-powered image processing endpoints
/v1/background-remove
Background Removal
Remove the background from an image, returning a transparent PNG.
Request Body
| Parameter | Type | Description |
|---|---|---|
image * |
string | Base64 encoded image (data URI) |
Example Request
curl -X POST https://api.photova.app/v1/background-remove \
-H 'Authorization: Bearer br_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{"image": "data:image/png;base64,..."}'
Response
{
"image": "data:image/png;base64,...",
"metadata": {
"provider": "replicate",
"processingTime": 1234,
"requestId": "req_abc123"
}
}
/v1/upscale
Upscale
Increase image resolution up to 4x using AI super-resolution.
Request Body
| Parameter | Type | Description |
|---|---|---|
image * |
string | Base64 encoded image (data URI) |
options.scale |
number | Scale factor: 2 or 4 (default: 2) |
Example Request
curl -X POST https://api.photova.app/v1/upscale \
-H 'Authorization: Bearer br_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{"image": "data:image/png;base64,...", "options": {"scale": 4}}'
/v1/restore
Restore
Restore old or damaged photos by fixing scratches, tears, and imperfections.
Request Body
| Parameter | Type | Description |
|---|---|---|
image * |
string | Base64 encoded image (data URI) |
Example Request
curl -X POST https://api.photova.app/v1/restore \
-H 'Authorization: Bearer br_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{"image": "data:image/png;base64,..."}'
/v1/colorize
Colorize
Add realistic color to black and white images using AI.
Request Body
| Parameter | Type | Description |
|---|---|---|
image * |
string | Base64 encoded image (data URI) |
Example Request
curl -X POST https://api.photova.app/v1/colorize \
-H 'Authorization: Bearer br_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{"image": "data:image/png;base64,..."}'
/v1/unblur
Deblur
Sharpen blurry images and restore clarity using AI deblurring.
Request Body
| Parameter | Type | Description |
|---|---|---|
image * |
string | Base64 encoded image (data URI) |
Example Request
curl -X POST https://api.photova.app/v1/unblur \
-H 'Authorization: Bearer br_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{"image": "data:image/png;base64,..."}'
/v1/inpaint
Object Removal (Inpaint)
Remove unwanted objects from images by providing a mask.
Request Body
| Parameter | Type | Description |
|---|---|---|
image * |
string | Base64 encoded image (data URI) |
options.mask |
string | Base64 mask image (white = remove) |
options.prompt |
string | Optional prompt for what to fill |
Example Request
curl -X POST https://api.photova.app/v1/inpaint \
-H 'Authorization: Bearer br_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{"image": "data:image/png;base64,...", "options": {"mask": "data:image/png;base64,..."}}'
Resources
Manage assets and track usage
Assets
Upload and manage images in your account storage.
/api/assets
Upload Asset
Upload an image to storage. Supports both file upload and base64.
curl -X POST https://api.photova.app/api/assets \
-H 'Authorization: Bearer br_live_xxxxx' \
-F 'file=@image.png'
/api/assets
List Assets
Retrieve a list of all uploaded assets.
/api/assets/{`{id}`}
Get Asset
Retrieve asset metadata. Add ?download=true to download the file.
/api/assets/{`{id}`}
Delete Asset
Permanently delete an asset.
Usage
Track your API usage and billing.
/api/usage/summary
Usage Summary
Get aggregated usage statistics for the current billing period.
{
"summary": {
"totalRequests": 1234,
"totalErrors": 12,
"averageLatencyMs": 856,
"byOperation": {
"background-remove": { "requests": 500, "errors": 5 },
"upscale": { "requests": 734, "errors": 7 }
}
}
}
/api/usage/current
Current Usage
Get current month usage against your plan limits.
{
"current": {
"used": 1234,
"limit": 10000,
"remaining": 8766
}
}
Need help? Contact support