Xero: Retrieves all time entries associated with a specific project
Xero projects.getTimeEntries: arguments, response, policy and SDK examples.
← Projects operations · Get started
Operation xero.projects_gettimeentries
Provider route: GET /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"]["getTimeEntries"]>[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.getTimeEntries(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.get_time_entries(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 |
query | object | Optional | Additional keys: not allowed |
query.userId | string | Optional | Format: uuid |
query.taskId | string | Optional | Format: uuid |
query.invoiceId | string | Optional | Format: uuid |
query.contactId | string | Optional | Format: uuid |
query.page | integer | Optional | |
query.pageSize | integer | Optional | |
query.states | array | Optional | |
query.states[] | string | Each item | |
query.isChargeable | boolean | Optional | |
query.dateAfterUtc | string | Optional | Format: date-time |
query.dateBeforeUtc | string | Optional | Format: date-time |
headers | object | Required within parent | Additional keys: not allowed |
headers.xero-tenant-id | string | Required within parent |
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 Retrieves all time entries associated with a specific project — response body |
Referenced models: Retrieves all time entries associated with a specific project — response body
Schemas
Section titled “Schemas”Retrieves all time entries associated with a specific project — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
items | array | Optional | |
items[] | Model | Each item | Expand Creates a time entry for a specific project — response body |
pagination | Model | Optional | Expand Retrieves all projects — response body — pagination |
Referenced models: Retrieves all projects — response body — pagination, Creates a time entry for a specific project — response body
Retrieves all projects — response body — pagination
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
itemCount | JSON | Optional | |
itemCount (anyOf 1) | integer | Alternative | Number of items returned |
itemCount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
page | JSON | Optional | |
page (anyOf 1) | integer | Alternative | Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0. |
page (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
pageCount | JSON | Optional | |
pageCount (anyOf 1) | integer | Alternative | Number of pages available |
pageCount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
pageSize | JSON | Optional | |
pageSize (anyOf 1) | integer | Alternative | Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500. |
pageSize (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
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 |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: xero.projects_gettimeentries. Catalog operation: projects.getTimeEntries. 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.