# Task assignments

Choose which tasks a project offers and whether each one is billable on that project. A task assignment adds a task to a project's task list.

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

## Endpoints

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

## List task assignments

`GET /api/v2/task_assignments`

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

budget and hourly_rate are null: a task rate applies to projects billed by task, which the time tracker does not have. A member is refused (403).

Query parameters:

| Name            | Type     | Required | Description                                                                                                    |
| --------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------- |
| `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 task assignment objects under `task_assignments`.

Example request:

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

Example response, status 200:

```json
{
  "task_assignments": [
    {
      "id": 5001,
      "project": {
        "id": 3001,
        "name": "Website Refresh",
        "code": null
      },
      "task": {
        "id": 4001,
        "name": "Design"
      },
      "is_active": true,
      "billable": true,
      "hourly_rate": null,
      "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/task_assignments?page=1&per_page=2000&ref=first",
    "next": null,
    "previous": null,
    "last": "https://t.momentic.studio/api/v2/task_assignments?page=1&per_page=2000&ref=last"
  }
}
```

## List a project's task assignments

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

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

Query parameters:

| Name            | Type     | Required | Description                                                                                                    |
| --------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------- |
| `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 task assignment objects under `task_assignments`.

Example request:

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

Example response, status 200:

```json
{
  "task_assignments": [
    {
      "id": 5001,
      "project": {
        "id": 3001,
        "name": "Website Refresh",
        "code": null
      },
      "task": {
        "id": 4001,
        "name": "Design"
      },
      "is_active": true,
      "billable": true,
      "hourly_rate": null,
      "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/task_assignments?page=1&per_page=2000&ref=first",
    "next": null,
    "previous": null,
    "last": "https://t.momentic.studio/api/v2/projects/3001/task_assignments?page=1&per_page=2000&ref=last"
  }
}
```

## Retrieve a task assignment

`GET /api/v2/projects/{project_id}/task_assignments/{task_assignment_id}`

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

Returns 200 with a task assignment object.

Example request:

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

Example response, status 200:

```json
{
  "id": 5001,
  "project": {
    "id": 3001,
    "name": "Website Refresh",
    "code": null
  },
  "task": {
    "id": 4001,
    "name": "Design"
  },
  "is_active": true,
  "billable": true,
  "hourly_rate": null,
  "budget": null,
  "created_at": "2026-01-05T15:00:00Z",
  "updated_at": "2026-01-05T15:00:00Z"
}
```

## Add a task to a project

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

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

hourly_rate and budget are ignored: rates are set on people and projects.

Body, as JSON or form fields:

| Name       | Type    | Required | Description                                                                        |
| ---------- | ------- | -------- | ---------------------------------------------------------------------------------- |
| `task_id`  | integer | yes      | The task.                                                                          |
| `billable` | boolean | no       | Whether time on the task is billable on this project. Default: the task's default. |

Returns 201 with a task assignment object.

Example request:

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

Example response, status 201:

```json
{
  "id": 5001,
  "project": {
    "id": 3001,
    "name": "Website Refresh",
    "code": null
  },
  "task": {
    "id": 4001,
    "name": "Design"
  },
  "is_active": true,
  "billable": true,
  "hourly_rate": null,
  "budget": null,
  "created_at": "2026-01-05T15:00:00Z",
  "updated_at": "2026-01-05T15:00:00Z"
}
```

## Update a task assignment

`PATCH /api/v2/projects/{project_id}/task_assignments/{task_assignment_id}`

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

Changes billable. is_active, hourly_rate and budget are ignored.

Body, as JSON or form fields:

| Name       | Type    | Required | Description                                           |
| ---------- | ------- | -------- | ----------------------------------------------------- |
| `billable` | boolean | no       | Whether time on the task is billable on this project. |

Returns 200 with a task assignment object.

Example request:

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

Example response, status 200:

```json
{
  "id": 5001,
  "project": {
    "id": 3001,
    "name": "Website Refresh",
    "code": null
  },
  "task": {
    "id": 4001,
    "name": "Design"
  },
  "is_active": true,
  "billable": true,
  "hourly_rate": null,
  "budget": null,
  "created_at": "2026-01-05T15:00:00Z",
  "updated_at": "2026-01-05T15:00:00Z"
}
```

## Remove a task from a project

`DELETE /api/v2/projects/{project_id}/task_assignments/{task_assignment_id}`

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

Refused (422) while the project has entries on the task, as in Harvest.

Returns 200 with no body.

Example request:

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

## The task assignment object

| Field         | Type                 | Description                                                                                                                                                                                           |
| ------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`          | integer              | The task assignment's id.                                                                                                                                                                             |
| `project`     | object (project_ref) | The project.                                                                                                                                                                                          |
| `task`        | object (task_ref)    | The task.                                                                                                                                                                                             |
| `is_active`   | boolean              | False when the task or the project is archived.                                                                                                                                                       |
| `billable`    | boolean              | Whether time on the task is billable on this project.                                                                                                                                                 |
| `hourly_rate` | number or null       | Null: a task rate applies to projects billed by task, which the time tracker does not have. The rate is on the project and the person. The time tracker has no such data, so this is the empty value. |
| `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 task ref object

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