# Consultant purchase orders

List, read, record, amend, close and delete consultant purchase orders through the TimeSubmit API: filters, the payables drawn on one, its change history, and how they relate to an assignment's typed number.

## The consultant purchase order object

Your purchase order to a consultant: the budget and dates their payables bill against.

```json
{
  "id": "s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
  "number": "CPO-0031",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "assignmentIds": [
    "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
  ],
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": "2027-02-26",
  "budget": 52000,
  "closedDate": null,
  "dateStatus": "active",
  "createdAt": "2026-08-28T14:31:40.000Z",
  "updatedAt": "2026-10-12T09:25:11.000Z",
  "status": "active",
  "invoiced": {
    "amount": 13000
  },
  "committed": {
    "amount": 6500,
    "hours": 80,
    "unpricedHours": 0
  },
  "pending": {
    "amount": 3250,
    "hours": 40,
    "unpricedHours": 0
  },
  "remaining": 32500,
  "usedPercent": 37,
  "incomplete": false,
  "invoices": [
    {
      "id": "u74h0k3n6q9s2v5x8z1c4e7g0j3m6p9r",
      "invoiceNumber": "TW-2026-10",
      "amount": 6500,
      "share": 6500
    },
    {
      "id": "v16j2m5p8r1u4w7y0b3d6f9h2k5n8q1s",
      "invoiceNumber": "TW-2026-09",
      "amount": 6500,
      "share": 6500
    }
  ]
}
```

A list answers each purchase order without `invoiced`, `committed`, `pending`, `remaining`, `usedPercent`, `incomplete` and `invoices`, and its `status` is the date status, never `exhausted`; reading one answers all of it.

A write by a key without `purchase_orders:read` answers only `{ id, status }`, and that `status` is the date status, never `exhausted`. Reading the purchase order by id answers its full `status`, which is `exhausted` when it is in force with nothing left of its budget.

`invoiced` is money drawn on the budget. For the hours or days behind it, read the invoices' lines with `GET /invoices/{id}`: each line has a `quantity` and a `unit`.

Each item in `invoices` is a payable: `amount` is its own total before tax, as on the invoice, and `share` is what it drew from this purchase order. A payable whose weeks fall under more than one purchase order has a share on each.

An assignment can also carry a typed `consultantPurchaseOrderNumber`, which is a reference with no dates, budget or figures. The two are separate and neither changes the other. When a payable is raised, each week of time draws on the consultant purchase order covering its assignment on the day the week starts, and the payable quotes that purchase order's number. The assignment's typed number is quoted only for time no consultant purchase order covers. A payable's `consultantPurchaseOrderNumbers` lists the covering purchase orders' numbers first, then any typed ones, and its `consultantPurchaseOrders` holds the ids you can read here.

