Skip to content

Update project AI policy

Viewing v1, superseded by v2

PATCH
/v1/workspaces/{workspace_id}/projects/{project_id}/ai-policy
curl --request PATCH \
--url https://api.app.layer.ai/api/v1/workspaces/:workspace_id/projects/:project_id/ai-policy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_defaults": {
"flux-2-dev": {
"inference_steps": {
"value": 30
}
}
},
"models": {
"flux-2-pro": {
"value": false
}
}
}'

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.

Change the controls the project sets itself as a JSON merge patch: a control or key you name is set, one you name as null is removed so it is inherited again, and anything you leave out stays as it is. A setting is replaced whole, value and lock. Setting most controls here is an Enterprise feature. Requires content policy author. Usage caps take workspace billing admin as well.

workspace_id
required
Workspace ID

ID of the workspace that owns the resource.

string format: uuid

ID of the workspace that owns the resource.

project_id
required
Project ID

ID of the project.

string format: uuid

ID of the project.

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
AIPolicyPatch

A change to the AI controls one scope sets, as a JSON merge patch (RFC 7396) of its policy.

A control or key the patch names is set; one it names as null is removed, so the scope inherits it again; anything it leaves out stays as it is. A setting is one value: naming it replaces both its value and its lock. Guardrails and output scoring belong to the services that own them, and naming one is refused. Usage caps take workspace billing admin as well.

object
agent_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
agents
Agents
object
key
additional properties
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
agent_confirm_above_cu
Any of:
Setting[Annotated[float, Ge]]
object
value
required
Value
number
locked
Locked
boolean
modalities
Modalities
object
key
additional properties
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
new_models_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
models
Models
object
key
additional properties
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
model_defaults
Model Defaults
object
key
additional properties
object
key
additional properties
Any of:
Setting[JSONValue]
object
value
required
locked
Locked
boolean
nsfw_tolerance
Any of:
Setting[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=1), Le(le=6)])]]
object
value
required
Value
integer
>= 1 <= 6
locked
Locked
boolean
reference_set_sharing_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
workflow_sharing_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
invisible_watermark_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
usage_caps
Usage Caps
object
key
additional properties
Any of:
Setting[Union[UsageCap, NoneType]]
object
value
required
Any of:
UsageCap

A cap on the Creative Units each member may spend in a workspace over one period, as a policy sets it.

object
cu_limit
required
CU Limit
number
mode
required
UsageLimitMode

What a cap does once its member has used all of it.

string
Allowed values: warn block
warn_threshold_pct
required
Warn Threshold Percent
integer
locked
Locked
boolean
Example
{
"model_defaults": {
"flux-2-dev": {
"inference_steps": {
"value": 30
}
}
},
"models": {
"flux-2-pro": {
"value": false
}
}
}

Successful Response

Media typeapplication/json
AIPolicyOutput
object
scope
required
AIPolicyScope

What the policy is attached to.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
policy
required
AIPolicy

What the scope sets itself, each value as {value, locked}. Anything absent is inherited.

object
agent_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
agents
Agents
object
key
additional properties
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
agent_confirm_above_cu
Any of:
Setting[Annotated[float, Ge]]
object
value
required
Value
number
locked
Locked
boolean
modalities
Modalities
object
key
additional properties
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
new_models_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
models
Models
object
key
additional properties
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
model_defaults
Model Defaults
object
key
additional properties
object
key
additional properties
Setting[JSONValue]
object
value
required
locked
Locked
boolean
guardrails
Guardrails
object
key
additional properties
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
output_scoring
Output Scoring
object
key
additional properties
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
nsfw_tolerance
Any of:
Setting[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=1), Le(le=6)])]]
object
value
required
Value
integer
>= 1 <= 6
locked
Locked
boolean
reference_set_sharing_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
workflow_sharing_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
invisible_watermark_enabled
Any of:
Setting[bool]
object
value
required
Value
boolean
locked
Locked
boolean
usage_caps
Usage Caps
object
key
additional properties
Setting[Union[UsageCap, NoneType]]
object
value
required
Any of:
UsageCap

