Skip to content

Placeholder

The /placeholder endpoint generates SVG placeholders: simple images or animated skeleton loaders.

Parameters

ParameterRequiredDescriptionDefault
typeYesimage or skeleton
widthNoWidth in pixels (1–4000)800
heightNoHeight in pixels (1–4000)600
bgNoBackground color (hex)#cccccc / #e5e5e5
colorNoText / highlight color (hex)#333333 / #f5f5f5
textNoDisplayed text (image only)800×600
rowsNoNumber of lines (skeleton only, 0–20)3
avatarNoAvatar shape: circle, rounded, square or true
linesNoText lines next to avatar (skeleton only)2
animateNoAnimation: shimmer, pulse, noneshimmer
speedNoAnimation speed (0.1–10)1.5
radiusNoBorder radius of blocks (0–50)4

Good to know

The bg and color defaults differ between types: image uses #cccccc/#333333, skeleton uses #e5e5e5/#f5f5f5.

Response

The response is an image/svg+xml file for both types.

Code Examples

curl -X GET \
  "https://api.sylvain.sh/v4/placeholder?type=image&width=400&height=300&text=Hello"

Try It

Error Handling

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
Type must be one of: image, skeletonThe type parameter is invalid
width must be a numberWidth is not a valid number
width must be between 1 and 4000Width is out of range
Invalid color (use hex like #ff6600)A color parameter is malformed
avatar must be one of: circle, rounded, squareInvalid avatar shape
animate must be one of: shimmer, pulse, noneInvalid animation mode
speed must be between 0.1 and 10Speed is out of range
radius must be between 0 and 50Radius is out of range