A payable is in one currency. When a consultant's time in one period is covered by purchase orders in different currencies, it is raised as one payable per currency, so the same period can appear on two payables. Each bills only its own currency's projects, draws only on purchase orders in its currency, and is checked against their budgets on its own.

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 purchase order's id. |
| `number` (required) | string | The consultancy's purchase order number to the consultant, which their payables quote. |
| `consultantId` (required) | string | The consultant it is issued to. |
| `assignmentIds` (required) | string[] | The consultant's assignments it covers, 1 to 50. |
| `currency` (required) | string | An ISO 4217 code, chosen when it was recorded (by default the consultant's preferred currency) and never changed. Every figure is in it. |
| `startDate` (required) | date (YYYY-MM-DD) | The first day it covers. |
| `endDate` (nullable) | date (YYYY-MM-DD) or null | The last day it covers. Null when open-ended. |
| `budget` (nullable) | number or null | The most it authorises, before tax. Null when it has none. |
| `closedDate` (nullable) | date (YYYY-MM-DD) or null | The day it was closed from: time from then on is not covered. Null unless closed. |
| `dateStatus` (required) | "not_started" \| "active" \| "expiring" \| "expired" \| "closed" | What its dates say today: not started, active, expiring (30 days or fewer to its last day), expired or closed. |
| `createdAt` (nullable) | time (ISO 8601) or null | When it was recorded. |
| `updatedAt` (nullable) | time (ISO 8601) or null | When it last changed. |
| `status` (required) | "not_started" \| "active" \| "expiring" \| "expired" \| "closed" \| "exhausted" | The date status, except that one in force with nothing left of its budget is exhausted. |
| `invoiced` (required) | object | The shares its payables drew on it, drafts included and discarded ones left out. Invoiced is money drawn on the budget; for the hours or days behind it, read the invoices' lines (`GET /invoices/{id}`, each line has `quantity` and `unit`). |
| `invoiced.amount` (required) | number | The amount invoiced. |
| `committed` (required) | object | Approved time it covers that no invoice has claimed yet. |
| `committed.amount` (required) | number | Its value at the cost rates a payable would charge, else the bill rates, before tax. |
| `committed.hours` (required) | number | Its hours. |
| `committed.unpricedHours` (required) | number | Hours with no rate to price them, counted here and worth nothing in `amount`. |
| `pending` (required) | object | Submitted time it covers, not yet approved. It does not reduce `remaining`. Where the organisation has turned on "Purchase orders control consultants' time", it counts when a timesheet is submitted: a timesheet whose time, added to invoiced, committed and pending, would pass the budget is refused. |
| `pending.amount` (required) | number | Its value at the cost rates a payable would charge, else the bill rates, before tax. |
| `pending.hours` (required) | number | Its hours. |
| `pending.unpricedHours` (required) | number | Hours with no rate to price them, counted here and worth nothing in `amount`. |
| `remaining` (nullable) | number or null | The budget less invoiced and committed. Null when it has no budget. |
| `usedPercent` (nullable) | integer or null | Invoiced plus committed as a whole percentage of the budget, rounded down. Null when it has no budget. |
| `incomplete` (required) | boolean | True when a figure reached a read limit (5,000 time entries, 1,500 timesheets or 1,000 invoices), so it is a floor, not the whole. |
| `invoices[]` (required) | array of objects | The payables drawn on it, newest first, discarded ones left out. |
| `invoices[].id` (required) | string | The invoice's id, for `GET /invoices/{id}`. |
| `invoices[].invoiceNumber` (required) | string | The number printed on it. |
| `invoices[].amount` (required) | number | The payable's own total before tax, all of its weeks, as on the invoice. |
| `invoices[].share` (required) | number | What it drew from this purchase order, before tax, fixed when it was raised. A payable's shares add up to its total before tax where every week it bills is covered. |

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 /consultant-purchase-orders`

**List consultant purchase orders.** A page of your organisation's consultant purchase orders, in the order they were recorded, with their date status and no figures: read one for those. A filtered page can hold fewer than `limit`, or none, while `nextCursor` leads on. Needs purchase orders on your plan. Needs the `purchase_orders:read` scope. Succeeds with 200, a page of them.

| Query parameter | Type | About it |
| --- | --- | --- |
| `consultantId` (optional) | string | Only this consultant's purchase orders. |
| `assignmentId` (optional) | string | Only those covering this assignment. |
| `status` (optional) | "not_started" \| "active" \| "expiring" \| "expired" \| "closed" | Only those with this date status today. |
| `covers` (optional) | date (YYYY-MM-DD) | Only those covering this day. With `assignmentId`, the one purchase order a timesheet period starting that day draws on, or none. |
| `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. |

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. The key is read from `TIMESUBMIT_API_KEY`:

curl:

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

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/consultant-purchase-orders", {
  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/consultant-purchase-orders",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "data": [
    {
      "id": "s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
      "number": "CPO-0031",
      "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
      "assignmentIds": [
        "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
      ],
      "currency": "GBP",
      "startDate": "2026-09-01",
      "endDate": "2027-02-26",
      "budget": 52000,
      "closedDate": null,
      "dateStatus": "active",
      "createdAt": "2026-08-28T14:31:40.000Z",
      "updatedAt": "2026-10-12T09:25:11.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_on_plan` (403)
- `not_found` (404)
- `invalid_request` (400)
- `rate_limited` (429)

### `GET /consultant-purchase-orders/{id}`

**Read a consultant purchase order.** One consultant purchase order with the figures its dashboard page shows: invoiced, committed, pending, remaining and the used percentage, its full status, and the payables drawn on it with each one's share. Needs purchase orders on your plan. Needs the `purchase_orders:read` scope. Succeeds with 200.

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

curl:

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

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l", {
  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/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "id": "s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
  "number": "CPO-0031",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "assignmentIds": [
    "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
  ],
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": "2027-02-26",
  "budget": 52000,
  "closedDate": null,
  "dateStatus": "active",
  "createdAt": "2026-08-28T14:31:40.000Z",
  "updatedAt": "2026-10-12T09:25:11.000Z",
  "status": "active",
  "invoiced": {
    "amount": 13000
  },
  "committed": {
    "amount": 6500,
    "hours": 80,
    "unpricedHours": 0
  },
  "pending": {
    "amount": 3250,
    "hours": 40,
    "unpricedHours": 0
  },
  "remaining": 32500,
  "usedPercent": 37,
  "incomplete": false,
  "invoices": [
    {
      "id": "u74h0k3n6q9s2v5x8z1c4e7g0j3m6p9r",
      "invoiceNumber": "TW-2026-10",
      "amount": 6500,
      "share": 6500
    },
    {
      "id": "v16j2m5p8r1u4w7y0b3d6f9h2k5n8q1s",
      "invoiceNumber": "TW-2026-09",
      "amount": 6500,
      "share": 6500
    }
  ]
}
```

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

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

### `GET /consultant-purchase-orders/{id}/changes`

**List a consultant purchase order's changes.** A page of the purchase order's history, oldest first: one change per field changed, with what it was, what it became, the reason, when, and who made it, a person by name or an API key by its name. Recording it is not a change. Needs purchase orders on your plan. Needs the `purchase_orders:read` scope. Succeeds with 200, a page of them.

| Query parameter | Type | About it |
| --- | --- | --- |
| `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. |

It answers with:

| Field | Type | About it |
| --- | --- | --- |
| `field` (required) | "number" \| "startDate" \| "endDate" \| "budget" \| "assignmentIds" \| "closedDate" | The purchase order field that changed. A change of several fields at once is one change per field. |
| `before` (nullable) | string or number or string[] or null | The field's value before the change, in the type the purchase order answers it with: `number` a string, a date `YYYY-MM-DD`, `budget` a number, `assignmentIds` an array of ids. Null when it had none. |
| `after` (nullable) | string or number or string[] or null | The field's value after it, in the type the purchase order answers it with: `number` a string, a date `YYYY-MM-DD`, `budget` a number, `assignmentIds` an array of ids. Null when it had none. |
| `reason` (nullable) | string or null | Why, as given. A change of the budget or a date, and a close, always has one. |
| `changedBy` (required) | string | Who made it: a person's name, or an API key's name followed by "(API key)". Never an email address. A platform admin's name is masked, as it is everywhere in the dashboard, a person with no name on record reads as "Unknown", and one since removed as "Former user". |
| `changedAt` (required) | time (ISO 8601) | When it was made. |

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. The key is read from `TIMESUBMIT_API_KEY`:

curl:

```bash
curl 'https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l/changes' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY"
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l/changes", {
  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/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l/changes",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "data": [
    {
      "field": "budget",
      "before": 45000,
      "after": 52000,
      "reason": "Phase two scope agreed with procurement.",
      "changedBy": "Hannah Okafor",
      "changedAt": "2026-10-12T09:22:48.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_on_plan` (403)
- `not_found` (404)
- `invalid_request` (400)
- `rate_limited` (429)

### `POST /consultant-purchase-orders`

**Record a consultant purchase order.** Records your purchase order to a consultant for some of their assignments, in the currency sent, else the consultant's preferred currency, as the dashboard defaults to. A duplicate number is 409 `already_exists`; an assignment that is not your organisation's is 404 `not_found`; any other rule broken, such as an overlap or an assignment of another consultant, is 400 `invalid_request` in the dashboard's words. Needs purchase orders on your plan. Needs the `purchase_orders: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 |
| --- | --- | --- |
| `consultantId` (required) | string | The consultant it is issued to. |
| `number` (required) | string | Your purchase order number to the consultant, on one line, trimmed, at most 60 characters. Unique for the consultant: a second is 409 `already_exists`. It cannot change once a payable quotes it. At most 60 characters. |
| `assignmentIds` (required) | string[] | The consultant's assignments it covers, 1 to 50, every one that consultant's and none on an archived project when added. An assignment has one purchase order at a time, so the dates cannot overlap another's on the same assignment. |
| `startDate` (required) | date (YYYY-MM-DD) | The first day it covers. |
| `endDate` (optional, nullable) | date (YYYY-MM-DD) or null | The last day it covers. Absent or null for open-ended. |
| `budget` (optional, nullable) | number or null | The most it authorises, before tax, in its currency. More than zero; absent or null for none. |
| `currency` (optional, nullable) | string or null | An ISO 4217 code: the currency its budget and figures are in. Absent or null for the consultant's preferred currency, else GBP. It cannot be changed once recorded. One of 7 values. Values: `GBP`, `USD`, `EUR`, `AUD`, `CAD`, `NZD`, `ZAR`. |

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/consultant-purchase-orders' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "CPO-0031",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "assignmentIds": [
    "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
  ],
  "startDate": "2026-09-01",
  "budget": 52000
}'
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/consultant-purchase-orders", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "number": "CPO-0031",
    "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
    "assignmentIds": [
      "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
    ],
    "startDate": "2026-09-01",
    "budget": 52000
  }),
});
const answer = await response.json();
```

Python:

```python
import os
import uuid

