Documentation

VisionFly.ai API Documentation

Everything you need to deliver optimized images globally. Choose between our CDN for hosted images or Image API for on-the-fly transformations.

CDN API Overview

The VisionFly CDN is the recommended way to deliver images. Upload your images once, and serve them globally with on-the-fly transformations using simple URL parameters. No API key required for serving - just use the CDN URL.

Upload once, deliver everywhere
100+ Edge Locations
URL-based Transformations

Quick Start

  • 1. Get your API key

    Sign up at visionfly.ai/signup and generate your API key from the dashboard

  • 2. Upload an image

    POST your image to our upload endpoint with your API key

    # Upload an image to VisionFly CDN
    curl -X POST "https://api.visionfly.ai/cdn/upload" \
      -H "X-API-Key: YOUR_API_KEY" \
      -F "file=@/path/to/image.jpg" \
      -F "project=my-website"
    
    # Response:
    # {
    #   "imageId": "img_abc123xyz",
    #   "url": "https://img.visionfly.ai/img_abc123xyz",
    #   "size": 245000,
    #   "contentType": "image/jpeg"
    # }
  • 3. Serve with transformations

    Use the returned URL with query parameters for on-the-fly optimization

    # Serve an optimized image with transformations
    # No API key required - images are public via CDN
    
    # Basic usage - original image
    https://img.visionfly.ai/img_abc123xyz
    
    # Resize to 800px width, auto height
    https://img.visionfly.ai/img_abc123xyz?w=800
    
    # Resize and convert to WebP with 85% quality
    https://img.visionfly.ai/img_abc123xyz?w=800&h=600&f=webp&q=85
    
    # Apply blur and brightness adjustments
    https://img.visionfly.ai/img_abc123xyz?blur=10&bri=20

CDN API Reference

Base URL

https://api.visionfly.ai/cdn

CDN Delivery URL

https://img.visionfly.ai/{imageId}

No API key required for serving images - they are publicly accessible via CDN

POST
/upload

Upload an image to VisionFly CDN. Returns a unique image ID and CDN URL.

Request

Content-Type: multipart/form-data

file
Required

Image file (JPEG, PNG, WebP, GIF, AVIF, SVG)

project
Optional

Project name to organize images (creates project if doesn't exist)

GET
/images

List all images in your CDN library with pagination support.

project
Optional

Filter by project slug

limit
Optional

Number of images (1-100, default: 50)

cursor
Optional

Pagination cursor (last imageId from previous response)

DELETE
/images

Delete one or more images from CDN.

imageIds
Required

Array of image IDs to delete (max 50)

GET
/usage

Get storage, bandwidth, and project usage statistics.

Projects Management

Organize your images into projects for better management.

GET
/projects

List all projects

POST
/projects

Create a new project

PATCH
/projects

Update project name/description

DELETE
/projects

Delete a project

URL Transformation Parameters

Add these parameters to any CDN URL to transform images on-the-fly. Example: https://img.visionfly.ai/img_abc?w=800&f=webp&q=85

w
Optional

Width in pixels (1-4200)

h
Optional

Height in pixels (1-4200)

f
Optional

Output format: JPEG, PNG, WEBP, GIF, AVIF, AUTO (default: AUTO)

q
Optional

Quality (1-100, default: 80)

fit
Optional

Resize mode: FILL, CONTAIN, CROP (default: CONTAIN)

blur
Optional

Gaussian blur (0-100)

sharp
Optional

Sharpen strength (0-100)

bri
Optional

Brightness (-100 to 100)

con
Optional

Contrast (-100 to 100)

sat
Optional

Saturation (-100 to 100)

opt
Optional

Smart optimization (true/false)

Code Examples

# Upload an image to VisionFly CDN
curl -X POST "https://api.visionfly.ai/cdn/upload" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "file=@/path/to/image.jpg" \
  -F "project=my-website"

# Response:
# {
#   "imageId": "img_abc123xyz",
#   "url": "https://img.visionfly.ai/img_abc123xyz",
#   "size": 245000,
#   "contentType": "image/jpeg"
# }