# Tailored Generation API Reference

Tailored Generation provides capabilities to generate visuals (photos, illustrations, vectors) 
that preserve and faithfully reproduce specific IP elements or guidelines, ensuring consistency 
across all generated outputs.

The Tailored Generation APIs allow you to manage and train tailored models that maintain the 
integrity of your visual IP. You can train models through our Console or implement training 
directly via API. Explore the Console [here](https://platform.bria.ai/console/tailored-generation).

**Fully Automated Training Mode**
Bria supports users in training high-quality finetuned models without the guesswork. Based on the selected IP type & dataset, Bria automatically selects the right training parameters. 
This means that the user only needs to spend time curating their dataset.

**Advanced Customization and Access:** Bria offers 2 types of advanced training customization: Expert training mode and source-code & weights.
  - **Expert training mode** is for LoRa Finetune experts and provides the ability to finetune training parameters and upload larger training datasets.
  - **Source-code & Weights** is for developers seeking deeper customization and access to Bria's source-available GenAI models via [Hugging Face](https://huggingface.co/briaai).  

All methods allow full control over fine-tuning, pipeline creation, and integration into proprietary workflows—empowering AI teams to develop and optimize their own generative AI solutions.

The Tailored Generation Training API provides a set of endpoints to manage the entire lifecycle 
of a tailored generation project:

1. **Project Management**: Create and manage projects that define IP characteristics:
  - **Create and Retrieve Projects**: Use the `/projects` endpoints to create a new project or 
    retrieve existing projects that belong to your organization.
  - **Define IP Type**: Specify the IP type (e.g., multi_object_set, defined_character, 
    stylized_scene) and medium.
  - **Manage Project Details**: Use the `/projects/{id}` endpoints to update or delete 
    specific projects.

2. **Dataset Management**: Organize and refine datasets within your projects:
  - **Create and Retrieve Datasets**: Use the `/datasets` endpoints to create new datasets or 
    retrieve existing ones.
  - **Generate a Visual Schema**
    - Use `/tailored-gen/generate_visual_schema` to create a structured visual schema using 5-10 sample images.
  - **Refine Structured Data**
    - Use `/tailored-gen/refine_structured_prompt` to iterate on your **Visual Schema** or **Image Captions** using natural language instructions.
    - *Example:* You can send your generated schema with the instruction "Character's name is Lucy" to improve the training metadata programmatically.
  - **Upload and Manage Images**: 
    - **Basic upload**: Use `/datasets/{dataset_id}/images` to upload up to 200 images individually.
    - **Bulk upload**: Use `/datasets/{dataset_id}/images/bulk` to upload zip files with >200 high-quality images (Advanced).
  - **Clone Datasets**: Create variations of existing datasets using the clone functionality.

3. **Model Management**: Train and optimize tailored models based on your datasets:
  - **Create and Retrieve Models**: Use the `/models` endpoints to create new models or list 
    existing ones.
  - **Choose training mode**: Select between Fully automated mode (automatic training based on Bria's recipes) and Expert mode (for training parameter tweaking).
  - **Monitor and Control**: Manage the model lifecycle, including training start/stop, 
    status monitoring, and version control over the training parameters.

4. **Generation Capabilities**:
  - **Image Generation**: Use `/image/generate/tailored` for text-to-image generation.
  - **Structured Prompting**: Use `/structured_prompt/generate/tailored` to create structured prompts via VLM before generation.
  - **Video Generation**: Use `/video/generate/tailored/image-to-video` to animate tailored images.

### **Training Process**

To train a tailored model:

1. **Create a Project**: Use the `/projects` endpoint to define your IP type and medium.
2. **Create a Dataset**: Use the `/datasets` endpoint to create a dataset within your project.
3. **Define Visual Identity**:
   - **Step A (Generate):** Call `/tailored-gen/generate_visual_schema`, sampling 5-10 images from your input set.
   - **Step B (Refine - Optional):** Call `/tailored-gen/refine_structured_prompt` with the generated schema and instructions to tweak the definitions (e.g., "Remove references to blue background").
   - **Step C (Apply):** Update the dataset with the final schema using `/datasets/{dataset_id}`.
4. **Upload Images**: Upload images using the `/datasets/{dataset_id}/images` or `/datasets/{dataset_id}/images/bulk` endpoints 
  (minimum resolution: 1024x1024px).
5. **Prepare Dataset**: Review auto-generated captions (you can also use `refine_structured_prompt` to fix specific image captions) and update the dataset status to 'completed'.
6. **Create Model**: Use the `/models` endpoint to create a model, which requires a training mode.
7. **Start Training**: Initiate training via the `/models/{id}/start_training` endpoint. 
  Training typically takes 4-6 hours.
8. **Monitor Progress**: Check the training status using the `/models/{id}` endpoint until 
  training is 'Completed'.
9. **Generate Images**: 
  - Use `v2/image/generate/tailored` for text-to-image generation.

Alternatively, manage and train tailored models through Bria's user-friendly Console.  
Get started [here](https://platform.bria.ai/console/tailored-generation).



## Servers

```
https://engine.prod.bria-api.com/v2/
```

## Download OpenAPI description

[Tailored Generation API Reference](https://docs.bria.ai/_bundle/tailored-generation.yaml)

## Project

Manage your projects

### Create Project

 - [POST /tailored-gen/projects](https://docs.bria.ai/tailored-generation/project/create-project.md): Create a new project within the organization.

The following IP types are supported:

Defined Character
A specific character that maintains consistent identity and unique traits while being reproduced in different poses, situations, and actions.

Medium: Photography



Medium: Illustration



Stylized Scene
Complete environments or scenes created with a consistent visual style, look, and feel.

Medium: Photography



Medium: Illustration



Multi-Object Set
A collection of different objects sharing a common style, design language, or color scheme. Objects are typically isolated on solid backgrounds.


Object Variants
Multiple variations of the same object type, maintaining consistent style and structure while showing different interpretations. Objects are typically isolated on solid backgrounds.


Icons
A collection of cohesive, small-scale illustrations or symbols designed to represent concepts, actions, or objects in interfaces and applications.


Character Variants
Multiple characters sharing the same fundamental structure, style, and color palette, allowing creation of new characters that fit within the established design system.

### Get Projects

 - [GET /tailored-gen/projects](https://docs.bria.ai/tailored-generation/project/get-projects.md): Retrieve all projects within the organization. If there are no projects, returns an empty array.

### Get Project by ID

 - [GET /tailored-gen/projects/{project_id}](https://docs.bria.ai/tailored-generation/project/get-project-by-id.md): Retrieve full project information.

### Update Project

 - [PUT /tailored-gen/projects/{project_id}](https://docs.bria.ai/tailored-generation/project/update-project.md): Update a specific project.

### Delete Project

 - [DELETE /tailored-gen/projects/{project_id}](https://docs.bria.ai/tailored-generation/project/delete-project.md): Permanently delete a project and all its associated resources, including all datasets, images, and models. This action cannot be undone. Training models must be stopped before deletion.

## Dataset

Manage training datasets

### Create Dataset

 - [POST /tailored-gen/datasets](https://docs.bria.ai/tailored-generation/dataset/create-dataset.md): Create a new dataset.

Datasets use JSON structured data (visual_schema) for training. You must generate a visual schema via /generate_visual_schema before completing the dataset.

Completion Requirements:
Minimum 5 images required to mark as completed.

Upload types:
* Basic upload type: Supports up to 200 images, uploading image files
* Advanced upload type: Supports up to 5000 images, uploading a zip file

### Get Datasets

 - [GET /tailored-gen/datasets](https://docs.bria.ai/tailored-generation/dataset/get-datasets.md): Retrieve a list of all datasets. If there are no datasets, returns an empty array.

### Get Datasets by Project

 - [GET /tailored-gen/projects/{project_id}/datasets](https://docs.bria.ai/tailored-generation/dataset/get-datasets-by-project.md): Retrieve all datasets for a specific project.

### Get Dataset by ID

 - [GET /tailored-gen/datasets/{dataset_id}](https://docs.bria.ai/tailored-generation/dataset/get-dataset-by-id.md): Retrieve a specific dataset including its images.

### Update Dataset

 - [PUT /tailored-gen/datasets/{dataset_id}](https://docs.bria.ai/tailored-generation/dataset/update-dataset.md): Update a dataset.

You can update visual_schema only when the dataset status is draft.
  
Completion Requirements:
To set status to completed, the dataset must have at least 5 images.

### Delete Dataset

 - [DELETE /tailored-gen/datasets/{dataset_id}](https://docs.bria.ai/tailored-generation/dataset/delete-dataset.md): Delete a specific dataset. Deletes all associated images.

### Clone Dataset As Draft

 - [POST /tailored-gen/datasets/{dataset_id}/clone](https://docs.bria.ai/tailored-generation/dataset/clone-dataset.md): Create a new draft dataset based on an existing one. This is useful when you would like to use the same dataset again for another training, but with some modification (create a variation). The cloned dataset inherits the visual_schema from the source dataset.

### Upload Image Files

 - [POST /tailored-gen/datasets/{dataset_id}/images](https://docs.bria.ai/tailored-generation/dataset/upload-image.md): Upload a new image to a dataset.

Image Requirements:
- Recommended minimum resolution: 1024x1024 pixels for best quality
  - By default, smaller images (down to 256x256) will be automatically upscaled (increase_resolution=true)
  - To strictly enforce the 1024x1024 minimum, set increase_resolution=false
- Supported formats: jpg, jpeg, png, webp
- Preferably use original high-quality assets

Dataset Guidelines:
- Recommended: 5-50 images for optimal results
- Maximum supported: 200 images
- Ensure consistency in style, structure, and visual elements
- Balance diversity in content while maintaining consistency in key elements

For optimal training (especially for characters/objects):
- Subject should occupy most of the image area
- Minimize unnecessary margins around the subject
- Transparent backgrounds will be converted to black
- For character datasets: include diverse poses, environments, attires, and interactions

Constraints:
- Can only be used by "basic" upload type datasets. Use images/bulk for advanced datasets.
- Dataset must have at least 5 images
- Dataset cannot exceed 200 images
- Cannot upload to a completed dataset

This API endpoint supports content moderation via an optional parameter.

### Get Images

 - [GET /tailored-gen/datasets/{dataset_id}/images](https://docs.bria.ai/tailored-generation/dataset/get-images.md): Retrieve all images in a specific dataset.

### Regenerate All Captions

 - [PUT /tailored-gen/datasets/{dataset_id}/images](https://docs.bria.ai/tailored-generation/dataset/regenerate-all-captions.md): Regenerate captions for all images in a dataset. This is crucial after updating the visual schema, to ensure full compatibility with the new schema.

This is an asynchronous operation. Once called, poll Get Dataset by ID until captions_update_status changes to 'completed'.

### Advanced Image Upload

 - [POST /tailored-gen/datasets/{dataset_id}/images/bulk-upload](https://docs.bria.ai/tailored-generation/dataset/bulk-upload-images.md): Efficiently upload a large volume of images (up to 5000) from a ZIP file to an advanced dataset.

Upload without Schema: You can initiate a bulk upload even if visual_schema is null. Images will be uploaded but caption generation will be skipped. You must call Regenerate All Captions after defining the schema.

General:
* Asynchronous operation; status can be retrieved via {dataset_id}/bulk-upload/status.
* Supported for 'advanced' upload type datasets only.
* If the dataset is not empty, if another bulk upload is in progress, or if any previous bulk upload attempt took place, the request will fail.

Image Requirements:
* Supported formats: jpg, jpeg, png, webp.
* Minimum dimensions: 1024 x 1024 pixels.
* Total size limit: 5 GB zip file.

### Get Image by ID

 - [GET /tailored-gen/datasets/{dataset_id}/images/{image_id}](https://docs.bria.ai/tailored-generation/dataset/get-image.md): Retrieve full image information.

### Update Image Caption

 - [PUT /tailored-gen/datasets/{dataset_id}/images/{image_id}](https://docs.bria.ai/tailored-generation/dataset/update-image-caption.md): Update the caption of a specific image. Two mutually exclusive options:

1. Provide a new caption: Use the caption parameter (sets caption_source to "manual"). The caption must be a string containing a valid JSON structure.
2. Regenerate automatically: Set regenerate_caption to true (sets caption_source to "automatic").

Constraints:
* Cannot update captions in a completed dataset
* Cannot provide both caption and regenerate_caption

### Delete Image

 - [DELETE /tailored-gen/datasets/{dataset_id}/images/{image_id}](https://docs.bria.ai/tailored-generation/dataset/delete-image.md): Permanently remove an image from a dataset. Cannot delete images from completed datasets.

### Get Bulk Upload Status

 - [GET /tailored-gen/datasets/{dataset_id}/images/bulk-upload/status](https://docs.bria.ai/tailored-generation/dataset/get-bulk-upload-status.md): Retrieve the status and progress of a bulk image upload job.

### Generate Visual Schema

 - [POST /tailored-gen/generate_visual_schema](https://docs.bria.ai/tailored-generation/dataset/generate-visual-schema.md): Generates a structured JSON visual schema (backbone) based on the provided sample images.

The visual schema represents mutual characteristics (style, IP, colors, etc.) across training images and is used for:
1. Caption generation during image upload.
2. Prompt translation (user text → structured prompt) during generation.

Usage:
- Provide 5-10 representative images of your style/IP.
- The returned visual_schema string must be added to your dataset using PUT /tailored-gen/datasets/{dataset_id}.

This endpoint supports content moderation via an optional parameter.

### Refine Structured Prompt

 - [POST /tailored-gen/refine_structured_prompt](https://docs.bria.ai/tailored-generation/dataset/refine-json.md): Refines a Structured Prompt object (such as a Visual Schema or an Image Caption) based on user instructions.

Access Control & Validation:
* Requires a valid dataset_id to verify ownership.
* The referenced dataset must be in draft mode.

Use Cases:
1. Refine Visual Schema: Input the initial schema and instructions like "Make the style description more detailed".
2. Refine Image Caption: Input a specific image's caption and instructions like "Fix the description of the hair color".

### Download Dataset

 - [GET /datasets/{dataset_id}/download](https://docs.bria.ai/tailored-generation/dataset/download-dataset.md): Download an advanced dataset. Returns a pre-signed URL for downloading the dataset.

## Model

Manage and train models

### Create Model

 - [POST /tailored-gen/models](https://docs.bria.ai/tailored-generation/model/create-model.md): Create a new model.

### Get Models

 - [GET /tailored-gen/models](https://docs.bria.ai/tailored-generation/model/get-models.md): Retrieve a list of models. If there are no models, an empty array is returned.

### Get Models by Project

 - [GET /tailored-gen/projects/{project_id}/models](https://docs.bria.ai/tailored-generation/model/get-models-by-project.md): Retrieve all models for a project.

### Get Model by ID

 - [GET /tailored-gen/models/{model_id}](https://docs.bria.ai/tailored-generation/model/get-model.md): Retrieve full model information.

### Update Model

 - [PUT /tailored-gen/models/{model_id}](https://docs.bria.ai/tailored-generation/model/update-model.md): Update a model's name and description.

### Delete Model

 - [DELETE /tailored-gen/models/{model_id}](https://docs.bria.ai/tailored-generation/model/delete-model.md): Delete a specific model.

### Start Training

 - [POST /tailored-gen/models/{model_id}/start_training](https://docs.bria.ai/tailored-generation/model/start-training.md): Start model training. Training duration is typically 2-4 hours.
The associated dataset must have a status of 'completed' before training can begin.

Default Training Parameters:
If parameters are not provided, defaults are automatically selected:
* rank: 128
* learning_rate: 0.0001
* lr_scheduler: "constant_with_warmup"
* total_training_steps: 750
* checkpoint_interval: 500
    
Constraints:
Advanced training parameters are only supported when the model's training_mode is set to 'expert'.

### Stop Training

 - [POST /tailored-gen/models/{model_id}/stop_training](https://docs.bria.ai/tailored-generation/model/stop-training.md): Stop an ongoing model training process. Once stopped, training cannot be resumed - a new model would need to be created and trained.

### List Checkpoints

 - [GET /tailored-gen/models/{model_id}/checkpoints](https://docs.bria.ai/tailored-generation/model/list-checkpoints.md): Retrieve a list of all available checkpoints for a model. Only available for models trained in expert mode.

### Get Specific Checkpoint

 - [GET /tailored-gen/models/{model_id}/checkpoints/{checkpoint_step}](https://docs.bria.ai/tailored-generation/model/get-checkpoint.md): Retrieve details for a specific model checkpoint.

### Delete Checkpoint

 - [DELETE /tailored-gen/models/{model_id}/checkpoints/{checkpoint_step}](https://docs.bria.ai/tailored-generation/model/delete-checkpoint.md): Permanently delete a specific model checkpoint. Cannot delete the checkpoint currently selected for inference.

### Download Tailored Model

 - [GET /tailored-gen/models/{model_id}/download](https://docs.bria.ai/tailored-generation/model/download-tailored-model.md): Download a trained tailored generation model after completing the training process. 
The response includes a pre-signed URL for downloading the model and details about the base model used.

To use the tailored model source code, access to the base model source code is required. 
The base model source code is exclusively available through Bria's Source Code and Weights product. 
For more information, contact us at info@bria.ai.

## Image Generation

Generate images using tailored models

### Generate Image - Tailored Model

 - [POST /image/generate/tailored](https://docs.bria.ai/tailored-generation/image-generation/image-generate-tailored.md): Description

Generates a new image using a tailored model.

This endpoint translates your input (prompt and/or structured_prompt) into a structured JSON prompt using the state-of-the-art Gemini 2.5 Flash VLM bridge. It internally uses the model's visual schema (backbone) to ensure the generated image matches your trained visual identity.

The response includes both the final image_url and the structured_prompt (JSON).

Input Combination Rules
The request body must include one of the following mutually exclusive combinations:
* prompt: Generates a new image from text.
* structured_prompt: Recreates a previous image exactly (requires seed).
* structured_prompt + prompt: Refines a previous image using new text instructions.

### Generate Structured Prompt - Tailored Model

 - [POST /structured_prompt/generate/tailored](https://docs.bria.ai/tailored-generation/image-generation/structured-prompt-generate-tailored.md): Description

Creates a new detailed, machine-readable structured prompt in JSON format or refines an existing one using text inputs and a tailored model's visual schema (backbone).

This endpoint uses the state-of-the-art Gemini 2.5 Flash VLM bridge. The tailored model's visual schema is provided as input to Gemini along with the user prompt to generate the structured prompt.

It returns ONLY the JSON string and does not generate an image.

Use Cases:
 Control & Auditability: Inspect or programmatically edit the JSON before* generating an image.
* Consistency: Generate one structured_prompt and pass it to /image/generate/tailored multiple times.
* Hybrid Deployment: Use Bria's VLM bridge via API while hosting the FIBO image model on a private cloud.

Input Combination Rules
The request body must use exactly one of the following combinations:
* Text Only: prompt
* Structured Prompt and Text: structured_prompt and prompt (Refinement)

## Video Generation

Image-to-Video capabilities

### Generate Video from Tailored Image (Beta)

 - [POST /video/generate/tailored/image-to-video](https://docs.bria.ai/tailored-generation/video-generation/generate-video-from-tailored-image.md): (Beta)
Initiates an asynchronous job to generate a 5-second MP4 video file animating a source image created by a tailored model.

Asynchronous Requests and the Status Service Bria API endpoints process requests asynchronously by default. When you make an asynchronous request, the API immediately returns a request_id and a status_url instead of the final result. Use the Status Service to track the request's progress until it reaches a completed state.  

See the full guide at Status Service Documentation for complete details and usage examples.

On successful initiation, this endpoint returns a 202 Accepted response. Poll the status_url or use the Status Service with the request_id to check for job completion.
Once 'Completed', the status response will contain the URL to the generated MP4 video.