import requests

response = requests.request(
    "POST",
    "https://www.timesubmit.com/api/v1/consultant-purchase-orders",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "number": "CPO-0031",
        "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
        "assignmentIds": [
            "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x",
        ],
        "startDate": "2026-09-01",
        "budget": 52000,
    },
)
answer = response.json()
```

Example response, with status 201:

```json
{
  "id": "s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
  "number": "CPO-0031",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "assignmentIds": [
    "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
  ],
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": null,
  "budget": 52000,
  "closedDate": null,
  "dateStatus": "active",
  "createdAt": "2026-08-28T14:31:40.000Z",
  "updatedAt": "2026-10-12T09:25:11.000Z",
  "status": "active",
  "invoiced": {
    "amount": 0
  },
  "committed": {
    "amount": 0,
    "hours": 0,
    "unpricedHours": 0
  },
  "pending": {
    "amount": 0,
    "hours": 0,
    "unpricedHours": 0
  },
  "remaining": 52000,
  "usedPercent": 0,
  "incomplete": false,
  "invoices": []
}
```

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_on_plan` (403)
- `not_found` (404)
- `invalid_request` (400)
- `already_exists` (409)
- `idempotency_conflict` (409)
- `rate_limited` (429)

### `PATCH /consultant-purchase-orders/{id}`

