# User assignments

Put people on projects, choose who manages each project, and set each person's rate there. A user assignment puts a person on a project. A person on a project through a team is listed as well.

HTML version: https://t.momentic.studio/docs/api/user-assignments

## Endpoints

- `GET /api/v2/user_assignments`: [List user assignments](https://t.momentic.studio/docs/api/user-assignments#get-user-assignments)
- `GET /api/v2/projects/{project_id}/user_assignments`: [List a project's user assignments](https://t.momentic.studio/docs/api/user-assignments#get-projects-project-id-user-assignments)
- `GET /api/v2/projects/{project_id}/user_assignments/{user_assignment_id}`: [Retrieve a user assignment](https://t.momentic.studio/docs/api/user-assignments#get-projects-project-id-user-assignments-user-assignment-id)
- `POST /api/v2/projects/{project_id}/user_assignments`: [Assign a person to a project](https://t.momentic.studio/docs/api/user-assignments#post-projects-project-id-user-assignments)
- `PATCH /api/v2/projects/{project_id}/user_assignments/{user_assignment_id}`: [Update a user assignment](https://t.momentic.studio/docs/api/user-assignments#patch-projects-project-id-user-assignments-user-assignment-id)
- `DELETE /api/v2/projects/{project_id}/user_assignments/{user_assignment_id}`: [Remove a user assignment](https://t.momentic.studio/docs/api/user-assignments#delete-projects-project-id-user-assignments-user-assignment-id)

## List user assignments

`GET /api/v2/user_assignments`

Supported with differences. Scope: `reports:read`.

budget is null. A member is refused (403).

Query parameters:

| Name            | Type     | Required | Description                                                                                                    |
| --------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------- |
| `user_id`       | integer  | no       | Only this person's assignments.                                                                                |
| `is_active`     | boolean  | no       | true for active records only, false for archived only. Another value is ignored, as in Harvest.                |
| `updated_since` | datetime | no       | Only records changed at or after this ISO 8601 date-time. A value that is not a date-time is refused with 400. |
| `page`          | integer  | no       | The page to return, from 1. Default 1. A page past the end returns no records.                                 |
| `per_page`      | integer  | no       | Records per page, 1 to 2000. Default 2000. Another value is refused with 400.                                  |

Returns 200 with a page of user assignment objects under `user_assignments`.

Example request:

```bash
curl "https://t.momentic.studio/api/v2/user_assignments" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (admin@example.com)"
```

Example response, status 200:

```json
{
  "user_assignments": [
    {
      "id": 6001,
      "project": {
        "id": 3001,
        "name": "Website Refresh",
        "code": null
      },
      "user": {
        "id": 1001,
        "name": "Alex Example"
      },
      "is_active": true,
      "is_project_manager": false,
      "use_default_rates": true,
      "hourly_rate": 150,
      "budget": null,
      "created_at": "2026-01-05T15:00:00Z",
      "updated_at": "2026-01-05T15:00:00Z"
    }
  ],
  "per_page": 2000,
  "total_pages": 1,
  "total_entries": 1,
  "next_page": null,
  "previous_page": null,
  "page": 1,
  "links": {
    "first": "https://t.momentic.studio/api/v2/user_assignments?page=1&per_page=2000&ref=first",
    "next": null,
    "previous": null,
    "last": "https://t.momentic.studio/api/v2/user_assignments?page=1&per_page=2000&ref=last"
  }
}
```

## List a project's user assignments

`GET /api/v2/projects/{project_id}/user_assignments`

Supported with differences. Scope: `reports:read`.

Query parameters:

| Name            | Type     | Required | Description                                                                                                    |
| --------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------- |
| `user_id`       | integer  | no       | Only this person's assignment.                                                                                 |
| `is_active`     | boolean  | no       | true for active records only, false for archived only. Another value is ignored, as in Harvest.                |
| `updated_since` | datetime | no       | Only records changed at or after this ISO 8601 date-time. A value that is not a date-time is refused with 400. |
| `page`          | integer  | no       | The page to return, from 1. Default 1. A page past the end returns no records.                                 |
| `per_page`      | integer  | no       | Records per page, 1 to 2000. Default 2000. Another value is refused with 400.                                  |

Returns 200 with a page of user assignment objects under `user_assignments`.

Example request:

```bash
curl "https://t.momentic.studio/api/v2/projects/3001/user_assignments" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (admin@example.com)"
```

Example response, status 200:

```json
{
  "user_assignments": [
    {
      "id": 6001,
      "project": {
        "id": 3001,
        "name": "Website Refresh",
        "code": null
      },
      "user": {
        "id": 1001,
        "name": "Alex Example"
      },
      "is_active": true,
      "is_project_manager": false,
      "use_default_rates": true,
      "hourly_rate": 150,
      "budget": null,
      "created_at": "2026-01-05T15:00:00Z",
      "updated_at": "2026-01-05T15:00:00Z"
    }
  ],
  "per_page": 2000,
  "total_pages": 1,
  "total_entries": 1,
  "next_page": null,
  "previous_page": null,
  "page": 1,
  "links": {
    "first": "https://t.momentic.studio/api/v2/projects/3001/user_assignments?page=1&per_page=2000&ref=first",
    "next": null,
    "previous": null,
    "last": "https://t.momentic.studio/api/v2/projects/3001/user_assignments?page=1&per_page=2000&ref=last"
  }
}
```

## Retrieve a user assignment

`GET /api/v2/projects/{project_id}/user_assignments/{user_assignment_id}`

Supported with differences. Scope: `reports:read`.

Returns 200 with a user assignment object.

Example request:

```bash
curl "https://t.momentic.studio/api/v2/projects/3001/user_assignments/6001" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (admin@example.com)"
```

Example response, status 200:

```json
{
  "id": 6001,
  "project": {
    "id": 3001,
    "name": "Website Refresh",
    "code": null
  },
  "user": {
    "id": 1001,
    "name": "Alex Example"
  },
  "is_active": true,
  "is_project_manager": false,
  "use_default_rates": true,
  "hourly_rate": 150,
  "budget": null,
  "created_at": "2026-01-05T15:00:00Z",
  "updated_at": "2026-01-05T15:00:00Z"
}
```

## Assign a person to a project

`POST /api/v2/projects/{project_id}/user_assignments`

Supported with differences. Scope: `projects:write`.

is_project_manager needs an owner or admin token, as in the app. hourly_rate is the person's rate on the project when use_default_rates is false. budget is ignored.

Body, as JSON or form fields:

| Name                 | Type    | Required | Description                                      |
| -------------------- | ------- | -------- | ------------------------------------------------ |
| `user_id`            | integer | yes      | The person.                                      |
| `is_project_manager` | boolean | no       | true makes them a manager of the project.        |
| `use_default_rates`  | boolean | no       | false to use hourly_rate on this project.        |
| `hourly_rate`        | number  | no       | Their billable rate on this project, in dollars. |

Returns 201 with a user assignment object.

Example request:

```bash
curl -X POST "https://t.momentic.studio/api/v2/projects/3001/user_assignments" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (admin@example.com)" \
  -H "Content-Type: application/json" \
  -d '{"user_id":1001}'
```

Example response, status 201:

```json
{
  "id": 6001,
  "project": {
    "id": 3001,
    "name": "Website Refresh",
    "code": null
  },
  "user": {
    "id": 1001,
    "name": "Alex Example"
  },
  "is_active": true,
  "is_project_manager": false,
  "use_default_rates": true,
  "hourly_rate": 150,
  "budget": null,
  "created_at": "2026-01-05T15:00:00Z",
  "updated_at": "2026-01-05T15:00:00Z"
}
```

## Update a user assignment

`PATCH /api/v2/projects/{project_id}/user_assignments/{user_assignment_id}`

Supported with differences. Scope: `projects:write`.

is_active and budget are ignored: remove the assignment to take the person off the project.

Body, as JSON or form fields:

| Name                 | Type    | Required | Description                                 |
| -------------------- | ------- | -------- | ------------------------------------------- |
| `is_project_manager` | boolean | no       | true makes them a manager of the project.   |
| `use_default_rates`  | boolean | no       | true removes their own rate on the project. |
| `hourly_rate`        | number  | no       | Their billable rate on this project.        |

Returns 200 with a user assignment object.

Example request:

```bash
curl -X PATCH "https://t.momentic.studio/api/v2/projects/3001/user_assignments/6001" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (admin@example.com)"
```

Example response, status 200:

```json
{
  "id": 6001,
  "project": {
    "id": 3001,
    "name": "Website Refresh",
    "code": null
  },
  "user": {
    "id": 1001,
    "name": "Alex Example"
  },
  "is_active": true,
  "is_project_manager": false,
  "use_default_rates": true,
  "hourly_rate": 150,
  "budget": null,
  "created_at": "2026-01-05T15:00:00Z",
  "updated_at": "2026-01-05T15:00:00Z"
}
```

## Remove a user assignment

`DELETE /api/v2/projects/{project_id}/user_assignments/{user_assignment_id}`

Supported with differences. Scope: `projects:write`.

Allowed when the person has time on the project; their entries stay. A person on the project through a team stays on it.

Returns 200 with no body.

Example request:

```bash
curl -X DELETE "https://t.momentic.studio/api/v2/projects/3001/user_assignments/6001" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (admin@example.com)"
```

## The user assignment object

| Field                | Type                 | Description                                                                                                                                       |
| -------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                 | integer              | The assignment's id.                                                                                                                              |
| `project`            | object (project_ref) | The project.                                                                                                                                      |
| `user`               | object (user_ref)    | The person.                                                                                                                                       |
| `is_active`          | boolean              | False when the project or the person is archived.                                                                                                 |
| `is_project_manager` | boolean              | True when the person manages the project.                                                                                                         |
| `use_default_rates`  | boolean              | False when the person has their own rate on the project.                                                                                          |
| `hourly_rate`        | number or null       | The person's billable rate on the project. Null unless the token has rates:read and its person is an owner, an admin or a manager of the project. |
| `budget`             | number or null       | Null. The time tracker has no such data, so this is the empty value.                                                                              |
| `created_at`         | datetime             | When the record was created.                                                                                                                      |
| `updated_at`         | datetime             | When the record was last changed.                                                                                                                 |

## The project ref object

| Field  | Type           | Description         |
| ------ | -------------- | ------------------- |
| `id`   | integer        | The project's id.   |
| `name` | string         | The project's name. |
| `code` | string or null | Null.               |

## The user ref object

| Field  | Type    | Description        |
| ------ | ------- | ------------------ |
| `id`   | integer | The person's id.   |
| `name` | string  | The person's name. |