A cap on the Creative Units each member may spend in a workspace over one period, as a policy sets it.

object
cu_limit
required
CU Limit
number
mode
required
UsageLimitMode

What a cap does once its member has used all of it.

string
Allowed values: warn block
warn_threshold_pct
required
Warn Threshold Percent
integer
locked
Locked
boolean
inherited
required
EffectiveAIPolicy

What the scope inherits from the less specific scopes, each value as {value, source}. A value with no source is the platform default.

object
agent_enabled
required
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
agents
required
Agents
object
key
additional properties
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
agent_confirm_above_cu
required
Resolved[float]
object
value
required
Value
number
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
modalities
required
Modalities
object
key
additional properties
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
new_models_enabled
required
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
models
required
Models
object
key
additional properties
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
model_defaults
required
Model Defaults
object
key
additional properties
object
key
additional properties
Resolved[JSONValue]
object
value
required
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
guardrails
required
Guardrails
object
key
additional properties
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
output_scoring
required
Output Scoring
object
key
additional properties
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
nsfw_tolerance
Resolved[int]
object
value
required
Value
integer
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
reference_set_sharing_enabled
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
workflow_sharing_enabled
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
invisible_watermark_enabled
Resolved[bool]
object
value
required
Value
boolean
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
usage_caps
Usage Caps
object
key
additional properties
Resolved[Union[UsageCap, NoneType]]
object
value
required
Any of:
UsageCap

A cap on the Creative Units each member may spend in a workspace over one period, as a policy sets it.

object
cu_limit
required
CU Limit
number
mode
required
UsageLimitMode

What a cap does once its member has used all of it.

string
Allowed values: warn block
warn_threshold_pct
required
Warn Threshold Percent
integer
source
Any of:
AIPolicySource

The policy a resolved value comes from.

object
scope
required
AIPolicyScope

Where a policy is attached: a workspace, or a project, group or member inside one.

object
kind
required
AIPolicyScopeKind

What an AI policy is attached to, from least to most specific.

string
Allowed values: workspace project group member
workspace_id
required
Workspace ID
string format: uuid
project_id
Project ID
string format: uuid
nullable
group_id
Group ID
string format: uuid
nullable
principal_id
Principal ID
string format: uuid
nullable
locked
required
Locked
boolean
updated_at
required
Updated At

When the policy was last written; null if it sets nothing.

string format: date-time
nullable
updated_by_id
required
Updated By ID

Who last wrote the policy, when known.

string format: uuid
nullable
Example
{
"scope": {
"kind": "workspace"
},
"policy": {
"agent_enabled": {
"locked": false
},
"agents": {},
"agent_confirm_above_cu": {
"locked": false
},
"modalities": {},
"new_models_enabled": {
"locked": false
},
"models": {},
"model_defaults": {},
"guardrails": {},
"output_scoring": {},
"nsfw_tolerance": {
"locked": false
},
"reference_set_sharing_enabled": {
"locked": false
},
"workflow_sharing_enabled": {
"locked": false
},
"invisible_watermark_enabled": {
"locked": false
},
"usage_caps": {}
},
"inherited": {
"agent_enabled": {
"source": {
"scope": {
"kind": "workspace"
}
}
},
"agents": {
"additionalProperty": {
"source": {
"scope": {
"kind": "workspace"
}
}
}
},
"agent_confirm_above_cu": {
"source": {
"scope": {
"kind": "workspace"
}
}
},
"modalities": {
"additionalProperty": {
"source": {
"scope": {
"kind": "workspace"
}
}
}
},
"new_models_enabled": {
"source": {
"scope": {
"kind": "workspace"
}
}
},
"models": {
"additionalProperty": {
"source": {
"scope": {
"kind": "workspace"
}
}
}
},
"model_defaults": {
"additionalProperty": {
"additionalProperty": {
"source": {
"scope": {
"kind": "workspace"
}
}
}
}
},
"guardrails": {
"additionalProperty": {
"source": {
"scope": {
"kind": "workspace"
}
}
}
},
"output_scoring": {
"additionalProperty": {
"source": {
"scope": {
"kind": "workspace"
}
}
}
},
"nsfw_tolerance": {
"value": 5
},
"reference_set_sharing_enabled": {
"value": true
},
"workflow_sharing_enabled": {
"value": true
},
"invisible_watermark_enabled": {
"value": false
},
"usage_caps": {}
}
}