**Amend a consultant purchase order.** Changes the fields sent and keeps the rest, each change kept in its history. `null` clears an end date or a budget. The budget cannot go below what its payables have drawn, the dates must still cover every week a payable drew on it, an assignment with time drawn on it cannot be removed, and a closed one cannot be changed. Its currency cannot change: `currency` is refused, so delete one nothing has drawn on and record it again instead. Needs purchase orders on your plan. Needs the `purchase_orders: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 |
| --- | --- | --- |
| `number` (optional) | string | Your purchase order number to the consultant, on one line, trimmed, at most 60 characters. Unique for the consultant: a second is 409 `already_exists`. It cannot change once a payable quotes it. At most 60 characters. |
| `assignmentIds` (optional) | string[] | The consultant's assignments it covers, 1 to 50, every one that consultant's and none on an archived project when added. An assignment has one purchase order at a time, so the dates cannot overlap another's on the same assignment. |
| `startDate` (optional) | date (YYYY-MM-DD) | The first day it covers. |
| `endDate` (optional, nullable) | date (YYYY-MM-DD) or null | The last day it covers. Absent or null for open-ended. |
| `budget` (optional, nullable) | number or null | The most it authorises, before tax, in its currency. More than zero; absent or null for none. |
| `reason` (optional) | string | Why, kept in its history. Required when the budget or a date changes. At most 500 characters. |

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/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "budget": 60000,
  "reason": "Phase two scope agreed with procurement."
}'
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "budget": 60000,
    "reason": "Phase two scope agreed with procurement."
  }),
});
const answer = await response.json();
```

Python:

