Add a source to a workspace
POST/api/v1/workspace/:workId/source
Adds a new SOURCE to an existing workspace identified by {workId}.
The owner / user context is resolved server-side from the X-API-Key header.
Request
| Field | Required | Max length | Notes |
|---|---|---|---|
| code | YES | 150 | Source code identifier |
| description | NO | 250 | Human-readable description (nullable) |
tsCreated is set server-side — NOT included in the request.
Response (HTTP 200)
Returns an echo of the accepted {code, description}. id is intentionally omitted —
the internal endpoint returns HTTP 200 with an empty body, so no id is available.
Error handling
Validation failures (missing/empty code, code > 150 chars, description > 250 chars) → HTTP 400. Invalid or missing API-Key → HTTP 400. Workspace not found or no ownership → HTTP 400 with business error code (WS_ERR_101).
Request
Responses
- 200
- 400
- 401
- 403
- 500
Source added successfully. Returns echo of accepted code and description.
Bad Request. The request parameters are invalid.
Unauthorized. Missing or invalid API key.
Forbidden. The API key does not grant access to workspaces.
Internal Server Error. Unexpected error occurred while processing the request.