Create Test Group (v1)
Method & Path
POST /api/v1/workspace/:workspaceId/labs/test-groups
Actual backend path: /v1/workspace/:workspaceId/labs/test-groups
Description
Create a new test group in a workspace.
Authentication
Required: JWT token in Authorization header
Required Permissions:
labs.manage
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 (MongoDB ObjectId) |
Request Body
{
"testGroupTitle": "Liver Functions+",
"testGroupDefaultPrice": 17.14,
"testGroupAccountId": 382
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
testGroupTitle | string | Yes | Test group title (1-500 characters) |
testGroupDefaultPrice | number | No | Default price for the test group (nullable) |
testGroupAccountId | number | No | Account ID from external API (optional) |
Response 201 Created
{
"testGroup": {
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"testGroupId": 5196,
"testGroupTitle": "Liver Functions+",
"testGroupDefaultPrice": 17.14,
"testGroupAccountId": 382,
"deletedAt": null,
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}
Common Errors
- 400 Bad Request: Invalid request body or validation errors
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions (requires
labs.manage) - 404 Not Found: Workspace not found
- 409 Conflict: Test group with same testGroupId already exists
- 422 Unprocessable Entity: Validation errors
- 500 Internal Server Error: Server error