```python
import os
import uuid

import requests

response = requests.request(
    "PATCH",
    "https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "budget": 60000,
        "reason": "Phase two scope agreed with procurement.",
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "id": "s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
  "number": "CPO-0031",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "assignmentIds": [
    "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
  ],
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": "2027-02-26",
  "budget": 60000,
  "closedDate": null,
  "dateStatus": "active",
  "createdAt": "2026-08-28T14:31:40.000Z",
  "updatedAt": "2026-10-12T09:25:11.000Z",
  "status": "active",
  "invoiced": {
    "amount": 13000
  },
  "committed": {
    "amount": 6500,
    "hours": 80,
    "unpricedHours": 0
  },
  "pending": {
    "amount": 3250,
    "hours": 40,
    "unpricedHours": 0
  },
  "remaining": 40500,
  "usedPercent": 32,
  "incomplete": false,
  "invoices": [
    {
      "id": "u74h0k3n6q9s2v5x8z1c4e7g0j3m6p9r",
      "invoiceNumber": "TW-2026-10",
      "amount": 6500,
      "share": 6500
    },
    {
      "id": "v16j2m5p8r1u4w7y0b3d6f9h2k5n8q1s",
      "invoiceNumber": "TW-2026-09",
      "amount": 6500,
      "share": 6500
    }
  ]
}
```

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_on_plan` (403)
- `not_found` (404)
- `invalid_request` (400)
- `already_exists` (409)
- `idempotency_conflict` (409)
- `rate_limited` (429)

### `POST /consultant-purchase-orders/{id}/close`

**Close a consultant purchase order.** Closes it from a day: time from then on is not covered, and a replacement may start that day. It cannot be undone, and cannot leave a week a payable drew on it uncovered. Needs purchase orders on your plan. Needs the `purchase_orders:write` scope. Accepts an Idempotency-Key. Succeeds with 200.

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

| Field | Type | About it |
| --- | --- | --- |
| `closedDate` (required) | date (YYYY-MM-DD) | The first day it no longer covers: on or after its start, and not after its end. |
| `reason` (required) | string | Why, kept in its history. Required. At most 500 characters. |

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/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l/close' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "closedDate": "2026-11-30",
  "reason": "Replaced by the purchase order for phase two."
}'
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l/close", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "closedDate": "2026-11-30",
    "reason": "Replaced by the purchase order for phase two."
  }),
});
const answer = await response.json();
```

Python:

```python
import os
import uuid

import requests

response = requests.request(
    "POST",
    "https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l/close",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "closedDate": "2026-11-30",
        "reason": "Replaced by the purchase order for phase two.",
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "id": "s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
  "number": "CPO-0031",
  "consultantId": "m24p7r9t3w6y8a1c5e0g2j4l7n9q3s6v",
  "assignmentIds": [
    "n68s1u4w7y0b3d6f9h2k5m8p1r4t7v0x"
  ],
  "currency": "GBP",
  "startDate": "2026-09-01",
  "endDate": "2027-02-26",
  "budget": 52000,
  "closedDate": "2026-11-30",
  "dateStatus": "closed",
  "createdAt": "2026-08-28T14:31:40.000Z",
  "updatedAt": "2026-10-12T09:25:11.000Z",
  "status": "closed",
  "invoiced": {
    "amount": 13000
  },
  "committed": {
    "amount": 6500,
    "hours": 80,
    "unpricedHours": 0
  },
  "pending": {
    "amount": 3250,
    "hours": 40,
    "unpricedHours": 0
  },
  "remaining": 32500,
  "usedPercent": 37,
  "incomplete": false,
  "invoices": [
    {
      "id": "u74h0k3n6q9s2v5x8z1c4e7g0j3m6p9r",
      "invoiceNumber": "TW-2026-10",
      "amount": 6500,
      "share": 6500
    },
    {
      "id": "v16j2m5p8r1u4w7y0b3d6f9h2k5n8q1s",
      "invoiceNumber": "TW-2026-09",
      "amount": 6500,
      "share": 6500
    }
  ]
}
```

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_on_plan` (403)
- `not_found` (404)
- `invalid_request` (400)
- `idempotency_conflict` (409)
- `rate_limited` (429)

### `DELETE /consultant-purchase-orders/{id}`

**Delete a consultant purchase order.** Deletes one nothing has drawn on, with its history: no payable raised against it, discarded ones included, and no approved time it covers. Close one that has been drawn on instead. Needs purchase orders on your plan. Needs the `purchase_orders: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/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l' \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

JavaScript:

```javascript
const response = await fetch("https://www.timesubmit.com/api/v1/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l", {
  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/consultant-purchase-orders/s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
    headers={
        "Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
)
answer = response.json()
```

Example response, with status 200:

```json
{
  "id": "s29f3h6k9m2p5r8t1v4x7z0c3e6g9j2l",
  "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_on_plan` (403)
- `not_found` (404)
- `invalid_request` (400)
- `idempotency_conflict` (409)
- `rate_limited` (429)
