Update Supplier
This endpoint updates the name, description, or archive status of a supplier.
Endpoint
Section titled “Endpoint”PUT /v1/suppliers/suppliers/:idAuthentication
Section titled “Authentication”Include your API key in the x-api-key header. See Authentication.
Required Scope
Section titled “Required Scope”suppliers:writePath Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Supplier ID. |
Request Body
Section titled “Request Body”Send only the fields you want to change. Omitted fields keep their current values. You must send a JSON body, even if it is {}.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Supplier name. |
description | string | null | No | Supplier description. Send null to clear it. |
isArchived | boolean | No | Archive (true) or restore (false) the supplier. |
Example Request Body
Section titled “Example Request Body”{ "name": "Updated Supplier Name", "description": "Updated supplier description", "isArchived": false}Example Request
Section titled “Example Request”curl -X PUT "https://api.crewsum.com/v1/suppliers/suppliers/supplier-stu123vwx4567890" \ -H "x-api-key: $CREWSUM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated Supplier Name", "description": "Updated supplier description", "isArchived": false }'const response = await fetch( "https://api.crewsum.com/v1/suppliers/suppliers/supplier-stu123vwx4567890", { method: "PUT", headers: { "x-api-key": process.env.CREWSUM_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ name: "Updated Supplier Name", description: "Updated supplier description", isArchived: false, }), },);const result = await response.json();PUT /v1/suppliers/suppliers/supplier-stu123vwx4567890 HTTP/1.1Host: api.crewsum.comx-api-key: <your-api-key>Content-Type: application/json
{ "name": "Updated Supplier Name", "description": "Updated supplier description", "isArchived": false}Response
Section titled “Response”On success, the API returns HTTP 200 OK.
Example Response
Section titled “Example Response”{ "message": "Successfully updated supplier: supplier-stu123vwx4567890"}Behavior
Section titled “Behavior”- Every successful call sets
updatedAtto the current time. - The API does not check that the supplier exists. An unknown ID still returns
200, nothing changes, and no webhook is sent. - Deleted suppliers can still be updated. This endpoint cannot restore a deleted supplier.
- The request body is not validated against a schema. Wrong types are stored as sent or cause a
500. - After an existing supplier is updated, Crewsum sends the
suppliers.updatedwebhook event. The payload is{ "suppliers": [<supplier>] }.
Error Responses
Section titled “Error Responses”| Status | Meaning |
|---|---|
400 | The ID path segment was empty (for example, a trailing slash). Message: SupplierID not specified. |
500 | Crewsum could not update the supplier. Message: Error updating supplier: <id>. If no request body is sent, the API returns a 500 with a generic error body instead. |
Authentication and scope failures are described in Errors.
Related Webhooks
Section titled “Related Webhooks” suppliers.updated View webhook event details.