Create Supplier Contact
This endpoint creates a contact for a supplier and returns the generated supplier contact ID.
Endpoint
Section titled “Endpoint”POST /v1/supplier-contacts/supplier-contactsAuthentication
Section titled “Authentication”Include your API key in the x-api-key header. See Authentication.
Required Scope
Section titled “Required Scope”supplier-contacts:writeRequest Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
supplierId | string | Yes | ID of a supplier in your account. If no supplier in your account has this ID, the API returns 400 and creates nothing. If the field is missing, the API returns 500. |
name | string | Yes | Contact name. If it is missing, the API returns 500. |
email | string | Yes | Contact email address. If it is missing, the API returns 500. The format is not checked. |
description | string | No | Contact description. Stored as null when omitted. |
Example Request Body
Section titled “Example Request Body”{ "supplierId": "supplier-stu123vwx4567890", "name": "Supplier Contact Name", "email": "placeholder@example.com", "description": "A brief description of the supplier contact"}Example Request
Section titled “Example Request”curl -X POST "https://api.crewsum.com/v1/supplier-contacts/supplier-contacts" \ -H "x-api-key: $CREWSUM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "supplierId": "supplier-stu123vwx4567890", "name": "Supplier Contact Name", "email": "placeholder@example.com", "description": "A brief description of the supplier contact" }'const response = await fetch( "https://api.crewsum.com/v1/supplier-contacts/supplier-contacts", { method: "POST", headers: { "x-api-key": process.env.CREWSUM_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ supplierId: "supplier-stu123vwx4567890", name: "Supplier Contact Name", email: "placeholder@example.com", description: "A brief description of the supplier contact", }), },);const result = await response.json();POST /v1/supplier-contacts/supplier-contacts HTTP/1.1Host: api.crewsum.comx-api-key: <your-api-key>Content-Type: application/json
{ "supplierId": "supplier-stu123vwx4567890", "name": "Supplier Contact Name", "email": "placeholder@example.com", "description": "A brief description of the supplier contact"}Response
Section titled “Response”On success, the API returns HTTP 200 OK. This endpoint does not return 201.
Example Response
Section titled “Example Response”The response message currently contains the misspelling Sucessfully. Do not match on the message text.
{ "message": "Sucessfully created supplier contact: suppliercontact-vwx123yza4567890", "data": { "supplierContactId": "suppliercontact-vwx123yza4567890" }}Behavior
Section titled “Behavior”- The API generates the contact ID in the format
suppliercontact-<16 hex characters>. - New contacts are active (
isArchived: false) and haveupdatedAt: null. - The request body is not validated against a schema. Wrong types are stored as sent or cause a
500. - After the contact is created, Crewsum sends the
supplier-contacts.createdwebhook event. The payload is{ "contacts": [{ "supplier": <supplier>, "supplierContact": <contact> }] }.
Error Responses
Section titled “Error Responses”| Status | Meaning |
|---|---|
400 | No supplier in your account has this supplierId. Nothing is created. Message: Supplier not found. |
500 | Crewsum could not create the contact, for example because a required field was missing. Message: Error doing thing. 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” supplier-contacts.created View webhook event details.