---
title: "Train and save a LoRA Style"
method: POST
path: "/loras/train"
tags: ["LoRAs"]
---

# Train and save a LoRA Style

`POST /loras/train`

## Request

- Base URL: `https://app.flora.ai/api/v1`
- URL: `https://app.flora.ai/api/v1/loras/train`
- Auth: HTTP bearer

Trains a LoRA through the same dataset preparation, captioning defaults, authorization, billing and saved Style lifecycle as the web Train dialog. Upload image files through the assets API first, then pass their Flora URLs. Returns a run_id for GET /runs/{runId} and style_id for GET /loras/{styleId}; use the ready style_id as params.lora_id with a compatible inference model. Training spends workspace usage. Persist client_token before dispatch and reuse it with identical inputs to recover a lost response. The optional Idempotency-Key header separately rejects duplicate HTTP requests for two hours with idempotency_duplicate.

## Request body

- object
  - `workspace_id` string, required: Workspace to authorize and bill for training
  - `project_id` string, required: Project that owns the training run
  - `name` string, required: Name of the saved Style
  - `base_model` string, required: LoRA base-model family key, such as flux-2 or krea-2, from the Flora Train dialog
  - `image_urls` string[], required: Training images uploaded to Flora. The selected trainer enforces its own image-count range. External URLs must first be uploaded through the assets API.
  - `captions` string[]: Optional per-image captions in image_urls order. Null or blank entries use the shared training flow's fallback caption. Omit to use the same captioning defaults as the web Train dialog.
  - `trainer_params` object: Model-specific training parameters, such as steps, learning_rate or captioning mode. Omitted parameters use the same defaults as the web Train dialog. Parameters are validated by the shared trainer preparation service.
  - `client_token` string, required: Lowercase UUID for this logical training request. Persist it before submitting and reuse it with the same inputs after a lost response; do not create a new token for a retry.

## Response `201`

Training accepted, or the existing request recovered.

- object
  - `style_id` string, nullable, required: Saved Style identifier
  - `run_id` string, required: Training run identifier; poll GET /runs/{runId}
  - `workspace_id` string, required: Workspace that owns the training run
  - `project_id` string, required: Project that owns the training run
  - `poll_url` string, uri, required: URL for reading training progress and final charged cost

## Other responses

- `400`: 400
- `401`: 401
- `402`: 402
- `403`: 403
- `404`: 404
- `409`: 409
- `429`: 429
- `500`: 500
- `503`: 503

## Changes

- **2026-10-28** `a8351619f225`: 9 warning
  - added the new `not_configured` enum value to the `error/code` response property for the response status `400`
  - added the new `not_configured` enum value to the `error/code` response property for the response status `401`
  - added the new `not_configured` enum value to the `error/code` response property for the response status `402`
  - added the new `not_configured` enum value to the `error/code` response property for the response status `403`
  - …5 more
- **2026-10-16** `e54130373b10`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/florafauna-ai/apis/flora-ai-api/changes/loras/train/post.md)

---

[API](https://skmtc.dev/florafauna-ai/apis/flora-ai-api.md) - [All operations](https://skmtc.dev/florafauna-ai/apis/flora-ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/florafauna-ai/apis/flora-ai-api/revisions/87cfe2c4ac29?raw)
