Delete Association
This endpoint permanently deletes a project-to-contact association. You identify the association by the project ID in the path and the contact ID in the body or query string.
Endpoint
Section titled “Endpoint”DELETE /v1/associations/associations/:idAuthentication
Section titled “Authentication”Include your API key in the x-api-key header. See Authentication.
Required Scope
Section titled “Required Scope”associations:writePath Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Project ID. |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
contactId | string | No | Contact ID. Use this or contactId in the body. |
Request Body
Section titled “Request Body”You must send a JSON body with Content-Type: application/json, even when you pass contactId in the query string. Send at least {}. A request with no body returns 500.
| Field | Type | Required | Description |
|---|---|---|---|
contactId | string | No | Contact ID. Required here if it is not in the query string. If it is in both places, the values must match. |
projectId | string | No | If provided, it must match the route id. |
Example Request Body
Section titled “Example Request Body”{ "contactId": "contact-jkl123mno4567890"}Example Request
Section titled “Example Request”curl -X DELETE "https://api.crewsum.com/v1/associations/associations/project-mno123pqr4567890" \ -H "x-api-key: $CREWSUM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "contactId": "contact-jkl123mno4567890" }'const response = await fetch( "https://api.crewsum.com/v1/associations/associations/project-mno123pqr4567890", { method: "DELETE", headers: { "x-api-key": process.env.CREWSUM_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ contactId: "contact-jkl123mno4567890", }), },);const result = await response.json();DELETE /v1/associations/associations/project-mno123pqr4567890 HTTP/1.1Host: api.crewsum.comx-api-key: <your-api-key>Content-Type: application/json
{ "contactId": "contact-jkl123mno4567890"}Response
Section titled “Response”On success, the API returns HTTP 200 OK.
Example Response
Section titled “Example Response”{ "message": "Successfully deleted association between project-mno123pqr4567890 and contact-jkl123mno4567890"}Behavior
Section titled “Behavior”- This is a permanent delete. The association is removed and cannot be read again with Get Association.
- If your account has no association for the project and contact, the API returns
404. - After the association is deleted, Crewsum emits the
associations.removedwebhook event. The event’sassociationsarray is currently always empty, because the event data is read after the association is removed. Record the project and contact IDs from your own request if you need them. A webhook delivery failure does not change the API response.
Error Responses
Section titled “Error Responses”| Status | Meaning |
|---|---|
400 | contactId must be supplied: contactId was not in the body or the query string. |
400 | projectId in request body must match the route id. |
400 | contactId in request body must match the query string. |
400 | The request had Content-Type: application/json and an empty body. Send at least {}. |
404 | Your account has no association for the project and contact. The message is Association between <projectId> and <contactId> not found. |
500 | The request had no JSON body. |
500 | Crewsum could not delete the association. The message is Error deleting association between <projectId> and <contactId>. |
Authentication and scope failures are described in Errors.
Related Webhooks
Section titled “Related Webhooks” associations.removed View webhook event details.