Xero: Creates a time entry for a specific project
Xero projects.createTimeEntry: arguments, response, policy and SDK examples.
← Projects operations · Get started
Operation xero.projects_createtimeentry
Provider route: POST /projects.xro/2.0/Projects/{projectId}/Time. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/xero with npm, or alter-sdk-xero with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { XeroIntegration } from "@alter-ai/xero";
async function execute(input: Parameters<XeroIntegration["projects"]["createTimeEntry"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new XeroIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.projects.createTimeEntry(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_xero import XeroIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = XeroIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.projects.create_time_entry(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.projectId | string | Required within parent | Format: uuid |
headers | object | Required within parent | Additional keys: not allowed |
headers.xero-tenant-id | string | Required within parent | |
headers.Idempotency-Key | string | Optional | |
body | Model | Required within parent | Expand Creates a time entry for a specific project — request body — body |
Referenced models: Creates a time entry for a specific project — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Creates a time entry for a specific project — response body |
Referenced models: Creates a time entry for a specific project — response body
Schemas
Section titled “Schemas”Creates a time entry for a specific project — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
dateEnteredUtc | string | Optional | The date time that time entry is created. UTC Date Time in ISO-8601 format. By default it is set to server time. Format: date-time |
dateUtc | string | Optional | The date time that time entry is logged on. UTC Date Time in ISO-8601 format. Format: date-time |
description | string | Optional | A description of the time entry. |
duration | JSON | Optional | |
duration (anyOf 1) | integer | Alternative | The duration of logged minutes. |
duration (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
projectId | string | Optional | Identifier of the project, that the task (which the time entry is logged against) belongs to. Format: uuid |
status | string | Optional | Status of the time entry. By default a time entry is created with status of `ACTIVE`. A `LOCKED` state indicates that the time entry is currently changing state (for example being invoiced). Updates are not allowed when in this state. It will have a status of INVOICED once it is invoiced. Known values: ACTIVE, LOCKED, INVOICED |
taskId | string | Optional | Identifier of the task that time entry is logged against. Format: uuid |
timeEntryId | string | Optional | Identifier of the time entry. Format: uuid |
userId | string | Optional | The xero user identifier of the person who logged time. Format: uuid |
Creates a time entry for a specific project — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
dateUtc | string | Required within parent | Date time entry is logged on. UTC Date Time in ISO-8601 format. Format: date-time |
description | string | Optional | An optional description of the time entry, will be set to null if not provided during update. |
duration | integer | Required within parent | Number of minutes to be logged. Duration is between 1 and 59940 inclusively. |
taskId | string | Required within parent | Identifier of the task that time entry is logged against. Format: uuid |
userId | string | Required within parent | The xero user identifier of the person logging the time. Format: uuid |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: xero.projects_createtimeentry. Catalog operation: projects.createTimeEntry. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.