QUICKSTART

Your first erase.

Create a key, send an image, and fetch the result. Production runs the real Modal LaMa + detection pipeline.

1. Create an API key

Open the API keys page, create a key with the erase:write scope, and copy it once. Store it in an environment variable or secret manager.

Shell
export ERASA_KEY="erasa_live_..."

2. Send an image

Use multipart for a direct upload, or JSON with an HTTPS URL.

cURL — multipart
curl https://api.erasa.app/v1/erase \
  -H "Authorization: Bearer $ERASA_KEY" \
  -H "Idempotency-Key: quickstart-001" \
  -F image=@street.jpg \
  -F prompt="power lines" \
  -F model=fast
JSON
{
  "image_url": "https://example.com/street.jpg",
  "prompt": "power lines",
  "model": "fast"
}

3. Read the result

200 OK
{
  "id": "job_01J...",
  "status": "succeeded",
  "model": "mock-fast",
  "output": {
    "url": "https://api.erasa.app/api/files/...?exp=...&sig=...",
    "format": "png",
    "width": 4032,
    "height": 3024
  },
  "credits": { "reserved": 2, "charged": 2 },
  "latency_ms": 1840,
  "request_id": "req_01J..."
}

Poll GET /v1/jobs/{id} if the request returns 202, or use a webhook when it is available.

Node

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

const form = new FormData();
form.set("image", new Blob([await readFile("street.jpg")]), "street.jpg");
form.set("prompt", "power lines");
form.set("model", "fast");

const res = await fetch("https://api.erasa.app/v1/erase", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ERASA_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: form,
});

const job = await res.json();

Python

Python
import os, requests

with open("street.jpg", "rb") as image:
    res = requests.post(
        "https://api.erasa.app/v1/erase",
        headers={
            "Authorization": f"Bearer {os.environ['ERASA_KEY']}",
            "Idempotency-Key": "quickstart-001",
        },
        files={"image": image},
        data={"prompt": "power lines", "model": "fast"},
        timeout=60,
    )

job = res.json()
Credits are reserved before the provider runs. A failed job releases the reservation; a successful job commits the charge. A retry with the same key never charges twice.