> ## Documentation Index
> Fetch the complete documentation index at: https://docs.krea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Train a custom style (LoRA)

> Train a custom style (LoRA) with simplified parameters. Uses intelligent defaults based on the training type (Default/Style/Object/Character).

<Note>
  Trained styles are private and only usable by the API user that created them. To allow other workspace members to use the style, share it with the workspace using `POST /styles/{id}/share/workspace`.
</Note>


## OpenAPI

````yaml https://api.krea.ai/openapi.json post /styles/train
openapi: 3.1.0
info:
  title: Krea API
  version: v1
servers:
  - url: https://api.krea.ai
    description: Krea API
security:
  - bearerAuth: []
tags:
  - name: General
    description: Core API operations including job management and billing information
  - name: Krea
    description: Krea-owned generation models including Krea 2
  - name: Assets
    description: >-
      Asset management endpoints for uploading and managing images, videos,
      audio files, and 3D models
  - name: Styles
    description: Style (LoRA) generation and management endpoints
  - name: Node Apps
    description: Executing custom node apps built in our nodes tool
  - name: Image
    description: Image generation endpoints
  - name: Image Enhance
    description: Image enhance endpoints
  - name: Video
    description: Video generation endpoints
paths:
  /styles/train:
    post:
      tags:
        - Styles
      summary: Train a custom style (LoRA)
      description: >-
        Train a custom style (LoRA) with simplified parameters. Uses intelligent
        defaults based on the training type (Default/Style/Object/Character).
      parameters:
        - name: X-Webhook-URL
          in: header
          required: false
          schema:
            type: string
            format: uri
          description: >-
            URL to receive a POST request when the job completes. The webhook
            will receive the job data including results.
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    model:
                      type: string
                      enum:
                        - flux_dev
                        - flux_schnell
                        - wan
                        - wan22
                      default: flux_dev
                    type:
                      type: string
                      enum:
                        - Style
                        - Object
                        - Character
                        - Default
                      default: Default
                    name:
                      type: string
                    urls:
                      type: array
                      items:
                        type: string
                        format: uri
                    trigger_word:
                      type: string
                    learning_rate:
                      type: number
                    max_train_steps:
                      type: integer
                      minimum: 1
                      maximum: 2000
                    batch_size:
                      type: integer
                      minimum: 1
                  required:
                    - name
                    - urls
                - type: object
                  properties:
                    model:
                      type: string
                      enum:
                        - qwen
                        - z-image
                    type:
                      type: string
                      enum:
                        - Style
                        - Object
                        - Character
                      default: Style
                    name:
                      type: string
                    urls:
                      type: array
                      items:
                        type: string
                        format: uri
                    trigger_word:
                      type: string
                    max_train_steps:
                      type: integer
                      minimum: 1
                      maximum: 2000
                  required:
                    - model
                    - name
                    - urls
      responses:
        '200':
          description: >-
            Training job created successfully. The job will be in a pending
            state until completed. Use /jobs/{id} to check progress.
          content:
            application/json:
              schema:
                type: object
                properties:
                  job_id:
                    type: string
                    format: uuid
                  status:
                    type: string
                    enum:
                      - backlogged
                      - queued
                      - scheduled
                      - processing
                      - sampling
                      - intermediate-complete
                      - completed
                      - failed
                      - cancelled
                  created_at:
                    type: string
                    format: date-time
                  completed_at:
                    type: 'null'
                  result:
                    type: 'null'
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                required:
                  - job_id
                  - status
                  - created_at
                  - completed_at
                  - result
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '429':
          description: Maximum number of concurrent jobs reached
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      bearerFormat: Bearer
      type: http

````