API Reference

Complete documentation for integrating Fallback.pics into your applications

Base URL

https://fallback.pics/api/v1

All API endpoints are relative to this base URL. No authentication required!

Quick Start

Basic Image

/400x300 Basic

Custom Colors

/400x300/FF6B6B/FFFFFF Colors

With Text

/400x300?text=Hello Text

URL Structure

Standard Format

/[width]x[height][.format][/bgColor][/textColor][?params]

Components:

width 10-4000 pixels
height 10-4000 pixels
format svg, png, jpg, webp
colors Hex without #

Preset Format

/[preset]/[...parameters]

Available Presets:

square
avatar
banner
skeleton
blur
ai
animated
chart

Query Parameters

Customize your images with these optional parameters

Parameter Type Description Example
bg / bgColor string Background color (hex or CSS) ?bg=FF0000
fg / textColor string Text/foreground color ?fg=FFFFFF
text / label string Custom text (+ for spaces) ?text=Hello+World
font string Font family name ?font=roboto
fontSize number Font size in pixels ?fontSize=24
retina number Retina multiplier (2 or 3) ?retina=2
context string AI context (with /ai preset) ?context=tech
mood string AI mood (with /ai preset) ?mood=minimal
reducedMotion boolean Disable animations ?reducedMotion=true

Interactive Examples

Product Card

/600x400/gradient?text=Product+Image
Product Card

User Avatar

/avatar/200?text=JD
User Avatar

Loading State

/animated/skeleton/400x300
Loading State

Dashboard Chart

/chart/bar/600x400
Dashboard Chart

Code Examples

HTML

<!-- Basic -->
<img src="https://fallback.pics/api/v1/400x300">

<!-- Custom -->
<img src="https://fallback.pics/api/v1/600x400/3B82F6/FFFFFF?text=Product">

<!-- Avatar -->
<img src="https://fallback.pics/api/v1/avatar/100?text=JD">

CSS

.hero {
  background: url('https://fallback.pics/api/v1/1920x1080');
}

.avatar {
  background: url('https://fallback.pics/api/v1/avatar/200');
}

JavaScript

function getPlaceholder(w, h, opts = {}) {
  const base = 'https://fallback.pics/api/v1';
  let url = `${base}/${w}x${h}`;
  
  const params = new URLSearchParams();
  if (opts.text) params.append('text', opts.text);
  if (opts.bg) params.append('bg', opts.bg);
  
  return params.toString() 
    ? `${url}?${params}` 
    : url;
}

React

const Placeholder = ({w, h, text}) => {
  const url = `https://fallback.pics/api/v1/${w}x${h}`;
  const params = text ? `?text=${text}` : '';
  
  return <img src={`${url}${params}`} />;
};

Response Headers

Content-Type

image/svg+xml
image/png
image/jpeg
image/webp

Cache-Control

public, max-age=31536000

Images cached for 1 year

CORS

Access-Control-Allow-Origin: *

Available from any origin

No Rate Limits!

Free forever. No authentication required.

Unlimited Requests

No daily or monthly limits

No API Keys

Start using immediately

All Features

Everything included free