List User Assignments
This endpoint returns project and task assignments for one or more users, grouped by user ID.
Endpoint
Section titled “Endpoint”GET /v1/user-assignments/user-assignmentsAuthentication
Section titled “Authentication”Include your API key in the x-api-key header. See Authentication.
Required Scope
Section titled “Required Scope”user-assignments:readQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
userId | string | string[] | No | One user ID, a repeated parameter, or a comma-separated list. |
userIds | string | string[] | No | Same as userId. You can use either parameter, or both. |
You must send at least one user ID through userId or userIds. This endpoint does not support paging or sorting.
Request Body
Section titled “Request Body”This endpoint does not accept a request body.
Example Request
Section titled “Example Request”curl "https://api.crewsum.com/v1/user-assignments/user-assignments?userIds=user-a,user-b" \ -H "x-api-key: $CREWSUM_API_KEY"const response = await fetch( "https://api.crewsum.com/v1/user-assignments/user-assignments?userIds=user-a,user-b", { headers: { "x-api-key": process.env.CREWSUM_API_KEY, }, },);const result = await response.json();GET /v1/user-assignments/user-assignments?userIds=user-a,user-b HTTP/1.1Host: api.crewsum.comx-api-key: <your-api-key>Response
Section titled “Response”On success, the API returns HTTP 200 OK.
Example Response
Section titled “Example Response”{ "message": "Successfully fetched user assignments", "data": { "assignmentsByUserId": { "user-a": [ { "id": "project-mno123pqr4567890", "name": "Project Name", "source": { "type": "direct" }, "groupSources": [], "tasks": [ { "id": "task-pqr123stu4567890", "name": "Task Name", "source": { "type": "direct" }, "groupSources": [] } ] } ], "user-b": [] } }}Behavior
Section titled “Behavior”- Crewsum combines the values of
userIdanduserIds, splits them on commas, trims spaces, and removes duplicates. - Each key in
assignmentsByUserIdis a user ID exactly as you sent it, after trimming. Keys are not changed to lowercase. - Each value has the same shape as
assignmentson Get User Assignments, including assignments from user groups. - An unknown user ID returns an empty array. It is not an error.
Error Responses
Section titled “Error Responses”| Status | Meaning |
|---|---|
400 | "At least one userId must be supplied": no user ID was sent. |
500 | "Error fetching user assignments": the request failed. |
Authentication and scope failures are described in Errors.
Related Webhooks
Section titled “Related Webhooks”This endpoint does not trigger a webhook.