{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["tabs","tab"]},"type":"markdown"},"seo":{"title":"Quickstart","description":"Generate and edit images and video with Bria's FIBO models through a REST API, Python SDK, MCP server and agent skills. Licensed training data, controllable output, provenance on every result.","siteUrl":"https://docs.bria.ai","image":"/assets/logo.4aab4827f8ef484ab0149a267109951af9b35a6e5d7ddacfc52a0cb2bf07aec6.db81178d.png","llmstxt":{"hide":false,"title":"Bria API documentation","description":"Bria's developer platform: controllable, commercially safe visual generative AI (images and video) as a REST API, Python SDK, MCP server and agent skills.","details":{"path":"_llmstxt-details.md"},"sections":[{"title":"Getting started","description":"First call, authentication, async jobs and webhooks, rate limits, inputs.","includeFiles":["index.md","getting-started/quickstart.md","getting-started/authentication.md","getting-started/async-requests.md","status.yaml","getting-started/rate-limits-and-errors.md","getting-started/working-with-images.md"]},{"title":"Integrate","description":"Python SDK, MCP server, agent skills, and machine-readable docs for agents.","includeFiles":["integration-methods/python-sdk.md","MCP-authentication.md","integration-methods/bria-skill.md","integration-methods/for-ai-agents.md"]},{"title":"Concepts","description":"Platform map, VGL and the FIBO models, safety, best practices.","includeFiles":["products-overview.md","VGL.md","safety.md","best-practices-overview.md","image-generation-best-practices.md","image-editing-best-practices.md","product-shots-best-practices.md"]},{"title":"Image Generation","description":"Generate images from text, reference images or structured (VGL) prompts with FIBO.","includeFiles":["image-generation-overview.md","image-generation.yaml"]},{"title":"Image Editing","description":"Instruction-based editing plus specialized endpoints for backgrounds, erasing, fill, expansion, upscaling and style.","includeFiles":["image-editing-overview.md","image-editing.yaml"]},{"title":"Product Shot Editing","description":"Cutouts, packshots, shadows, lifestyle scenes, product integration, holding, virtual try-on, automotive.","includeFiles":["product-shot-overview.md","product-shot-editing.yaml"]},{"title":"Video Editing","description":"Background removal (REST or real-time streaming), erasing, upscaling and masks for video; local video upload.","includeFiles":["video-editing-overview.md","local-video-upload-service.md","streaming-rmbg.md","video-editing.yaml"]},{"title":"Ad Delayer","description":"Turn a flat ad into editable layers; the guide holds the layer document contract.","includeFiles":["ad-delayer-overview.md","ad-delayer.yaml"]},{"title":"Trust and provenance","description":"Public verification of Bria provenance, and attribution of outputs to licensed training data.","includeFiles":["trust-and-provenance-overview.md","visual-verification-overview.md","visual-verification.yaml","enterprise/attribution.md","bria-attribution-service.yaml"]},{"title":"Enterprise","description":"Run Bria in your own cloud or on-premises.","includeFiles":["enterprise/deployment-options.md"]}],"excludeFiles":["_llmstxt-details.md","README.md"]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"quickstart","__idx":0},"children":["Quickstart"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this guide you will create an API token, generate an image, retrieve the result, and remove the background from an image. It takes about five minutes."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-get-an-api-token","__idx":1},"children":["1. Get an API token"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sign in to the Bria Console and create an API token. If you are already signed in, your token appears below. Free accounts can call every endpoint at a reduced ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/getting-started/rate-limits-and-errors"},"children":["rate limit"]},"."]},{"$$mdtype":"Tag","name":"div","attributes":{"class":"bria-token","data-bria-token":"true"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.bria.ai/organization-management/api-keys"},"children":["Get your API token"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Store the token in an environment variable:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export BRIA_API_TOKEN=\"<your-bria-api-token>\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every request authenticates with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api_token"]}," header. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/getting-started/authentication"},"children":["Authentication"]}," for details."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-generate-an-image","__idx":2},"children":["2. Generate an image"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Bria's v2 endpoints are asynchronous by default: the API accepts the job and returns a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request_id"]}," and a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status_url"]}," right away."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Save this as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["quickstart.py"]},". ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.astral.sh/uv/"},"children":["uv"]}," reads the dependency block below and installs ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bria-client"]}," on first run — no separate install step:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"# /// script\n# dependencies = [\"bria-client\"]\n# ///\nfrom bria_client import BriaSyncClient\n\nclient = BriaSyncClient()  # reads BRIA_API_TOKEN\n\njob = client.submit(\n    endpoint=\"image/generate\",\n    payload={\n        \"prompt\": \"studio product photo of a matte black insulated travel mug on a white seamless background, soft diffused key light from the upper left, crisp edges\",\n        \"aspect_ratio\": \"1:1\",\n    },\n)\nprint(job.request_id, job.status_url)\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"uv run quickstart.py\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["uv"]},"? ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pip install bria-client"]},", then run the script normally — the dependency block above is just a comment and is safe to leave in."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"JavaScript / TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const BASE = \"https://engine.prod.bria-api.com/v2\";\nconst token = process.env.BRIA_API_TOKEN ?? \"\";\n\nconst submit = await fetch(`${BASE}/image/generate`, {\n  method: \"POST\",\n  headers: { api_token: token, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    prompt: \"studio product photo of a matte black insulated travel mug on a white seamless background, soft diffused key light from the upper left, crisp edges\",\n    aspect_ratio: \"1:1\",\n  }),\n});\nif (!submit.ok) throw new Error(`Bria returned ${submit.status}: ${await submit.text()}`);\nconst job = await submit.json();\nconsole.log(job.request_id, job.status_url);\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://engine.prod.bria-api.com/v2/image/generate \\\n  -H \"api_token: $BRIA_API_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"prompt\": \"studio product photo of a matte black insulated travel mug on a white seamless background, soft diffused key light from the upper left, crisp edges\",\n    \"aspect_ratio\": \"1:1\"\n  }'\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["202 Accepted"]},"):"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"request_id\": \"9d4a1a2f5c7e4b6f8a0c2d3e4f5a6b7c\",\n  \"status_url\": \"https://engine.prod.bria-api.com/v2/status/9d4a1a2f5c7e4b6f8a0c2d3e4f5a6b7c\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-get-the-result","__idx":3},"children":["3. Get the result"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Poll the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status_url"]}," until ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["COMPLETED"]},". Generation usually takes a few seconds; poll every one to two seconds."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"result = client.poll(job, interval=2, timeout=120)\nprint(result.result.image_url)\nprint(result.result.seed)\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client.run(...)"]}," does submit and poll in one call when you do not need the job id."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"JavaScript / TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\nlet status;\ndo {\n  await sleep(2000);\n  status = await (await fetch(job.status_url, { headers: { api_token: token } })).json();\n} while (status.status === \"IN_PROGRESS\");\n\nif (status.status !== \"COMPLETED\") throw new Error(JSON.stringify(status.error ?? status));\nconsole.log(status.result.image_url, status.result.seed);\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl \"https://engine.prod.bria-api.com/v2/status/<request_id>\" -H \"api_token: $BRIA_API_TOKEN\"\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Completed status body:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"request_id\": \"9d4a1a2f5c7e4b6f8a0c2d3e4f5a6b7c\",\n  \"status\": \"COMPLETED\",\n  \"result\": {\n    \"image_url\": \"https://.../result.png\",\n    \"seed\": 314159,\n    \"structured_prompt\": \"{\\\"short_description\\\": \\\"A matte black insulated travel mug ...\\\", ...}\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Download the image from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["image_url"]}," and store it yourself. Keep the returned ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["seed"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["structured_prompt"]},": sending them back to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/image/generate"]}," reproduces the image exactly, and adding a short ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prompt"]}," refines it without changing the composition. That workflow is explained in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/image-generation-best-practices"},"children":["Image Generation best practices"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prefer a single blocking call? Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"sync\": true"]}," to the request body and the endpoint returns the result directly. Prefer push over polling? Pass a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["webhook_url"]}," and Bria POSTs the result to you; see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/getting-started/async-requests#webhooks"},"children":["webhooks"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"4-edit-an-image","__idx":4},"children":["4. Edit an image"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Editing endpoints accept a public image URL or a raw base64 string in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["image"]}," field. Remove the background from a product photo:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from bria_client.toolkit import Image\n\nresponse = client.run(\n    endpoint=\"image/edit/remove_background\",\n    payload={\"image\": Image(\"https://labs-assets.bria.ai/sandbox-example-inputs/remove_background_example.jpg\").as_bria_api_input},\n)\nprint(response.result.image_url)\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Image(...)"]}," also accepts a local path, a PIL image or a numpy array and encodes it for you."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"JavaScript / TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const edit = await fetch(`${BASE}/image/edit/remove_background`, {\n  method: \"POST\",\n  headers: { api_token: token, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    image: \"https://labs-assets.bria.ai/sandbox-example-inputs/remove_background_example.jpg\",\n    sync: true,\n  }),\n});\nconst { result } = await edit.json();\nconsole.log(result.image_url);\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://engine.prod.bria-api.com/v2/image/edit/remove_background \\\n  -H \"api_token: $BRIA_API_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"image\": \"https://labs-assets.bria.ai/sandbox-example-inputs/remove_background_example.jpg\", \"sync\": true}'\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The result is a PNG with a transparent background. Chain it into a ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/product-shot-editing/products/product-packshot"},"children":["packshot"]}," or a ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/product-shot-editing/products/product-lifestyle-shot-by-text"},"children":["lifestyle scene"]}," to build a catalog pipeline."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":5},"children":["Next steps"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/getting-started/async-requests"},"children":["Async requests and polling"]},": statuses, timeouts, sync mode and when to use each."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/getting-started/working-with-images"},"children":["Working with images and video"]},": URLs, base64, formats, masks and video uploads."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/getting-started/rate-limits-and-errors"},"children":["Rate limits and errors"]},": plan limits and the error contract."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/image-editing-overview"},"children":["Image Editing overview"]},": every editing endpoint at a glance."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Try any endpoint in the browser from its API reference page, or in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.bria.ai/console"},"children":["Bria sandbox"]},"."]}]}]},"headings":[{"value":"Quickstart","id":"quickstart","depth":1},{"value":"1. Get an API token","id":"1-get-an-api-token","depth":2},{"value":"2. Generate an image","id":"2-generate-an-image","depth":2},{"value":"3. Get the result","id":"3-get-the-result","depth":2},{"value":"4. Edit an image","id":"4-edit-an-image","depth":2},{"value":"Next steps","id":"next-steps","depth":2}],"frontmatter":{"title":"Quickstart","description":"Generate your first image with the Bria API in five minutes, then edit it. Python SDK, JavaScript/TypeScript and cURL.","seo":{"title":"Quickstart"}},"lastModified":"2026-09-27T11:58:15.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/getting-started/quickstart","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}