Static Ads Lab
Concepts

Images

Uploaded assets — product photos, brand logos, lifestyle imagery — used during ad generation.

An image is an uploaded visual asset in your workspace. Images are referenced by ID from brands (logos), product variants (product photos), and ad outputs.

Mental model

You upload an image once and reference it by img_… ID elsewhere. The API processes uploads through a pipeline: extracts metadata, generates three thumbnail sizes (small, medium, large) in WebP, uploads to R2 storage, and returns URLs. Optional background enrichment runs after the upload returns.

ID prefix: img_.

Fields

FieldTypeDescription
idstringimg_…
srcstringPublic CDN URL of the original
width / heightnumberPixel dimensions
formatstringpng, jpeg, webp, gif
size_bytesnumberFile size in bytes
alt_textstring | nullAccessibility text
image_typestring | nullSemantic label (e.g., product, logo, lifestyle)
is_ai_generatedbooleanFlag for AI-produced assets
logo_themestring | nulllight or dark for logos
product_idstring | nullOptional product association
thumbnail_small_src / thumbnail_medium_src / thumbnail_large_srcstring | nullPre-rendered WebP thumbnails
created_at / updated_atstringISO timestamps

Endpoints

MethodPathPurpose
POST/v1/imagesUpload an image (multipart)
GET/v1/imagesList images
GET/v1/images/:idGet an image
DELETE/v1/images/:idDelete an image

Common patterns

Upload an image

Uploads are multipart/form-data. Send the file under file.

import { readFile } from "node:fs/promises";

const buffer = await readFile("./hero.png");
const form = new FormData();
form.append("file", new Blob([buffer], { type: "image/png" }), "hero.png");
form.append("image_type", "product");

const response = await fetch("https://api.staticadslab.com/v1/images", {
  method: "POST",
  headers: { "X-API-Key": "YOUR_API_KEY" },
  body: form,
});
const { data } = await response.json();
console.log(data.id, data.src);
curl -s -X POST https://api.staticadslab.com/v1/images \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "file=@./hero.png" \
  -F "image_type=product"
import requests

with open("./hero.png", "rb") as f:
    response = requests.post(
        "https://api.staticadslab.com/v1/images",
        headers={"X-API-Key": "YOUR_API_KEY"},
        files={"file": ("hero.png", f, "image/png")},
        data={"image_type": "product"},
    )
print(response.json()["data"]["id"])

Pitfalls

  • Maximum body size is 15 MB (raw bytes). Compress aggressive PNG screenshots before upload.
  • The API never accepts base64 image data in JSON. Always upload binaries via multipart/form-data and reference by ID afterward.
  • Thumbnails may be null immediately after upload — they're generated as part of the upload pipeline. If you need them, re-fetch the image after a brief delay.

Prompt for your agent

Read https://www.staticadslab.com/docs/resources/images.mdx and write a function uploadImage(filePath, imageType) that returns the resulting image ID. Use multipart/form-data and the X-API-Key header.