Delete User Assignments
This endpoint removes all of a user’s direct project and task assignments.
Endpoint
Section titled “Endpoint”DELETE /v1/user-assignments/user-assignments/:idAuthentication
Section titled “Authentication”Include your API key in the x-api-key header. See Authentication.
Required Scope
Section titled “Required Scope”user-assignments:writePath Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | User whose direct assignments are removed. |
Request Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
userId | string | No | If you send it, it must match the route id. |
Example Request Body
Section titled “Example Request Body”{ "userId": "user-a"}Example Request
Section titled “Example Request”curl -X DELETE "https://api.crewsum.com/v1/user-assignments/user-assignments/user-a" \ -H "x-api-key: $CREWSUM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "userId": "user-a" }'const response = await fetch( "https://api.crewsum.com/v1/user-assignments/user-assignments/user-a", { method: "DELETE", headers: { "x-api-key": process.env.CREWSUM_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ userId: "user-a", }), },);const result = await response.json();DELETE /v1/user-assignments/user-assignments/user-a HTTP/1.1Host: api.crewsum.comx-api-key: <your-api-key>Content-Type: application/json
{ "userId": "user-a"}Response
Section titled “Response”On success, the API returns HTTP 200 OK.
Example Response
Section titled “Example Response”{ "message": "Successfully deleted user assignments for user-a", "data": { "userId": "user-a" }}Behavior
Section titled “Behavior”- Crewsum removes every direct project and task assignment for the user.
- Assignments the user receives through user groups are not removed. To remove those, remove the user from the group with Set User Group Users or Update User.
- An unknown user ID returns
200. Nothing is removed.
Error Responses
Section titled “Error Responses”| Status | Meaning |
|---|---|
400 | "UserID missing": the ID path segment was empty. |
400 | "userId in request body must match the route id": userId in the body is different from the route id. |
500 | "Error deleting user assignments for <userId>": the request failed. |
500 | A request with no body returns Fastify’s default error body, for example { "statusCode": 500, "error": "Internal Server Error", "message": "Cannot read properties of undefined (reading 'userId')" }. |
Authentication and scope failures are described in Errors.
Related Webhooks
Section titled “Related Webhooks”This endpoint does not trigger a webhook.