Random Image & Placeholder API logo
UtilitiesMAINTAINED1 token / call

Random Image & Placeholder API

Placeholder images as SVG with solid or gradient backgrounds, a label and automatic contrast text

Generate placeholder images as SVG — solid or gradient backgrounds, a centered label, and automatic contrast text. Pick exact colors and size, or use the random-color mode. Returns an SVG that drops straight into an <img> tag.

Every call needs an X-Api-Key header. A free key includes 500 tokens a month, no card required. 1 token per call, so the free plan covers about 500 calls a month.

No credit card requiredAccess to 125+ APIsCancel anytime
response.json
{
  "results": [
    {
      "id": 1,
      "title": "Example Title",
      "status": "Finished"
    }
  ],
  "meta": {
    "total": 1000,
    "page": 1
  }
}
Production Ready
Battle-tested infrastructure with a 99.9% uptime SLA. Rate limits are generous, responses are consistent.
Simple Integration
Standard REST + JSON. Works with any HTTP client. Copy-ready code snippets in 4 languages.
One Key, 125+ APIs
Your DataAndAPIs subscription unlocks every API on the platform — anime, finance, sports, and more.

Use cases for Random Image & Placeholder API

  • Fill image slots in mockups and prototypes with correctly sized placeholders.

  • Generate avatars and thumbnails with a label for demo data.

  • Test responsive layouts with placeholders of exact dimensions.

  • Produce coloured blocks for charts, legends and design tokens.

Random Image & Placeholder API endpoints

Every endpoint with its parameters and a real example response.

GETPlaceholder Image

https://api-random-image.dataandapis.com/v1/image

Query parameters

ParameterExample
bgccccccOptional
color333333Optional
gradienteeeeeeOptional
height400Optional
textHelloOptional
width600Optional

Example request

curl
curl "https://api-random-image.dataandapis.com/v1/image?bg=cccccc&color=333333&gradient=eeeeee&height=400&text=Hello&width=600" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const file = await client.randomImage.placeholderImage({
  bg: "cccccc",
  color: 333333,
  gradient: "eeeeee",
  height: 400,
  text: "Hello",
  width: 600,
}); // a Blob
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

file = client.random_image.placeholder_image(
    bg="cccccc",
    color=333333,
    gradient="eeeeee",
    height=400,
    text="Hello",
    width=600,
)  # bytes
Example response
<svg xmlns="http://www.w3.org/2000/svg" width="600" height="400" viewBox="0 0 600 400"><rect width="100%" height="100%" fill="#cccccc"/><text x="50%" y="50%" font-family="sans-serif" font-size="80" font-weight="600" fill="#333333" text-anchor="middle" dominant-baseline="central">600×400</text></svg>

GETRandom Image

https://api-random-image.dataandapis.com/v1/image/random

Query parameters

ParameterExample
gradienttrueOptional
height300Optional
width800Optional

Example request

curl
curl "https://api-random-image.dataandapis.com/v1/image/random?gradient=true&height=300&width=800" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const file = await client.randomImage.randomImage({
  gradient: true,
  height: 300,
  width: 800,
}); // a Blob
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

file = client.random_image.random_image(gradient=True, height=300, width=800)  # bytes
Example response
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="300" viewBox="0 0 800 300"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#ff5733"/><stop offset="100%" stop-color="#3357ff"/></linearGradient></defs><rect width="100%" height="100%" fill="url(#g)"/></svg>

Where the data comes from

Source
Generated in the worker as SVG. Pure computation, no third-party image host.
Freshness
Generated on every call.

One install. Every endpoint.

Install the dataandapis package from npm or PyPI and call this API with typed methods, or use any HTTP client in the language you prefer.

4languages
2endpoints
RESTarchitecture
1key for all APIs
  • Typed parameters and responses, with auto-completion in your editor
  • For Node.js 18 or later and Python 3.9 or later, with no dependencies
  • One key works across 125+ APIs on the platform

Read the npm package guide →Read the Python package guide →

// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const file = await client.randomImage.placeholderImage({
  bg: "cccccc",
  color: 333333,
  gradient: "eeeeee",
  height: 400,
  text: "Hello",
  width: 600,
}); // a Blob

Random Image & Placeholder API · X-Api-Key

Explore the endpoints

Browse request parameters and inspect live example responses.

Available Endpoints

Request Parameters

API URL

Headers

X-Api-Key

Query Parameters

bg(Optional)
color(Optional)
gradient(Optional)
height(Optional)
text(Optional)
width(Optional)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis({ apiKey: "YOUR_API_KEY" });

const file = await client.randomImage.placeholderImage({
  bg: "cccccc",
  color: 333333,
  gradient: "eeeeee",
  height: 400,
  text: "Hello",
  width: 600,
}); // a Blob

One subscription. Every API.

Tokens unlock this API and 125+ others on DataAndAPIs. Switch APIs any time — we promote.

FREE

$0/mo

500 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Community support
Start free
Most Popular

STARTER

$6.99/mo

25,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Email support
Subscribe

PRO

$24.99/mo

100,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Priority email support
Subscribe

ULTRA

$99.99/mo

1,000,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Priority support
Subscribe

Need higher volume, dedicated infra, or a custom contract? Talk to sales →

Questions about Random Image & Placeholder API

Ship Random Image & Placeholder API this afternoon.

500 free tokens. No card. Plus 125+ other APIs on the same key.