# Assignments

List, read, create, update and remove assignments of consultants to projects through the TimeSubmit API, with charge and cost rates.

## The assignment object

A consultant on a project, with the rate charged and the rate paid.

```json
{
  "id": "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
  "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "rate": 760,
  "rateType": "daily",
  "costRate": 650,
  "costRateType": "daily",
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": null,
  "consultantPurchaseOrderNumber": "PO-C-0042",
  "createdAt": "2026-08-25T11:04:56.000Z"
}
```

Every field below is in every answer. A required field always has a value; a nullable one is `null` when it has none. More fields may be added within `/v1`, so have your code ignore any it doesn't recognise.

| Field | Type | About it |
| --- | --- | --- |
| `id` (required) | string | The assignment's id. |
| `projectId` (required) | string | The project. |
| `consultantId` (required) | string | The consultant. |
| `rate` (nullable) | number or null | The rate charged to the client. From 0 to 1000000. |
| `rateType` (nullable) | "hourly" \| "daily" or null | Whether `rate` is an hourly or a daily rate. |
| `costRate` (nullable) | number or null | The rate paid to the consultant. From 0 to 1000000. |
| `costRateType` (nullable) | "hourly" \| "daily" or null | Whether `costRate` is hourly or daily. |
| `currency` (nullable) | string or null | An ISO 4217 code. One of 7 values. Values: `GBP`, `USD`, `EUR`, `AUD`, `CAD`, `NZD`, `ZAR`. |
| `startDate` (nullable) | date (YYYY-MM-DD) or null | The day the consultant starts on the project. |
| `endDate` (nullable) | date (YYYY-MM-DD) or null | The day they finish. Not set through the API. |
| `consultantPurchaseOrderNumber` (nullable) | string or null | The consultancy's purchase order number to the consultant, quoted on their invoices. At most 60 characters. |
| `createdAt` (nullable) | time (ISO 8601) or null | When it was created. |

This list can grow within `/v1`, so ignore any you don't recognise rather than failing on it. See [versioning](https://www.timesubmit.com/developers/versioning).

## Operations

### `GET /assignments`

**List assignments.** A page of one project's or one consultant's assignments, or the one pair's when both are given. One of the two is required. Needs the `assignments:read` scope. Succeeds with 200, a page of them.

| Query parameter | Type | About it |
| --- | --- | --- |
| `projectId` (optional) | string | Only this project's assignments. |
| `consultantId` (optional) | string | Only this consultant's assignments. |
| `limit` (optional) | integer | How many to a page, 1 to 100. 25 when absent. From 1 to 100. |
| `cursor` (optional) | string | The `nextCursor` from the page before. |

Example request. The key is read from `TIMESUBMIT_API_KEY`:

curl:

```bash
curl 'https://www.timesubmit.com/api/v1/assignments' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY"
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/assignments", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
  },
});
const answer = await response.json();
```

Python:

```python
import os

import requests

response = requests.request(
    "GET",
    "https://www.timesubmit.com/api/v1/assignments",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "data": [
    {
      "id": "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
      "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
      "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
      "rate": 760,
      "rateType": "daily",
      "costRate": 650,
      "costRateType": "daily",
      "currency": "GBP",
      "startDate": "2026-09-01",
      "endDate": null,
      "consultantPurchaseOrderNumber": "PO-C-0042",
      "createdAt": "2026-08-25T11:04:56.000Z"
    }
  ],
  "nextCursor": "eyJjcmVhdGVkQXQiOjE3NjQwNjA4MDB9"
}
```

