Skip to content

Start a training run

Viewing v1— superseded by v2

POST
/v1/workspaces/{workspace_id}/training-runs
curl --request POST \
--url https://api.app.layer.ai/api/v1/workspaces/:workspace_id/training-runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"reference_set_id": "<uuid>",
"base_model_id": "<string>",
"training_framework": "fal",
"webhook": {
"url": "<string>",
"events": [
"inference.completed"
],
"metadata": {}
}
}'

v1 is superseded. v1 was superseded by v2 on 2026-08-26. A sunset date has not been announced yet; v1 will be deprecated as a whole before removal. Migrate with the v2 migration guide.

Start training a custom style/LoRA from a reference set. Returns immediately with a run ID. Poll GET /workspaces/{workspace_id}/training-runs/{training_run_id} for progress. Creative Units are reserved at submission; call the estimate endpoint first to check cost.

workspace_id
required
Workspace Id

Id of the workspace that owns the resource.

string format: uuid

Id of the workspace that owns the resource.

Idempotency-Key
string
<= 255 characters

Opaque key making a retry of this request return the first result. A 2xx response is replayed for 24 hours with Idempotent-Replayed: true. A 4xx releases the key. A 5xx, or a request still running, holds the key for 120 seconds, during which a retry gets 409; after that a retry executes again. The key covers the method, path, query, and byte-identical body it was first used with; reusing it for a different request is rejected with 422. Protection is best effort: if the key store is unavailable, or a record is lost early, a retry can execute again even after an earlier 409. See the Idempotency section of the API description.

Media typeapplication/json
StartTrainingRequest
object
reference_set_id
required
Reference Set Id

The reference set (Style) to train a LoRA for.

string format: uuid
base_model_id
Base Model Id

Base model to train. Omit to use the reference set’s configured or workspace default model.

string
nullable
training_framework
Training Framework

Training framework override. Omit for the server default.

string
nullable
Allowed values: fal ai-toolkit
webhook
Any of:
WebhookInput

Where to POST this request’s terminal events, and what to include with them.

object
url
required
Url

HTTPS URL that receives a POST when this request reaches a terminal state. Must be publicly reachable; must not redirect. Acknowledge with any 2xx within 10 seconds and do the work asynchronously. Reply 410 to stop delivery permanently.

string
<= 2048 characters
events
Events

Narrows what is delivered. Omit to receive every event this request can produce, which is what expected_events on the response lists.

Array<string>
nullable
Allowed values: inference.completed inference.failed inference.cancelled training.succeeded training.failed scoring_run.completed scoring_run.failed workflow_run.succeeded workflow_run.failed workflow_run.cancelled
metadata
Metadata

Opaque key/value pairs echoed back verbatim in every delivery, for correlating a callback with your own records. At most 10 keys and 1024 bytes in total.

object
key
additional properties
string

Successful Response

Media typeapplication/json
StartTrainingResponse
object
training_run_id
required
Training Run Id

Unique identifier for this training run.

string format: uuid
state
required
State

Coarse state; in_progress right after submission.

string
Allowed values: in_progress terminal_success terminal_failure
raw_status
required
Raw Status

Fine-grained run status (e.g. initializing).

string
base_model_id
Base Model Id

Base model the run trains with.

string
nullable
created_at
required
Created At

Timestamp the run was created.

string format: date-time
poll_interval_seconds
required
Poll Interval Seconds

Suggested polling interval in seconds.

integer
expected_events
Expected Events

Deliveries this run will produce. Empty when no webhook was supplied.

Array<string>
default:
Allowed values: inference.completed inference.failed inference.cancelled training.succeeded training.failed scoring_run.completed scoring_run.failed workflow_run.succeeded workflow_run.failed workflow_run.cancelled
Example
{
"state": "in_progress",
"expected_events": []
}

Unauthenticated — missing or invalid Bearer token.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Forbidden — insufficient permissions, or the access token lacks the scope the operation requires.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Resource not found.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

The outcome of the request with this Idempotency-Key is not known yet: it is still running, or it failed without a stored response. Retry after the number of seconds in Retry-After.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Invalid input parameters, or an Idempotency-Key reused for a different request.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Rate limited — retry after the number of seconds in Retry-After.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Internal server error.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}