Skip to content

Create or update time entries (upsert)

Request

🔐 Required role: TM_ENTRY_C

📖 Data dictionary: Time-management entry

Create or update time entries (upsert)

Every record is saved with type TimeEntry, so records carry no type; attributes.type is always Time, and a type sent in attributes is replaced. Maximum 100 records per request.

A record updates the entry its systemRef names: the same system and reference, the entry with that Aiwyn ID when system is aiwyn, or else the entry whose pmsRef is the reference. Without a systemRef, it updates the entry whose pmsRef is attributes.pmsRef. When nothing matches, a new entry is created. Attributes left out of an update keep their values. A record with any field other than systemRef and attributes is rejected with 400.

AttributeTypeRequiredDefaultDescription
pmsRefstringNosee belowReference in your practice management system.
loggedDatedate-timeYes—When the work was done; see below.
loggedStaffIdAiwyn ID or {system, reference}Yes—Staff member who did the work.
clientIdAiwyn ID or {system, reference}Yes—Client the work was for.
jobIdAiwyn ID or {system, reference}Yes—Project.
taskIdAiwyn ID or {system, reference}No—Project task; sets the work code.
codestringNo—Work code: a time code code (active preferred), else a task type code.
unitsnumberNosee belowHours worked. Always send it; see below.
valuenumberYes—Amount in currency; see below.
billedPerUnitnumberNosee belowBilling rate.
costPerUnitnumberYes—Cost rate; see below.
billedAmountnumberYes—Amount already billed. 0 for a new entry.
writeOffAmountnumberYes—Amount written off. 0 for a new entry.
billablebooleanNosee belowWhether the work is billable.
postedbooleanNotrueWhether the entry is posted.
approvedbooleanNotrueWhether the entry is approved.
notesstringNo—Entry description.
internalNotesstringNo—Note for your firm.
onCalendarbooleanNofalseWhether the entry shows on the staff calendar.
activebooleanNotruefalse deactivates the entry.

Without pmsRef, a new entry takes systemRef.reference when systemRef.system is PM, and a generated reference otherwise. loggedDate is an ISO-8601 date-time with Z or an offset, for example 2026-06-17T00:00:00Z; an offset is converted to UTC. A date alone, or a date-time without Z or an offset, fails with VALIDATION_ERROR.

How rates are set depends on whether rate resolution is enabled for your firm (ask Aiwyn support).

With rate resolution enabled, leave billedPerUnit out when your system does not know the firm's billing rates (a time-entry tool). Aiwyn rounds the hours to the firm's increment, takes billable from the work code when you don't send it (false without a work code), resolves the rate card rate and average cost for the staff member, the work code and the date, and computes value, billedPerUnit and costPerUnit; send 0 for value and costPerUnit. Always send units: without it, value is read as the hours. An update without billedPerUnit is priced again from the entry as it stands after the update, with billable taken from the work code unless the update sends it. That includes a submitted entry, whose rate the firm portal keeps on edit. Send billedPerUnit when your system owns the rates (a practice management system); the entry is then stored as sent.

Without rate resolution, every entry is stored as sent: send units, value, billedPerUnit and costPerUnit; units defaults to 1 and billable to true.

Send the work code as code (a time code, else a task type with that code) or as a taskId whose task type is the work code; code wins when both are sent. With rate resolution enabled, an entry with neither and no billable is non-billable.

A record fails with INACTIVE_CLIENT, INACTIVE_PROJECT or INACTIVE_RESOURCE when the client, project or staff member is inactive, REFERENCE_MISMATCH when the project belongs to another client, LOCKED when the entry is already on an invoice, CONVERSION_ERROR for an unknown code, UNRESOLVED_REFERENCE when a {system, reference} matches no staff member, client, project or task (an Aiwyn ID is stored as sent, without a check), BUILD_ERROR when a required attribute is missing, and VALIDATION_ERROR for a negative units, a blank reference in loggedStaffId, clientId, jobId or taskId, or an invalid loggedDate. With rate resolution enabled, it also fails with RATE_NOT_FOUND when no rate card rate or average cost exists for the staff type and date, when the staff member has no staff type, or when code is a billable time code with no task type of that code, and with WORK_CODE_SERVICE_LINE_MISMATCH when the work code does not belong to the project's service line.

Custom fields your firm defines for TimeEntry are accepted too; list them with GET /api/v1/entries/schema/TimeEntry.

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.

TimeEntry with rates (rate resolution off, or rates owned by your system):

{
  "records": [
    {
      "systemRef": {"system": "PM", "reference": "entry-002"},
      "attributes": {
        "loggedDate": "2026-06-17T00:00:00Z",
        "loggedStaffId": {"system": "PM", "reference": "12345"},
        "clientId": {"system": "PM", "reference": "37584"},
        "jobId": {"system": "PM", "reference": "AIWYN_29059"},
        "code": "TXBLE30X01",
        "units": 2.5,
        "value": 375.00,
        "billedPerUnit": 150.00,
        "costPerUnit": 60.00,
        "billedAmount": 0,
        "writeOffAmount": 0,
        "billable": true,
        "notes": "Tax planning deliverable"
      }
    }
  ]
}
Security
(BearerAuth and CfAccessClientId and CfAccessClientSecret) or BearerAuth
Bodyapplication/jsonrequired
recordsArray of objectsrequired

Records

curl -i -X POST \
  https://api.sandbox.aiwyn.app/api/v1/time-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": [
      {
        "systemRef": {
          "system": "PM",
          "reference": "entry-001"
        },
        "attributes": {
          "loggedDate": "2026-06-17T09:00:00Z",
          "loggedStaffId": {
            "system": "PM",
            "reference": "12345"
          },
          "clientId": {
            "system": "PM",
            "reference": "37584"
          },
          "jobId": {
            "system": "PM",
            "reference": "AIWYN_29059"
          },
          "code": "TXBLE30X01",
          "units": 2.5,
          "value": 0,
          "costPerUnit": 0,
          "billedAmount": 0,
          "writeOffAmount": 0,
          "notes": "Tax planning deliverable"
        }
      }
    ]
  }'

Responses

All time entries processed successfully

Bodyapplication/json
dataobject
errorobject or null
metaobject
Response
{ "data": { "summary": {}, "records": [ … ] }, "error": {}, "meta": { "success": true, "message": "string", "timestamp": "2019-08-24T14:15:22Z", "version": "string" } }