This is the hands-on companion to our complete API guide. If you want to know exactly how to integrate a background removal API — from zero to a working, production-ready call — this walkthrough takes you through every step using the AutoBackgrounding API (from 5¢ per image).
Prerequisites
- A server-side environment (Node.js, Python, PHP, or anything that can make HTTPS requests).
- An AutoBackgrounding account and API key (covered in Step 1).
- A publicly accessible vehicle image URL, or a local file to upload.
Step 1: Get Your API Key
Sign up and open your dashboard to generate an API key. Keys are secret credentials — store them in an environment variable, never in source control or client-side code. Grab your key from the API pricing & docs page.
"tok-comment"># Store your key as an environment variable
AUTOBG_API_KEY=sk_live_your_key_hereStep 2: Authenticate
Every request includes an Authorization header with your key as a bearer token. That's the entire auth model — no OAuth dance, no signing.
Authorization: Bearer sk_live_your_key_here
Content-Type: application/jsonStep 3: Make Your First Call
Send a single vehicle image to POST /v1/process. Here it is in three languages — pick yours:
curl https:"tok-comment">//api.autobackgrounding.com/v1/process \
-H "Authorization: Bearer $AUTOBG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https:">//example.com/lot-photo.jpg",
"background": "studio_white"
}'Step 4: Handle the Response
The API responds with JSON. A successful result looks like this:
{
"id": "job_8f2a1c",
"status": "completed",
"output_url": "https:">//cdn.autobackgrounding.com/out/8f2a1c.png",
"credits_used": 1
}Read status first. If it's completed, use output_url. If it's failed, inspect the error and note that failed jobs consume zero credits.
Step 5: Download & Store the Output
Don't hotlink the returned URL in production — download the processed image and store it in your own bucket (S3, Vercel Blob, GCS, etc.), then reference your copy.
import { writeFile } from "node:fs/promises";
const img = await fetch(data.output_url);
const buffer = Buffer.from(await img.arrayBuffer());
await writeFile("./processed/8f2a1c.png", buffer);
"tok-comment">// Or upload the buffer to S3 / Vercel Blob hereStep 6: Error Handling & Retries
Production integrations must handle transient failures. Retry 5xx and 429 (rate limited) responses with exponential backoff; treat other 4xx codes as permanent. Use your own reference ID so retries stay idempotent.
async function processWithRetry(payload, attempts = 4) {
for (let i = 0; i < attempts; i++) {
const res = await fetch("https:">//api.autobackgrounding.com/v1/process", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AUTOBG_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
if (res.ok) return res.json();
"tok-comment">// Retry only on rate limit or server errors
if (res.status === 429 || res.status >= 500) {
const wait = 2 ** i * 500; "tok-comment">// 500ms, 1s, 2s, 4s
await new Promise((r) => setTimeout(r, wait));
continue;
}
"tok-comment">// Permanent error
throw new Error(`API error ${res.status}: ${await res.text()}`);
}
throw new Error("Exhausted retries");
}Next Steps
You now have a working, resilient single-image integration. From here:
- Processing a whole inventory? Move to the bulk / batch endpoint.
- Want push notifications instead of polling? Set up webhooks for async processing.
- Building in Node or Python specifically? Follow the Node.js or Python deep-dive.
Get your API key and the full endpoint reference on the API pricing & docs page — pricing starts at 5¢ per image.