Client purchase orders
List, read, record, amend, close and delete client purchase orders through the TimeSubmit API: filters, the budget figures one answers with, and its change history.
The client purchase order object
A client's purchase order: the budget and dates your receivables bill against.
{
"id": "q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"currency": "GBP",
"startDate": "2026-09-01",
"endDate": "2027-02-26",
"budget": 60000,
"closedDate": null,
"dateStatus": "active",
"createdAt": "2026-08-28T14:16:03.000Z",
"updatedAt": "2026-10-12T09:22:48.000Z",
"status": "active",
"invoiced": {
"amount": 15200
},
"committed": {
"amount": 7600,
"hours": 80,
"unpricedHours": 0
},
"pending": {
"amount": 3800,
"hours": 40,
"unpricedHours": 0
},
"remaining": 37200,
"usedPercent": 38,
"incomplete": false,
"invoices": [
{
"id": "p15v8x2z5b9d3f7h1k4m6q0s3u5w8y2a",
"invoiceNumber": "INV-0107",
"amount": 7600
},
{
"id": "t52g8j1m4p7s0u3w6y9b2d5f8h1k4n7q",
"invoiceNumber": "INV-0098",
"amount": 7600
}
]
}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.
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 client's purchase order number. | ||||||||||||
clientId required | string | The client that issued it. | ||||||||||||
projectIds required | string[] | The client's projects it covers, 1 to 50. | ||||||||||||
currency required | string | An ISO 4217 code: the client's invoicing currency when it was recorded. 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 | What its receivables ask for before tax, 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). | ||||||||||||
Show the 1 fields of | ||||||||||||||
| Field | Type | About it |
|---|---|---|
invoiced.amount required | number | The amount invoiced. |
committed requiredShow the 3 fields of committed
| Field | Type | About it |
|---|---|---|
committed.amount required | number | Its value at the bill rates a receivable would charge, 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 requiredShow the 3 fields of pending
| Field | Type | About it |
|---|---|---|
pending.amount required | number | Its value at the bill rates a receivable would charge, 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 nullableusedPercent nullableincomplete requiredinvoices[] requiredShow the 3 fields of invoices[]
| Field | Type | About it |
|---|---|---|
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 | What it draws from the budget: its total before tax. |
This list can grow within /v1, so ignore any you don't recognise rather than failing on it. See versioning.
Operations
GET /client-purchase-orders
List client purchase orders. A page of your organisation's client 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 |
|---|---|---|
clientId optional | string | Only this client's purchase orders. |
projectId optional | string | Only those covering this project. |
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 projectId, the one purchase order a timesheet period starting that day bills against, 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.
Example request. The key is read from TIMESUBMIT_API_KEY:
curl 'https://www.timesubmit.com/api/v1/client-purchase-orders' \
-H "Authorization: Bearer $TIMESUBMIT_API_KEY"const response = await fetch("https://www.timesubmit.com/api/v1/client-purchase-orders", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
},
});
const answer = await response.json();import os
import requests
response = requests.request(
"GET",
"https://www.timesubmit.com/api/v1/client-purchase-orders",
headers={
"Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
},
)
answer = response.json()Example response, with status 200:
{
"data": [
{
"id": "q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"currency": "GBP",
"startDate": "2026-09-01",
"endDate": "2027-02-26",
"budget": 60000,
"closedDate": null,
"dateStatus": "active",
"createdAt": "2026-08-28T14:16:03.000Z",
"updatedAt": "2026-10-12T09:22:48.000Z"
}
],
"nextCursor": "eyJjcmVhdGVkQXQiOjE3NjQwNjA4MDB9"
}The error codes 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 /client-purchase-orders/{id}
Read a client purchase order. One client purchase order with the figures its dashboard page shows: invoiced, committed, pending, remaining and the used percentage, its full status, and the receivables drawn on it. 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 'https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j' \
-H "Authorization: Bearer $TIMESUBMIT_API_KEY"const response = await fetch("https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
},
});
const answer = await response.json();import os
import requests
response = requests.request(
"GET",
"https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
headers={
"Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
},
)
answer = response.json()Example response, with status 200:
{
"id": "q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"currency": "GBP",
"startDate": "2026-09-01",
"endDate": "2027-02-26",
"budget": 60000,
"closedDate": null,
"dateStatus": "active",
"createdAt": "2026-08-28T14:16:03.000Z",
"updatedAt": "2026-10-12T09:22:48.000Z",
"status": "active",
"invoiced": {
"amount": 15200
},
"committed": {
"amount": 7600,
"hours": 80,
"unpricedHours": 0
},
"pending": {
"amount": 3800,
"hours": 40,
"unpricedHours": 0
},
"remaining": 37200,
"usedPercent": 38,
"incomplete": false,
"invoices": [
{
"id": "p15v8x2z5b9d3f7h1k4m6q0s3u5w8y2a",
"invoiceNumber": "INV-0107",
"amount": 7600
},
{
"id": "t52g8j1m4p7s0u3w6y9b2d5f8h1k4n7q",
"invoiceNumber": "INV-0098",
"amount": 7600
}
]
}The error codes it can answer with:
unauthorised(401)api_not_included(403)insufficient_scope(403)not_on_plan(403)not_found(404)rate_limited(429)
GET /client-purchase-orders/{id}/changes
List a client 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" | "projectIds" | "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, projectIds 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, projectIds 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.
Example request. The key is read from TIMESUBMIT_API_KEY:
curl 'https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j/changes' \
-H "Authorization: Bearer $TIMESUBMIT_API_KEY"const response = await fetch("https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j/changes", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
},
});
const answer = await response.json();import os
import requests
response = requests.request(
"GET",
"https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j/changes",
headers={
"Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
},
)
answer = response.json()Example response, with status 200:
{
"data": [
{
"field": "budget",
"before": 48000,
"after": 60000,
"reason": "Phase two scope agreed with procurement.",
"changedBy": "Hannah Okafor",
"changedAt": "2026-10-12T09:22:48.000Z"
}
],
"nextCursor": "eyJjcmVhdGVkQXQiOjE3NjQwNjA4MDB9"
}The error codes 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 /client-purchase-orders
Record a client purchase order. Records a client's purchase order for some of its projects. Its currency is the client's invoicing currency, as the dashboard sets it, and is not accepted. A duplicate number is 409 already_exists; a project that is not your organisation's is 404 not_found; any other rule broken, such as an overlap or a project of another client, 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 |
|---|---|---|
clientId required | string | The client that issued it. |
number required | string | The client's purchase order number, on one line, trimmed, at most 60 characters. Unique for the client: a second is 409 already_exists. It cannot change once an invoice quotes it. At most 60 characters. |
projectIds required | string[] | The client's projects it covers, 1 to 50, none archived when added. A project has one purchase order at a time, so the dates cannot overlap another's on the same project. |
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 the client's currency. More than zero; absent or null for none. |
Example request, with a fresh Idempotency-Key each time it runs. The key is read from TIMESUBMIT_API_KEY:
curl -X POST 'https://www.timesubmit.com/api/v1/client-purchase-orders' \
-H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"startDate": "2026-09-01",
"budget": 60000
}'const response = await fetch("https://www.timesubmit.com/api/v1/client-purchase-orders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"startDate": "2026-09-01",
"budget": 60000
}),
});
const answer = await response.json();import os
import uuid
import requests
response = requests.request(
"POST",
"https://www.timesubmit.com/api/v1/client-purchase-orders",
headers={
"Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t",
],
"startDate": "2026-09-01",
"budget": 60000,
},
)
answer = response.json()Example response, with status 201:
{
"id": "q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"currency": "GBP",
"startDate": "2026-09-01",
"endDate": null,
"budget": 60000,
"closedDate": null,
"dateStatus": "active",
"createdAt": "2026-08-28T14:16:03.000Z",
"updatedAt": "2026-10-12T09:22:48.000Z",
"status": "active",
"invoiced": {
"amount": 0
},
"committed": {
"amount": 0,
"hours": 0,
"unpricedHours": 0
},
"pending": {
"amount": 0,
"hours": 0,
"unpricedHours": 0
},
"remaining": 60000,
"usedPercent": 0,
"incomplete": false,
"invoices": []
}The error codes 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 /client-purchase-orders/{id}
Amend a client 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 is invoiced, the dates must still cover every period invoiced against it, a project with time drawn on it cannot be removed, and a closed one cannot be changed. 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 | The client's purchase order number, on one line, trimmed, at most 60 characters. Unique for the client: a second is 409 already_exists. It cannot change once an invoice quotes it. At most 60 characters. |
projectIds optional | string[] | The client's projects it covers, 1 to 50, none archived when added. A project has one purchase order at a time, so the dates cannot overlap another's on the same project. |
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 the client's 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 -X PATCH 'https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j' \
-H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"budget": 72000,
"reason": "Phase two scope agreed with procurement."
}'const response = await fetch("https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"budget": 72000,
"reason": "Phase two scope agreed with procurement."
}),
});
const answer = await response.json();import os
import uuid
import requests
response = requests.request(
"PATCH",
"https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
headers={
"Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"budget": 72000,
"reason": "Phase two scope agreed with procurement.",
},
)
answer = response.json()Example response, with status 200:
{
"id": "q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"currency": "GBP",
"startDate": "2026-09-01",
"endDate": "2027-02-26",
"budget": 72000,
"closedDate": null,
"dateStatus": "active",
"createdAt": "2026-08-28T14:16:03.000Z",
"updatedAt": "2026-10-12T09:22:48.000Z",
"status": "active",
"invoiced": {
"amount": 15200
},
"committed": {
"amount": 7600,
"hours": 80,
"unpricedHours": 0
},
"pending": {
"amount": 3800,
"hours": 40,
"unpricedHours": 0
},
"remaining": 49200,
"usedPercent": 31,
"incomplete": false,
"invoices": [
{
"id": "p15v8x2z5b9d3f7h1k4m6q0s3u5w8y2a",
"invoiceNumber": "INV-0107",
"amount": 7600
},
{
"id": "t52g8j1m4p7s0u3w6y9b2d5f8h1k4n7q",
"invoiceNumber": "INV-0098",
"amount": 7600
}
]
}The error codes 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 /client-purchase-orders/{id}/close
Close a client 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 period invoiced against 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 -X POST 'https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j/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."
}'const response = await fetch("https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j/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();import os
import uuid
import requests
response = requests.request(
"POST",
"https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j/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:
{
"id": "q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
"number": "FL-PO-2291",
"clientId": "j57c2m8q4t1w9y3z6b0d5f7h2k4n8p1r",
"projectIds": [
"k93d6f1h8j2m5q7s0v4x6z9b3c1e8g2t"
],
"currency": "GBP",
"startDate": "2026-09-01",
"endDate": "2027-02-26",
"budget": 60000,
"closedDate": "2026-11-30",
"dateStatus": "closed",
"createdAt": "2026-08-28T14:16:03.000Z",
"updatedAt": "2026-10-12T09:22:48.000Z",
"status": "closed",
"invoiced": {
"amount": 15200
},
"committed": {
"amount": 7600,
"hours": 80,
"unpricedHours": 0
},
"pending": {
"amount": 3800,
"hours": 40,
"unpricedHours": 0
},
"remaining": 37200,
"usedPercent": 38,
"incomplete": false,
"invoices": [
{
"id": "p15v8x2z5b9d3f7h1k4m6q0s3u5w8y2a",
"invoiceNumber": "INV-0107",
"amount": 7600
},
{
"id": "t52g8j1m4p7s0u3w6y9b2d5f8h1k4n7q",
"invoiceNumber": "INV-0098",
"amount": 7600
}
]
}The error codes 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 /client-purchase-orders/{id}
Delete a client purchase order. Deletes one nothing has drawn on, with its history: no invoice 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 -X DELETE 'https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j' \
-H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"const response = await fetch("https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.TIMESUBMIT_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
},
});
const answer = await response.json();import os
import uuid
import requests
response = requests.request(
"DELETE",
"https://www.timesubmit.com/api/v1/client-purchase-orders/q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
headers={
"Authorization": f"Bearer {os.environ['TIMESUBMIT_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
)
answer = response.json()Example response, with status 200:
{
"id": "q47b1d4f8h2k6m9p3s5v7x0z4c6e9g1j",
"removed": true
}The error codes 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)