Base URL https://aibrista.com. All requests and responses are JSON. Every request needs your API key:
Authorization: Bearer ab_live_…
Create keys on the API keys page. Never put a key in browser or mobile code: call Aibrista from your server.
GET /v1/styles.POST /v1/redesigns. It returns at once with status queued, and the credits are charged.redesign.completed webhook, or poll GET /v1/redesigns/{id} every few seconds. Generation usually takes 1–3 minutes.GET /v1/redesigns/{id} and host or show it.POST /v1/redesigns/{id}/edits. Each edit makes a new version.Available styles and their cost.
{"data": [{"id": "modern-saas", "name": "Modern SaaS", "category": "Tech", "description": "…",
"preview_url": null, "credit_cost": 10, "edit_credit_cost": 1}]}
Start a redesign. Returns 202 Accepted.
{
"url": "https://example.com", // required, the site to redesign
"style": "modern-saas", // required, a style id
"options": { // optional
"notes": "Target families, highlight booking",
"tone": "friendly",
"primary_color": "#0e7c66"
}
}
Status and, once completed, the latest HTML. Add ?version=2 for a specific version.
{"data": {"id": "6f1c…", "status": "completed", "url": "https://example.com", "style": "modern-saas",
"version": 1, "html": "<!doctype html>…", "error": null, "credits_charged": 10,
"versions": [{"version": 1, "instruction": null, "created_at": "…"}],
"created_at": "…", "completed_at": "…"}}
Statuses: queued → capturing → generating → completed, or failed (credits refunded, reason in error). During an edit the status is editing, then back to completed.
{"instruction": "Make the header darker and add a pricing section"}
Returns 202. If the change can't be applied, the previous version is kept, the edit is refunded, and error explains why.
Your recent redesigns (paginated, without HTML), and your credit balance with recent transactions.
Set your endpoint on the Webhooks page. We send redesign.completed, redesign.failed, redesign.edited and redesign.edit_failed, and retry failed deliveries up to 5 times.
POST /your/webhook
X-Aibrista-Event: redesign.completed
X-Aibrista-Signature: t=1792224000,v1=5f2c…
{"event": "redesign.completed", "data": { …same as GET /v1/redesigns/{id}, without html… }}
[$t, $v1] = sscanf($request->header('X-Aibrista-Signature'), 't=%d,v1=%s');
$expected = hash_hmac('sha256', $t.'.'.$request->getContent(), $secret);
$valid = hash_equals($expected, $v1) && abs(time() - $t) < 300;
{"error": {"code": "insufficient_credits", "message": "Not enough credits: 10 needed, 4 available."}}
401 unauthenticated: missing, wrong, or revoked key.402 insufficient_credits: top up on the billing page.422 validation_failed / invalid_request / style_not_found: check message and fields.404 not_found: the redesign doesn't exist or isn't yours.429 rate_limited: 60 requests per minute per key, 30 new redesigns per hour.The HTML is a complete, self-contained page. If you show it inside your app, serve it from a separate domain or with a Content-Security-Policy: sandbox allow-scripts header, so its scripts can't reach your app.