Skip to main content
Create a new supplier with contact information and active status.

Endpoint

POST /api/v1/suppliers

Request Body

name
string
required
Name of the supplier company or individual
contactEmail
string
required
Contact email address for the supplier
contactPhone
string
required
Contact phone number for the supplier
isActive
boolean
required
Whether the supplier should be marked as active

Response

Returns the created supplier object with its assigned ID.
id
integer
required
Unique identifier assigned to the new supplier
name
string
required
Name of the supplier
contactEmail
string
required
Contact email address
contactPhone
string
required
Contact phone number
isActive
boolean
required
Active status of the supplier

Example Request

curl -X POST https://api.example.com/api/v1/suppliers \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Furniture Co.",
    "contactEmail": "[email protected]",
    "contactPhone": "+1-555-0100",
    "isActive": true
  }'

Example Response

{
  "id": 1,
  "name": "Premium Furniture Co.",
  "contactEmail": "[email protected]",
  "contactPhone": "+1-555-0100",
  "isActive": true
}
The response includes a Location header pointing to the newly created resource:
Location: /api/v1/suppliers/1

Status Codes

  • 201 Created - Supplier successfully created
  • 400 Bad Request - Invalid request body or validation error

Validation Rules

The following validation rules apply:
  • name - Must not be empty
  • contactEmail - Must be a valid email format
  • contactPhone - Must not be empty
  • isActive - Must be a boolean value

Error Response

If validation fails, the API returns a 400 status code:
{
  "status": 400,
  "error": "Bad Request",
  "message": "Validation failed",
  "errors": [
    {
      "field": "contactEmail",
      "message": "must be a valid email address"
    }
  ]
}

Build docs developers (and LLMs) love