- Create or update time management entry records (upsert)
🔐 Required role:
TM_ENTRY_C📖 Data dictionary: Time entry
Create or update time management entry records (upsert)
Records are created if they don't exist, or updated if matched by top-level systemRef. Maximum 100 records per request.
Each record succeeds or fails on its own: 200, 207 or 422 say whether all, some or none succeeded — see Batch writes: per-record results. A type that is not an entry type returns 400.
unitsis the hours worked.valueis the amount in currency, not the hours.- Omit
billedPerUnitwhen your system does not know the firm's billing rates (a time-entry tool, for example). Aiwyn then resolves the rate card rate for the logged staff, the work code and the logged date exactly as the firm portal does, and computesvalue,billedPerUnitandcostPerUnitfromunits. The entry also gets an audit transaction.valueis still required by the schema: send0, it is overwritten. - Send
billedPerUnitonly when your system is the source of truth for rates (a practice management system). The record is then stored exactly as sent, nothing is computed. - A billable work code with no active rate card rate for that staff type and date fails the record with
RATE_NOT_FOUND. Set the rate card up in Aiwyn first. - Re-posting an entry (same
systemRef) withoutbilledPerUnitresolves the rate again from the values sent, as an edit in the firm portal does. An entry already on an invoice is locked and fails the record withLOCKED. type("Time"),billedAmount,writeOffAmountandcostPerUnitare required by the schema. Send0for the three amounts on a new entry.loggedDateis an ISO-8601 date-time with zone (2026-06-17T09:00:00Z).postedandapproveddefault totrue: an entry posted by an external system is treated as already approved and posted. Sendfalseexplicitly if the firm reviews entries in Aiwyn before billing.
The work code decides whether the entry is billable and which rate applies. Send one of:
code— the work code string. It must match the exacttime_management_entry_code.codevalue, or fall back totask_type.code. Stored asentry_code_id.taskId— a project task. Accepts a systemRef ({ "system": "PM", "reference": "<task-pmsRef>" }), a numeric Aiwyn id, or a string numeric id (treated as Aiwyn id). The work code is derived from the task's task type when nocodeis supplied. When both are provided,codewins.
An entry with neither is stored as non-billable with a zero amount, because no rate can be resolved without a work code.
Look up tasks before upserting entries:
GET /gql/v1/task/{id}— get a task by Aiwyn idPOST /gql/v1/tasks/search— search tasks (filter by job, assignee, task type, dates)
See GET /api/v1/entries/schema/TimeEntry for the full attribute list, including custom fields.
See the request sample: hours in units, value and costPerUnit 0, no billedPerUnit, the work code in code.
{
"records": [
{
"type": "TimeEntry",
"systemRef": {"system": "PM", "reference": "pms-entry-002"},
"attributes": {
"pmsRef": "pms-entry-002",
"type": "Time",
"loggedDate": "2026-06-17T14:00:00Z",
"units": 1.0,
"billedPerUnit": 250,
"value": 250,
"costPerUnit": 90,
"billedAmount": 0,
"writeOffAmount": 0,
"billable": true,
"clientId": {"system": "PM", "reference": "37584"},
"jobId": {"system": "PM", "reference": "AIWYN_29059"},
"loggedStaffId": {"system": "PM", "reference": "12345"},
"taskId": {"system": "PM", "reference": "AIWYN_98765"}
}
}
]
}ExpenseEntry is WIP-backed like TimeEntry: it carries clientId, jobId, and loggedStaffId, and the same checks apply (inactive client, inactive project, client/project mismatch, inactive staff). An entry already on an invoice is locked and fails the record with LOCKED. No rate is resolved for an expense: it is stored as sent.
type("Expense"),loggedDate,clientId,loggedStaffId,value,costPerUnit,billedAmount,writeOffAmount, andbillableare required by the schema.valueis the expense amount. Send what the firm portal stores for an expense:units1,costPerUnitandbilledPerUnitequal tovalue, and0forbilledAmountandwriteOffAmount.postedandapproveddefault totrue: an expense posted by an external system is treated as already approved and posted. Sendfalseexplicitly if the firm reviews expenses in Aiwyn before billing, as it does for expenses entered in the firm portal.notesis the entry description carried on the WIP;internalNotesis the firm-internal note.
Select the expense code with either attribute:
expenseCodeId: the numeric Aiwyn id of anExpenseCode. A non-nullexpenseCodeIdwins when both are supplied.code: the exactcodevalue of anExpenseCode; when several codes share the value, an active one is preferred. An unknown code fails the record withUnknown ExpenseEntry code; persist codes first viaPOST /api/v1/codes.
See GET /api/v1/entries/schema/ExpenseEntry for the full attribute list, including custom fields, and the ExpenseEntry request example at the end of this page.
| Firm portal field | ExpenseEntry attribute |
|---|---|
amount | value, costPerUnit, and billedPerUnit; units is 1, billedAmount and writeOffAmount are 0 |
expenseCodeId | expenseCodeId, or code |
clientId, jobId, loggedStaffId | same name; numeric Aiwyn id or {"system": "PM", "reference": "<pmsRef>"} |
loggedDate, notes, internalNotes | same name; loggedDate is an ISO-8601 date-time with offset, e.g. 2026-06-17T00:00:00Z |
| not on the form | type "Expense"; billable (the form copies it from the expense code); posted and approved false to match a form submission |
wipId | not sent; records are matched by systemRef |
Business Applications:
- Sync time entries from external time-tracking systems
- Sync expense entries from expense-management and reimbursement systems
- Attach project tasks to time entries
- Upsert entries by external system reference
ExpenseEntry with expense code:
{
"records": [
{
"type": "ExpenseEntry",
"systemRef": {"system": "PM", "reference": "beeye-expense-001"},
"attributes": {
"pmsRef": "beeye-expense-001",
"type": "Expense",
"loggedDate": "2026-06-17T00:00:00Z",
"value": 123.45,
"units": 1,
"costPerUnit": 123.45,
"billedPerUnit": 123.45,
"billedAmount": 0,
"writeOffAmount": 0,
"billable": true,
"notes": "Client site travel",
"internalNotes": "Mileage, 150 mi",
"clientId": {"system": "PM", "reference": "37584"},
"jobId": {"system": "PM", "reference": "AIWYN_29059"},
"loggedStaffId": {"system": "PM", "reference": "12345"},
"code": "TRAVEL"
}
}
]
}- Sandbox (requires Cloudflare Access headers)https://api.sandbox.aiwyn.app/api/v1/entries
- Staging (requires Cloudflare Access headers)https://api.staging.aiwyn.app/api/v1/entries
- Production (your live firm data; no Cloudflare Access headers)https://api.aiwyn.ai/api/v1/entries
curl -i -X POST \
https://api.sandbox.aiwyn.app/api/v1/entries \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'CF-Access-Client-Id: YOUR_API_KEY_HERE' \
-H 'CF-Access-Client-Secret: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"records": [
{
"type": "TimeEntry",
"systemRef": {
"system": "PM",
"reference": "laurel-entry-001"
},
"attributes": {
"pmsRef": "laurel-entry-001",
"type": "Time",
"loggedDate": "2026-06-17T09:00:00Z",
"units": 2.5,
"value": 0,
"costPerUnit": 0,
"billedAmount": 0,
"writeOffAmount": 0,
"notes": "Worked on tax planning deliverable",
"clientId": {
"system": "PM",
"reference": "37584"
},
"jobId": {
"system": "PM",
"reference": "AIWYN_29059"
},
"loggedStaffId": {
"system": "PM",
"reference": "12345"
},
"code": "TXBLE30X01"
}
}
]
}'{ "data": { "summary": {}, "records": [ … ] }, "error": {}, "meta": { "success": true, "message": "string", "timestamp": "2019-08-24T14:15:22Z", "version": "string" } }