OVERVIEW

API Reference

The Try Garage AI API lets you integrate AI-powered car transformation into any application. You can transform car photos by selecting styles, tires, and accessories — fully programmatically.

B2B Note: The API is designed for businesses embedding car visualization into their platforms. All requests are authenticated via API key and charged in Pixels.

Authentication

All API requests must include your API key in the request header:

HTTP Header
X-API-Key: YOUR_API_KEY

You can find your API key in the Dashboard → Embed & API section. Keep it secret — never expose it in client-side code.

Important: For widget and iFrame embeds, use scoped embed tokens (read-only, rate-limited). Full API keys should only be used server-side.

Base URL

Base URL
https://trygarage.net/api/v1

All endpoints below are relative to this base URL. The API uses HTTPS only.

Error Codes

HTTP StatusCodeDescription
401unauthenticatedMissing or invalid API key
400invalid-argumentMissing required fields or invalid values
402failed-preconditionInsufficient Pixels or expired balance
429resource-exhaustedDaily transform limit reached
500internalAll AI providers failed — retry in a moment
Error Response
{
  "error": {
    "code": "failed-precondition",
    "message": "Insufficient pixels. Current balance: 50, required: 200."
  }
}
POST /transform

Generate a photorealistic AI transformation of a car photo. This deducts Pixels from your balance automatically.

Request Body

JSON
{
  "carImageUrl": "https://storage.googleapis.com/...",  // REQUIRED — Firebase Storage URL
  "resolution":  "2K",                                   // "1K" | "2K" | "4K" (default: "1K")
  "style": {
    "name":          "Matte Black",    // "None" to skip
    "description":   "...",            // optional, improves accuracy
    "customImageUrl": null             // Firebase Storage URL of a custom swatch (optional)
  },
  "tire": {
    "name":          "Sport 19-inch",  // "None" to skip
    "description":   "...",
    "customImageUrl": null
  },
  "accessory": {
    "name":          "Rear Spoiler",   // "None" or "AI Choice" to skip
    "description":   "...",
    "customImageUrl": null
  }
}
carImageUrl must be a Firebase Storage URL. Upload the car image to transform_inputs/{uuid}.jpg in Firebase Storage first, then pass the download URL here. Any other URL is rejected for security reasons.

Response

200 OK
{
  "ok": true,
  "imageUrl": "https://firebasestorage.googleapis.com/v0/b/.../ai_proxy/..."
}

Pixel Cost

SelectionPixels
Style (paint / wrap)200 px
+ Tires+130 px
+ Accessories+130 px
+ 4K resolution+100 px
Full transform (all options + 4K)560 px

Example — cURL

cURL
curl -X POST https://trygarage.net/api/v1/transform \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "carImageUrl": "https://firebasestorage.googleapis.com/v0/b/YOUR_BUCKET/o/transform_inputs%2Fuuid.jpg?alt=media&token=...",
    "resolution": "2K",
    "style":     { "name": "Pearl White" },
    "tire":      { "name": "None" },
    "accessory": { "name": "None" }
  }'
GET /catalog

Retrieve all items in your catalog (styles, tires, accessories). You can filter by type.

Query Parameters

ParamTypeDescription
typestringstyles | tires | accessories (omit for all)
200 OK
{
  "ok": true,
  "catalog": {
    "styles": [
      { "name": "Matte Black", "thumbnailUrl": "...", "imageUrl": "...", "description": "..." },
      ...
    ],
    "tires": [ ... ],
    "accessories": [ ... ]
  }
}
GET /balance

Get the current Pixel balance and expiry information for the authenticated account.

200 OK
{
  "ok": true,
  "pixels": 4800,
  "expiryTimestamp": null,
  "totalTransformations": 12
}
POST /catalog/upload

Upload a custom item to your catalog. Items added here appear in the transform widget for your users.

multipart/form-data
name        : "Volcanic Red" 
description : "Deep metallic red with volcanic shimmer"
type        : "style"                     // "style" | "tire" | "accessory"
image       : [binary file data]          // JPEG/PNG, max 5MB

Widget Embed

The easiest way to add Try Garage AI to your website. One <script> tag renders a complete interactive widget.

HTML
<div id="trygarage-widget"></div>
<script
  src="https://trygarage.net/embed/widget.js"
  data-key="YOUR_EMBED_KEY"
  data-theme="dark"
  data-lang="en"
  data-primary-color="#ff4500"
  data-on-result="window.onGarageResult"
  defer
></script>

<script>
// Optional: receive the result image URL in your own JS
window.onGarageResult = function(resultUrl, metadata) {
  console.log('AI result:', resultUrl);
  console.log('Style used:', metadata.style);
};
</script>

iFrame Embed

For CMS platforms (WordPress, Shopify, Webflow) where custom JS is restricted, use the iFrame embed.

HTML
<iframe
  src="https://trygarage.net/embed/frame?key=YOUR_EMBED_KEY&theme=dark&lang=en"
  width="100%"
  height="700"
  frameborder="0"
  allow="camera; clipboard-write"
  loading="lazy"
  title="Try Garage AI — Car Visualizer"
></iframe>

Embed Configuration

ParameterTypeDefaultDescription
data-keystringRequired. Your embed API key
data-themedark | lightdarkWidget color theme
data-langen | fr | es | arenInterface language
data-catalogstringdefaultYour catalog ID (for custom catalogs)
data-primary-colorhex#ff4500Accent color override
data-on-resultcallbackJS global function called with result URL
data-hide-creditsbooleanfalseHide the "Powered by Try Garage AI" footer

Pixel Credits

Pixels are the credit currency used to pay for transformations. Each account starts with 330 free Pixels. Additional Pixels are purchased in packages.

Pixels are deducted per-transform based on the options selected:

OptionCost
Style (paint/wrap) — always charged if anything is selected200 px
Tires add-on130 px
Accessories add-on130 px
4K resolution add-on100 px
If no option is selected (style=None, tires=None, accessories=None), the cost is 0 and the transform is blocked.