Unauthenticated — missing or invalid Bearer token.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
error_code
required

Machine-readable error code: the last path segment of type.

string
field

The request field the error is about, by its name in the body (on a tool run, in input), on the errors that name one: so far the value a Layer tool fixes on an INFERENCE_TOOL_PIN_MISMATCH, and the scale factor on an INFERENCE_TOOL_UPSCALE_COPIES_SOURCE. Absent otherwise, even when detail names a field.

string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description.",
"error_code": "ERROR_CODE",
"field": "tileability"
}

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
error_code
required

Machine-readable error code: the last path segment of type.

string
field

The request field the error is about, by its name in the body (on a tool run, in input), on the errors that name one: so far the value a Layer tool fixes on an INFERENCE_TOOL_PIN_MISMATCH, and the scale factor on an INFERENCE_TOOL_UPSCALE_COPIES_SOURCE. Absent otherwise, even when detail names a field.

string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description.",
"error_code": "ERROR_CODE",
"field": "tileability"
}

Resource not found.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
error_code
required

Machine-readable error code: the last path segment of type.

string
field

The request field the error is about, by its name in the body (on a tool run, in input), on the errors that name one: so far the value a Layer tool fixes on an INFERENCE_TOOL_PIN_MISMATCH, and the scale factor on an INFERENCE_TOOL_UPSCALE_COPIES_SOURCE. Absent otherwise, even when detail names a field.

string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description.",
"error_code": "ERROR_CODE",
"field": "tileability"
}

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
error_code
required

Machine-readable error code: the last path segment of type.

string
field

The request field the error is about, by its name in the body (on a tool run, in input), on the errors that name one: so far the value a Layer tool fixes on an INFERENCE_TOOL_PIN_MISMATCH, and the scale factor on an INFERENCE_TOOL_UPSCALE_COPIES_SOURCE. Absent otherwise, even when detail names a field.

string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description.",
"error_code": "ERROR_CODE",
"field": "tileability"
}

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
error_code
required

Machine-readable error code: the last path segment of type.

string
field

The request field the error is about, by its name in the body (on a tool run, in input), on the errors that name one: so far the value a Layer tool fixes on an INFERENCE_TOOL_PIN_MISMATCH, and the scale factor on an INFERENCE_TOOL_UPSCALE_COPIES_SOURCE. Absent otherwise, even when detail names a field.

string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description.",
"error_code": "ERROR_CODE",
"field": "tileability"
}

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
error_code
required

Machine-readable error code: the last path segment of type.

string
field

The request field the error is about, by its name in the body (on a tool run, in input), on the errors that name one: so far the value a Layer tool fixes on an INFERENCE_TOOL_PIN_MISMATCH, and the scale factor on an INFERENCE_TOOL_UPSCALE_COPIES_SOURCE. Absent otherwise, even when detail names a field.

string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description.",
"error_code": "ERROR_CODE",
"field": "tileability"
}

Internal server error.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
error_code
required

Machine-readable error code: the last path segment of type.

string
field

The request field the error is about, by its name in the body (on a tool run, in input), on the errors that name one: so far the value a Layer tool fixes on an INFERENCE_TOOL_PIN_MISMATCH, and the scale factor on an INFERENCE_TOOL_UPSCALE_COPIES_SOURCE. Absent otherwise, even when detail names a field.

string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description.",
"error_code": "ERROR_CODE",
"field": "tileability"
}