The [error codes](https://www.timesubmit.com/developers/errors) it can answer with:

- `unauthorised` (401)
- `api_not_included` (403)
- `insufficient_scope` (403)
- `not_found` (404)
- `invalid_request` (400)
- `rate_limited` (429)

### `GET /assignments/{id}`

**Read an assignment.** One assignment. Needs the `assignments:read` scope. Succeeds with 200.

Example request. The key is read from `TIMESUBMIT_API_KEY`:

curl:

```bash
curl 'https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY"
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
  },
});
const answer = await response.json();
```

Python:

```python
import os

import requests

response = requests.request(
    "GET",
    "https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "id": "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
  "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "rate": 760,
  "rateType": "daily",
  "costRate": 650,
  "costRateType": "daily",
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": null,
  "consultantPurchaseOrderNumber": "PO-C-0042",
  "createdAt": "2026-08-25T11:04:56.000Z"
}
```

The [error codes](https://www.timesubmit.com/developers/errors) it can answer with:

- `unauthorised` (401)
- `api_not_included` (403)
- `insufficient_scope` (403)
- `not_found` (404)
- `rate_limited` (429)

### `POST /assignments`

**Assign a consultant to a project.** One assignment per consultant per project: a second is 409 `already_exists`. Needs the `assignments:write` scope. Accepts an Idempotency-Key. Succeeds with 201.

The body is a JSON object. Any other field is refused with its name.

| Field | Type | About it |
| --- | --- | --- |
| `projectId` (required) | string | The project. |
| `consultantId` (required) | string | The consultant. |
| `rate` (optional, nullable) | number or null | The rate charged to the client. From 0 to 1000000. |
| `rateType` (optional, nullable) | "hourly" \| "daily" or null | Hourly or daily. Cleared with its rate; hourly when a rate is sent without one. |
| `costRate` (optional, nullable) | number or null | The rate paid to the consultant. Needs a `rate`. From 0 to 1000000. |
| `costRateType` (optional, nullable) | "hourly" \| "daily" or null | Whether `costRate` is hourly or daily. |
| `currency` (optional, nullable) | string or null | An ISO 4217 code. One of 7 values. Values: `GBP`, `USD`, `EUR`, `AUD`, `CAD`, `NZD`, `ZAR`. |
| `startDate` (optional, nullable) | date (YYYY-MM-DD) or null | The day the consultant starts on the project. |
| `consultantPurchaseOrderNumber` (optional, nullable) | string or null | On one line; trimmed; blank is none; at most 60 characters. At most 60 characters. |

This list can grow within `/v1`, so ignore any you don't recognise rather than failing on it. See [versioning](https://www.timesubmit.com/developers/versioning).

Example request, with a fresh Idempotency-Key each time it runs. The key is read from `TIMESUBMIT_API_KEY`:

curl:

```bash
curl -X POST 'https://www.timesubmit.com/api/v1/assignments' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "rate": 760,
  "rateType": "daily",
  "costRate": 650,
  "costRateType": "daily",
  "currency": "GBP",
  "startDate": "2026-09-01",
  "consultantPurchaseOrderNumber": "PO-C-0042"
}'
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/assignments", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
    "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
    "rate": 760,
    "rateType": "daily",
    "costRate": 650,
    "costRateType": "daily",
    "currency": "GBP",
    "startDate": "2026-09-01",
    "consultantPurchaseOrderNumber": "PO-C-0042"
  }),
});
const answer = await response.json();
```

Python:

```python
import os
import uuid

import requests

response = requests.request(
    "POST",
    "https://www.timesubmit.com/api/v1/assignments",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
        "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
        "rate": 760,
        "rateType": "daily",
        "costRate": 650,
        "costRateType": "daily",
        "currency": "GBP",
        "startDate": "2026-09-01",
        "consultantPurchaseOrderNumber": "PO-C-0042",
    },
)
answer = response.json()
```

Example response, with status 201:

```json
{
  "id": "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
  "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "rate": 760,
  "rateType": "daily",
  "costRate": 650,
  "costRateType": "daily",
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": null,
  "consultantPurchaseOrderNumber": "PO-C-0042",
  "createdAt": "2026-08-25T11:04:56.000Z"
}
```

The [error codes](https://www.timesubmit.com/developers/errors) it can answer with:

- `unauthorised` (401)
- `api_not_included` (403)
- `insufficient_scope` (403)
- `read_only` (403)
- `not_found` (404)
- `invalid_request` (400)
- `already_exists` (409)
- `idempotency_conflict` (409)
- `rate_limited` (429)

### `PATCH /assignments/{id}`

**Update an assignment.** Changes the fields sent and keeps the rest. A change of purchase order number is audited. Needs the `assignments:write` scope. Accepts an Idempotency-Key. Succeeds with 200.

The body is a JSON object. Send only the fields to change. Any other field is refused with its name.

| Field | Type | About it |
| --- | --- | --- |
| `rate` (optional, nullable) | number or null | The rate charged to the client. From 0 to 1000000. |
| `rateType` (optional, nullable) | "hourly" \| "daily" or null | Hourly or daily. Cleared with its rate; hourly when a rate is sent without one. |
| `costRate` (optional, nullable) | number or null | The rate paid to the consultant. Needs a `rate`. From 0 to 1000000. |
| `costRateType` (optional, nullable) | "hourly" \| "daily" or null | Whether `costRate` is hourly or daily. |
| `currency` (optional, nullable) | string or null | An ISO 4217 code. One of 7 values. Values: `GBP`, `USD`, `EUR`, `AUD`, `CAD`, `NZD`, `ZAR`. |
| `startDate` (optional, nullable) | date (YYYY-MM-DD) or null | The day the consultant starts on the project. |
| `consultantPurchaseOrderNumber` (optional, nullable) | string or null | On one line; trimmed; blank is none; at most 60 characters. At most 60 characters. |

This list can grow within `/v1`, so ignore any you don't recognise rather than failing on it. See [versioning](https://www.timesubmit.com/developers/versioning).

Example request, with a fresh Idempotency-Key each time it runs. The key is read from `TIMESUBMIT_API_KEY`:

curl:

```bash
curl -X PATCH 'https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "rate": 800,
  "costRate": 680
}'
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "rate": 800,
    "costRate": 680
  }),
});
const answer = await response.json();
```

Python:

```python
import os
import uuid

import requests

response = requests.request(
    "PATCH",
    "https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "rate": 800,
        "costRate": 680,
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "id": "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
  "projectId": "k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "rate": 800,
  "rateType": "daily",
  "costRate": 680,
  "costRateType": "daily",
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": null,
  "consultantPurchaseOrderNumber": "PO-C-0042",
  "createdAt": "2026-08-25T11:04:56.000Z"
}
```

The [error codes](https://www.timesubmit.com/developers/errors) it can answer with:

- `unauthorised` (401)
- `api_not_included` (403)
- `insufficient_scope` (403)
- `read_only` (403)
- `not_found` (404)
- `invalid_request` (400)
- `idempotency_conflict` (409)
- `rate_limited` (429)

### `DELETE /assignments/{id}`

**Remove an assignment.** Removes an assignment, as the dashboard does. Needs the `assignments:write` scope. Accepts an Idempotency-Key. Succeeds with 200.

It answers with:

| Field | Type | About it |
| --- | --- | --- |
| `id` (required) | string | The id of what was removed. |
| `removed` (required) | boolean | Always true. |

Example request, with a fresh Idempotency-Key each time it runs. The key is read from `TIMESUBMIT_API_KEY`:

curl:

```bash
curl -X DELETE 'https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
});
const answer = await response.json();
```

Python:

```python
import os
import uuid

import requests

response = requests.request(
    "DELETE",
    "https://www.timesubmit.com/api/v1/assignments/n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "id": "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
  "removed": true
}
```

The [error codes](https://www.timesubmit.com/developers/errors) it can answer with:

- `unauthorised` (401)
- `api_not_included` (403)
- `insufficient_scope` (403)
- `read_only` (403)
- `not_found` (404)
- `invalid_request` (400)
- `idempotency_conflict` (409)
- `rate_limited` (429)
