Create Evaluation Field (v1)
Method + Path
POST /v1/workspace/:workspaceId/sessions/evaluation-fields
Actual backend path: /v1/workspace/:workspaceId/sessions/evaluation-fields
Description
Create a new evaluation field definition for sessions.
Authentication
Required - JWT token in Authorization header
Required Permissions:
sessions.update
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
Request Body
{
"key": "satisfaction-rating",
"label": "Satisfaction Rating",
"type": "number",
"isRequired": false,
"metadata": {}
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | No | Field key (auto-generated if not provided) |
label | string | Yes | Display label for the field |
type | string | Yes | Field type. Valid values: text, number, date, boolean, select, etc. |
isRequired | boolean | No | Whether the field is required. Default: false |
metadata | object | No | Additional metadata for the field |
Response (201)
{
"field": {
"id": "507f1f77bcf86cd799439011",
"key": "satisfaction-rating",
"label": "Satisfaction Rating",
"type": "number",
"isRequired": false,
"order": 1,
"createdAt": "2024-01-15T10:00:00Z"
}
}
Common Errors
- 400 Bad Request: Invalid request body
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions (requires
sessions.update) - 404 Not Found: Workspace not found
- 409 Conflict: Field key already exists
- 422 Unprocessable Entity: Validation errors
- 500 Internal Server Error: Server error