Create Supplier (v1)
Method & Path
POST /api/v1/workspace/:workspaceId/suppliers
Actual backend path: POST /v1/workspace/:workspaceId/suppliers
Description
Create a new supplier for the workspace (اسم التام / full name).
Authentication
Required: Workspace JWT.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <workspace_token> |
Content-Type | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
Request Body
{
"fullName": "اسم التام للمورد"
}
| Field | Type | Required | Description |
|---|---|---|---|
fullName | string | Yes | Full name of the supplier (trimmed, min 1 character) |
Response 201 Created
{
"supplier": {
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"fullName": "اسم التام للمورد",
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:00:00.000Z"
}
}
Common Errors
- 400 Bad Request: Validation error (e.g. empty fullName)
- 401 Unauthorized: Missing or invalid token
- 403 Forbidden: Workspace access denied
- 404 Not Found: Workspace not found
- 500 Internal Server Error: Server error