Projects
Projects billed by the hour: a customer's projects with their hourly rates and the rates of named people, the hours people book day by day on their weeks, the weeks approved by the AI reviewer or a person, and the approved hours not yet invoiced drafted as one sales invoice of the project.
| Operation | Summary | Scope | Idempotency-Key |
|---|---|---|---|
GET /v1/projects |
List projects | read |
|
POST /v1/projects |
Start a project | draft |
required |
GET /v1/projects/{project_id} |
Get a project | read |
|
PATCH /v1/projects/{project_id} |
Change a project | draft |
|
POST /v1/projects/{project_id}/invoice |
Invoice a project's hours | draft |
required |
GET /v1/projects/{project_id}/unbilled |
Hours not yet invoiced | read |
|
POST /v1/time-entries |
Book hours | draft |
required |
PATCH /v1/time-entries/{time_entry_id} |
Change booked hours | draft |
|
DELETE /v1/time-entries/{time_entry_id} |
Remove booked hours | draft |
|
GET /v1/timesheets |
List time sheets | read |
|
GET /v1/timesheets/{timesheet_id} |
Get a time sheet | read |
|
POST /v1/timesheets/{timesheet_id}/submit |
Submit a week | draft |
GET /v1/projects
List projects
The projects by company and code, with their rates, the hours booked and the approved hours not yet invoiced.
| Required scope | read (admin implies every scope) |
| Operation id | list_projects_v1_projects_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| query | entity |
string or null | Only this company's (code or id). | |
| query | customer |
string or null | Only this customer's (code or id; with entity). |
|
| query | active |
boolean or null | true: only open; false: only closed. |
Example request
curl "$ERP_URL/v1/projects" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of ProjectOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"code": "string",
"name": "string",
"customer": "string",
"customer_name": "string",
"currency": "string",
"hourly_rate": "string",
"rates": [
{
"person": "string",
"name": "string",
"hourly_rate": "string"
}
],
"product": "string",
"active": true,
"hours": "string",
"unbilled_hours": "string",
"unbilled_amount": "string",
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
]
POST /v1/projects
Start a project
Start a customer's project billed by the hour, in the customer's currency, at an hourly
rate. Its code is the next project number (PR-00001) unless one is given. Nothing is
posted. Needs an Idempotency-Key.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | required |
| Operation id | create_project_v1_projects_post |
Request body
application/json (required): ProjectInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the company that does the work. (min length 1) |
customer |
string | yes | Code (or id) of the customer: the hours are invoiced to it, in its currency. (min length 1) |
name |
string | yes | What the project is called: Scanner rollout. (min length 1; max length 200) |
hourly_rate |
decimal string | yes | Net price of one hour in the project's currency (the customer's). (min 0) |
code |
string or null | The project's code; omitted: the next project number (PR-00001). (min length 1; max length 40) |
|
product |
string or null | Code (or id) of a service product the invoice lines name, for its revenue account and VAT rate type; omitted: lines without a product, at the standard rate, booked to the customer's or the company's revenue account. |
Example request
curl -X POST "$ERP_URL/v1/projects" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"customer": "C-CH",
"entity": "CH01",
"hourly_rate": "180.00",
"name": "Scanner rollout"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | ProjectOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"code": "string",
"name": "string",
"customer": "string",
"customer_name": "string",
"currency": "string",
"hourly_rate": "string",
"rates": [
{
"person": "string",
"name": "string",
"hourly_rate": "string"
}
],
"product": "string",
"active": true,
"hours": "string",
"unbilled_hours": "string",
"unbilled_amount": "string",
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
GET /v1/projects/{project_id}
Get a project
The project with its rates, the hours booked and the approved hours not yet invoiced.
| Required scope | read (admin implies every scope) |
| Operation id | get_project_v1_projects__project_id__get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | project_id |
string (uuid) | yes | Id of the project (GET /v1/projects). |
Example request
curl "$ERP_URL/v1/projects/{project_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | ProjectOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"code": "string",
"name": "string",
"customer": "string",
"customer_name": "string",
"currency": "string",
"hourly_rate": "string",
"rates": [
{
"person": "string",
"name": "string",
"hourly_rate": "string"
}
],
"product": "string",
"active": true,
"hours": "string",
"unbilled_hours": "string",
"unbilled_amount": "string",
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
PATCH /v1/projects/{project_id}
Change a project
Set its name, hourly rate, the rates of named people or its product, or close it (no new hours) and open it again. Its customer and currency never change.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | update_project_v1_projects__project_id__patch |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | project_id |
string (uuid) | yes | Id of the project (GET /v1/projects). |
Request body
application/json (required): ProjectUpdate
| Field | Type | Required | Description |
|---|---|---|---|
name |
string or null | Its name. (min length 1; max length 200) | |
hourly_rate |
decimal string or null | Net price of one hour in the project's currency (the customer's). (min 0) | |
rates |
array of PersonRate or null |
The rates of named people, replacing those set before ([] removes them all); everyone else is billed at hourly_rate. Hours not yet invoiced are billed at the rates in force when they are invoiced. (max items 200) |
|
product |
string or null | Code (or id) of the service product the invoice lines name. | |
active |
boolean or null | false closes the project: no hours are booked on it any more; what was booked is still approved and invoiced. |
Example request
curl -X PATCH "$ERP_URL/v1/projects/{project_id}" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{
"hourly_rate": "190.00"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | ProjectOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"code": "string",
"name": "string",
"customer": "string",
"customer_name": "string",
"currency": "string",
"hourly_rate": "string",
"rates": [
{
"person": "string",
"name": "string",
"hourly_rate": "string"
}
],
"product": "string",
"active": true,
"hours": "string",
"unbilled_hours": "string",
"unbilled_amount": "string",
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
POST /v1/projects/{project_id}/invoice
Invoice a project's hours
Draft one sales invoice to the project's customer of its approved, billable hours not yet
invoiced, up to until (default today): a line for each person, their hours at their rate.
422 (project_nothing_to_invoice) when there are none. The invoice is a draft, posted and
sent like any other; rejected, its hours are invoiced again. Needs an Idempotency-Key.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | required |
| Operation id | invoice_project_v1_projects__project_id__invoice_post |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | project_id |
string (uuid) | yes | Id of the project (GET /v1/projects). |
Request body
application/json (required): ProjectInvoiceInput
| Field | Type | Required | Description |
|---|---|---|---|
until |
string (date) or null | Bill the hours up to this day; omitted: up to today. |
Example request
curl -X POST "$ERP_URL/v1/projects/{project_id}/invoice" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | ProjectInvoiceOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"invoice": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"number": "string",
"status": "string",
"total": "string",
"currency": "string"
},
"hours": "string",
"entries": 1
}
GET /v1/projects/{project_id}/unbilled
Hours not yet invoiced
The approved, billable hours not yet invoiced, by person, at their rates today: the lines
POST .../invoice would draft. Nothing is drafted.
| Required scope | read (admin implies every scope) |
| Operation id | project_unbilled_v1_projects__project_id__unbilled_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | project_id |
string (uuid) | yes | Id of the project (GET /v1/projects). |
| query | until |
string (date) or null | Up to this day; default today. |
Example request
curl "$ERP_URL/v1/projects/{project_id}/unbilled" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | UnbilledOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project": "string",
"currency": "string",
"until": "2026-09-21",
"lines": [
{
"person": "string",
"person_name": "string",
"hours": "string",
"hourly_rate": "string",
"amount": "string",
"first_day": "2026-09-21",
"last_day": "2026-09-21"
}
],
"hours": "string",
"amount": "string"
}
POST /v1/time-entries
Book hours
Book the caller's hours on an open project for a day (default today), on their week in
the project's company. 409 (timesheet_not_open) when that week is submitted or approved,
(project_closed) when the project is closed. Needs an Idempotency-Key.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | required |
| Operation id | create_time_entry_v1_time_entries_post |
Request body
application/json (required): TimeEntryInput
| Field | Type | Required | Description |
|---|---|---|---|
project |
string | yes | Code (PR-00001) or id of an open project. By its code with entity when the organization has more than one company. (min length 1) |
entity |
string or null | Code (or id) of the company, to find a project by its code. | |
day |
string (date) or null | The day worked; omitted: today. | |
hours |
decimal string | yes | Hours worked, e.g. 1.5 (more than 0, at most 24, two decimals). (max 24; greater than 0) |
description |
string or null | What was done. (min length 1; max length 500) | |
billable |
boolean | false: worked, but not invoiced to the customer. (default true) |
Example request
curl -X POST "$ERP_URL/v1/time-entries" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"description": "Workshop with IT",
"hours": "2.5",
"project": "PR-00001"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | TimeEntryOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"timesheet_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project": "string",
"project_name": "string",
"customer_name": "string",
"person": "string",
"person_name": "string",
"day": "2026-09-21",
"hours": "string",
"description": "string",
"billable": true,
"invoice": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"number": "string",
"status": "string",
"total": "string",
"currency": "string"
},
"created_at": "2026-09-21T09:30:00Z"
}
PATCH /v1/time-entries/{time_entry_id}
Change booked hours
Change one's own hours while their week is open: the project, another day of the week,
the hours, what was done, whether it is billable. 403 (time_entry_not_yours), 409
(timesheet_not_open).
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | update_time_entry_v1_time_entries__time_entry_id__patch |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | time_entry_id |
string (uuid) | yes | Id of the time entry. |
Request body
application/json (required): TimeEntryUpdate
| Field | Type | Required | Description |
|---|---|---|---|
project |
string or null | Code (PR-00001) or id of an open project. By its code with entity when the organization has more than one company. |
|
day |
string (date) or null | Another day of the same week. | |
hours |
decimal string or null | Hours worked, e.g. 1.5 (more than 0, at most 24, two decimals). (max 24; greater than 0) |
|
description |
string or null | What was done; empty removes it. (max length 500) | |
billable |
boolean or null | Whether it is invoiced. |
Example request
curl -X PATCH "$ERP_URL/v1/time-entries/{time_entry_id}" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{
"hours": "3"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | TimeEntryOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"timesheet_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project": "string",
"project_name": "string",
"customer_name": "string",
"person": "string",
"person_name": "string",
"day": "2026-09-21",
"hours": "string",
"description": "string",
"billable": true,
"invoice": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"number": "string",
"status": "string",
"total": "string",
"currency": "string"
},
"created_at": "2026-09-21T09:30:00Z"
}
DELETE /v1/time-entries/{time_entry_id}
Remove booked hours
Remove one's own hours while their week is open (audited); answers the week.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | delete_time_entry_v1_time_entries__time_entry_id__delete |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | time_entry_id |
string (uuid) | yes | Id of the time entry. |
Example request
curl -X DELETE "$ERP_URL/v1/time-entries/{time_entry_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | TimesheetOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"person": "string",
"person_name": "string",
"week": "2026-09-21",
"status": "approved",
"hours": "string",
"billable_hours": "string",
"entries": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"timesheet_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project": "string",
"project_name": "string",
"customer_name": "string",
"person": "string",
"person_name": "string",
"day": "2026-09-21",
"hours": "string",
"description": "string",
"billable": true,
"invoice": null,
"created_at": "2026-09-21T09:30:00Z"
}
],
"approval_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"review": {},
"comment": "string",
"submitted_at": "2026-09-21T09:30:00Z",
"decided_by": {},
"decided_at": "2026-09-21T09:30:00Z"
}
GET /v1/timesheets
List time sheets
People's weeks, the newest first, with their hours by day, status and the reviewer's checks. A week appears once hours are booked on it.
| Required scope | read (admin implies every scope) |
| Operation id | list_timesheets_v1_timesheets_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| query | entity |
string or null | Only this company's (code or id). | |
| query | mine |
boolean | Only the caller's own weeks. (default false) |
|
| query | week |
string (date) or null | Only the week of this day (it starts on its Monday). | |
| query | status |
"approved" | "open" | "submitted" or null |
Only open, submitted or approved weeks. |
|
| query | limit |
integer | How many, the newest week first. (min 1; max 2000; default 200) |
Example request
curl "$ERP_URL/v1/timesheets" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of TimesheetOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"person": "string",
"person_name": "string",
"week": "2026-09-21",
"status": "approved",
"hours": "string",
"billable_hours": "string",
"entries": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"timesheet_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project": "string",
"project_name": "string",
"customer_name": "string",
"person": "string",
"person_name": "string",
"day": "2026-09-21",
"hours": "string",
"description": null,
"billable": true,
"invoice": null,
"created_at": "2026-09-21T09:30:00Z"
}
],
"approval_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"review": {},
"comment": "string",
"submitted_at": "2026-09-21T09:30:00Z",
"decided_by": {},
"decided_at": "2026-09-21T09:30:00Z"
}
]
GET /v1/timesheets/{timesheet_id}
Get a time sheet
The week with its hours, status and the reviewer's checks.
| Required scope | read (admin implies every scope) |
| Operation id | get_timesheet_v1_timesheets__timesheet_id__get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | timesheet_id |
string (uuid) | yes | Id of the week (GET /v1/timesheets). |
Example request
curl "$ERP_URL/v1/timesheets/{timesheet_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | TimesheetOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"person": "string",
"person_name": "string",
"week": "2026-09-21",
"status": "approved",
"hours": "string",
"billable_hours": "string",
"entries": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"timesheet_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project": "string",
"project_name": "string",
"customer_name": "string",
"person": "string",
"person_name": "string",
"day": "2026-09-21",
"hours": "string",
"description": "string",
"billable": true,
"invoice": null,
"created_at": "2026-09-21T09:30:00Z"
}
],
"approval_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"review": {},
"comment": "string",
"submitted_at": "2026-09-21T09:30:00Z",
"decided_by": {},
"decided_at": "2026-09-21T09:30:00Z"
}
POST /v1/timesheets/{timesheet_id}/submit
Submit a week
Submit one's own open week for approval. With the AI reviewer it is approved at once
when no day has more than 12 hours, the week no more than 60 and every project is open;
else it waits in Approvals (POST /v1/approvals/{approval_id}/approve or /reject) for
a person. 409 (timesheet_not_open), 422 (timesheet_empty).
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | submit_timesheet_v1_timesheets__timesheet_id__submit_post |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | timesheet_id |
string (uuid) | yes | Id of the week (GET /v1/timesheets). |
Example request
curl -X POST "$ERP_URL/v1/timesheets/{timesheet_id}/submit" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | TimesheetOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"person": "string",
"person_name": "string",
"week": "2026-09-21",
"status": "approved",
"hours": "string",
"billable_hours": "string",
"entries": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"timesheet_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project": "string",
"project_name": "string",
"customer_name": "string",
"person": "string",
"person_name": "string",
"day": "2026-09-21",
"hours": "string",
"description": "string",
"billable": true,
"invoice": null,
"created_at": "2026-09-21T09:30:00Z"
}
],
"approval_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"review": {},
"comment": "string",
"submitted_at": "2026-09-21T09:30:00Z",
"decided_by": {},
"decided_at": "2026-09-21T09:30:00Z"
}
Schemas
InvoiceRef
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Id of the sales invoice (GET /v1/documents/{id}). |
number |
string or null | yes | Its number; null while it is a draft. |
status |
string | yes | draft, pending_approval, posted or rejected. |
total |
string | yes | Its total in currency. |
currency |
string | yes | ISO 4217 code. |
PersonRate
| Field | Type | Required | Description |
|---|---|---|---|
person |
string (uuid) | yes | The person's user id (GET /v1/people). |
hourly_rate |
decimal string | yes | Net price of one hour in the project's currency (the customer's). (min 0) |
PersonRateOut
| Field | Type | Required | Description |
|---|---|---|---|
person |
string | yes | The person (user:<id>). |
name |
string | yes | Their name. |
hourly_rate |
string | yes | Net price of one hour in the project's currency (the customer's). |
ProjectInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the company that does the work. (min length 1) |
customer |
string | yes | Code (or id) of the customer: the hours are invoiced to it, in its currency. (min length 1) |
name |
string | yes | What the project is called: Scanner rollout. (min length 1; max length 200) |
hourly_rate |
decimal string | yes | Net price of one hour in the project's currency (the customer's). (min 0) |
code |
string or null | The project's code; omitted: the next project number (PR-00001). (min length 1; max length 40) |
|
product |
string or null | Code (or id) of a service product the invoice lines name, for its revenue account and VAT rate type; omitted: lines without a product, at the standard rate, booked to the customer's or the company's revenue account. |
ProjectInvoiceInput
| Field | Type | Required | Description |
|---|---|---|---|
until |
string (date) or null | Bill the hours up to this day; omitted: up to today. |
ProjectInvoiceOut
| Field | Type | Required | Description |
|---|---|---|---|
project_id |
string (uuid) | yes | Id of the project. |
invoice |
InvoiceRef |
yes | The draft sales invoice of the hours. |
hours |
string | yes | The hours it bills. |
entries |
integer | yes | How many time entries it bills. |
ProjectOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Id of the project. |
entity |
string | yes | Company code. |
code |
string | yes | The project's code. |
name |
string | yes | Its name. |
customer |
string | yes | Customer code. |
customer_name |
string | yes | Customer name. |
currency |
string | yes | ISO 4217 code of its rates and invoices. |
hourly_rate |
string | yes | Net price of one hour in the project's currency (the customer's). |
rates |
array of PersonRateOut |
yes | The rates of named people. |
product |
string or null | yes | Code of the product its invoice lines name. |
active |
boolean | yes | Whether hours are still booked on it. |
hours |
string | yes | Every hour booked on it. |
unbilled_hours |
string | yes | Approved, billable hours not yet invoiced (POST .../invoice bills them). |
unbilled_amount |
string | yes | What they come to, net, in currency. |
created_by |
object | yes | Who added it. |
created_at |
string (date-time) | yes | When (UTC). |
ProjectUpdate
| Field | Type | Required | Description |
|---|---|---|---|
name |
string or null | Its name. (min length 1; max length 200) | |
hourly_rate |
decimal string or null | Net price of one hour in the project's currency (the customer's). (min 0) | |
rates |
array of PersonRate or null |
The rates of named people, replacing those set before ([] removes them all); everyone else is billed at hourly_rate. Hours not yet invoiced are billed at the rates in force when they are invoiced. (max items 200) |
|
product |
string or null | Code (or id) of the service product the invoice lines name. | |
active |
boolean or null | false closes the project: no hours are booked on it any more; what was booked is still approved and invoiced. |
TimeEntryInput
| Field | Type | Required | Description |
|---|---|---|---|
project |
string | yes | Code (PR-00001) or id of an open project. By its code with entity when the organization has more than one company. (min length 1) |
entity |
string or null | Code (or id) of the company, to find a project by its code. | |
day |
string (date) or null | The day worked; omitted: today. | |
hours |
decimal string | yes | Hours worked, e.g. 1.5 (more than 0, at most 24, two decimals). (max 24; greater than 0) |
description |
string or null | What was done. (min length 1; max length 500) | |
billable |
boolean | false: worked, but not invoiced to the customer. (default true) |
TimeEntryOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Id of the entry. |
entity |
string | yes | Company code. |
timesheet_id |
string (uuid) | yes | Id of the person's week. |
project_id |
string (uuid) | yes | Id of the project. |
project |
string | yes | Project code. |
project_name |
string | yes | Project name. |
customer_name |
string | yes | The project's customer. |
person |
string | yes | Who worked (user:<id>). |
person_name |
string | yes | Their name. |
day |
string (date) | yes | The day worked. |
hours |
string | yes | Hours. |
description |
string or null | yes | What was done. |
billable |
boolean | yes | Whether it is invoiced to the customer. |
invoice |
InvoiceRef or null |
yes | The invoice that bills it, once invoiced. |
created_at |
string (date-time) | yes | When it was booked (UTC). |
TimeEntryUpdate
| Field | Type | Required | Description |
|---|---|---|---|
project |
string or null | Code (PR-00001) or id of an open project. By its code with entity when the organization has more than one company. |
|
day |
string (date) or null | Another day of the same week. | |
hours |
decimal string or null | Hours worked, e.g. 1.5 (more than 0, at most 24, two decimals). (max 24; greater than 0) |
|
description |
string or null | What was done; empty removes it. (max length 500) | |
billable |
boolean or null | Whether it is invoiced. |
TimesheetOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Id of the week. |
entity |
string | yes | Company code. |
person |
string | yes | Whose week (user:<id>). |
person_name |
string | yes | Their name. |
week |
string (date) | yes | The Monday the week starts. |
status |
"approved" | "open" | "submitted" |
yes | open (hours are booked and changed), submitted (waits for approval) or approved; a rejected week is open again with the reason in comment. |
hours |
string | yes | Hours of the week. |
billable_hours |
string | yes | Of them, billable. |
entries |
array of TimeEntryOut |
yes | The hours, by day. |
approval_id |
string (uuid) or null | yes | The approval request of its submission. |
review |
object or null | yes | The AI reviewer's checks. |
comment |
string or null | yes | Why it was rejected, when it was. |
submitted_at |
string (date-time) or null | yes | When it was submitted (UTC). |
decided_by |
object or null | yes | Who approved or rejected it. |
decided_at |
string (date-time) or null | yes | When (UTC). |
UnbilledLine
| Field | Type | Required | Description |
|---|---|---|---|
person |
string | yes | Who worked (user:<id>). |
person_name |
string | yes | Their name. |
hours |
string | yes | Their approved, billable hours not yet invoiced. |
hourly_rate |
string | yes | Their rate on the project today. |
amount |
string | yes | Hours times rate, net. |
first_day |
string (date) | yes | The first day of the hours. |
last_day |
string (date) | yes | The last day. |
UnbilledOut
| Field | Type | Required | Description |
|---|---|---|---|
project_id |
string (uuid) | yes | Id of the project. |
project |
string | yes | Project code. |
currency |
string | yes | ISO 4217 code. |
until |
string (date) | yes | Hours up to this day. |
lines |
array of UnbilledLine |
yes | By person: what the invoice's lines would be. |
hours |
string | yes | Hours in all. |
amount |
string | yes | Net amount in all. |