Skip to content

Create Contact

This endpoint creates a contact and returns the generated contact ID.

POST /v1/contacts/contacts

Include your API key in the x-api-key header. See Authentication.

contacts:write

The server validates the request body. A body that fails validation returns 400 with {"message": "Error parsing body"}. Unknown fields are ignored.

FieldTypeRequiredDescription
type"EXTERNAL" | "INTERNAL"NoContact record type. Defaults to "EXTERNAL".
namestringExternal onlyContact name. Must not be blank for external contacts. Ignored for internal contacts, which use the linked user’s full name.
emailstringExternal onlyContact email address. Must not be blank for external contacts. Leading and trailing spaces are removed. Ignored for internal contacts, which return the linked user’s email.
userIdstring | nullInternal onlyID of the user to link. Accepts the user ID (for example user-a) or the internal <tenantId>#<userId> form. The user must belong to your account. Ignored for external contacts.
clientIdstring | nullNoClient to assign the contact to. Omit it or send null to create the contact without a client. A client that does not exist in your account, or is deleted, returns 400.
descriptionstring | nullNoContact description. Defaults to null.
isArchivedbooleanNoCreates the contact in an archived state when true. Defaults to false.

External contact:

{
"type": "EXTERNAL",
"clientId": "client-ghi123jkl4567890",
"name": "Contact Name",
"email": "placeholder@example.com",
"description": "A brief description of the contact",
"isArchived": false
}

Internal contact:

{
"type": "INTERNAL",
"userId": "user-a",
"description": "Internal project reviewer"
}
Terminal window
curl -X POST "https://api.crewsum.com/v1/contacts/contacts" \
-H "x-api-key: $CREWSUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "EXTERNAL",
"clientId": "client-ghi123jkl4567890",
"name": "Contact Name",
"email": "placeholder@example.com",
"description": "A brief description of the contact",
"isArchived": false
}'

On success, the API returns HTTP 201 Created.

{
"message": "Successfully created contact: contact-jkl123mno4567890",
"data": {
"contactId": "contact-jkl123mno4567890"
}
}
  • The API generates the contact ID in the format contact-<16 hex characters>.
  • External contacts store their name and email on the contact record.
  • Internal contacts link to a user in your account. The contact takes its name from the user’s full name, and responses return the user’s email. Responses return userId in the internal <tenantId>#<userId> form, for example acme#user-a.
  • If clientId is set, the client must exist in your account and must not be deleted. Otherwise the API returns 400 with Client not found and creates nothing. Contacts created without a client return null for the client fields.
  • The contact is created with portal access turned off (hasPortalAccess: false). Use Update Contact to turn it on.
  • After the contact is created, Crewsum attempts to send the project-contacts.created webhook event. A webhook failure does not change the response.
StatusMeaning
400{"message": "Error parsing body"}. The body failed validation: type is not "EXTERNAL" or "INTERNAL", a field has the wrong type, an external contact has a blank name or email, or an internal contact has no userId. The response does not say which field failed.
400{"message": "Internal contact user must belong to the current tenant"}. No user with this userId exists in your account.
400{"message": "Client not found"}. No client with this clientId exists in your account, or the client is deleted. Nothing is created.
500{"message": "Error creating contact"}. Crewsum could not create the contact.

Authentication and scope failures are described in Errors.