Skip to content

Score files against the scope's rules

Viewing v2— current version

POST
/v2/workspaces/{workspace_id}/scores
curl --request POST \
--url https://api.app.layer.ai/api/v2/workspaces/:workspace_id/scores \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"file_ids": [
"<uuid>"
],
"project_id": "<uuid>",
"rule_ids": []
}'

Unchanged from v1. This endpoint’s documented request and response schemas are identical in v1 and v2 — change the /v1 prefix to /v2. Schema equality is not a promise about behaviour, so keep your usual smoke tests.

Queue scoring of up to 100 files against the output scoring rules in force.

Accepted and asynchronous: every (file, rule) pair is a vision-model call that spends Creative Units, and the verdicts land over the following seconds to minutes. Poll GET /v1/workspaces/{workspace_id}/files/{file_id}/scores for the results.

Scoring a file again is allowed and appends a fresh verdict rather than replacing the previous one. A scope with no rules in force queues nothing and reports zero pairs.

workspace_id
required
Workspace Id

Id of the workspace that owns the resource.

string format: uuid

Id of the workspace that owns the resource.

Media typeapplication/json
ScoreFilesBody
object
file_ids
required
File Ids

The files to score. Images, video and 3D can be judged; audio and text cannot.

Array<string>
>= 1 items <= 100 items
project_id
Any of:
string format: uuid
rule_ids
Rule Ids

Score against these rules only. Empty runs every rule in force for the scope.

Array<string>
default:

Successful Response

Media typeapplication/json
ScoreFilesOutput
object
requested_pair_count
required
Requested Pair Count

How many (file, rule) judgements were queued — one model call each.

integer
file_count
required
File Count

How many files were accepted for scoring.

integer
rule_ids
required
Rule Ids

The rules the files are being scored against.

Array<string>
Examplegenerated
{
"requested_pair_count": 1,
"file_count": 1,
"rule_ids": [
"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
]
}

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.

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."
}

Invalid input parameters.

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 — too many concurrent requests.

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."
}