# POST /api/v1/time-entries

> Create time entry

- **Tag:** time-entries
- **Operation ID:** `create_time_entry_api_v1_time_entries_post`

## Description

Log a new time entry.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `TimeEntryCreateRequest`

- `entry_date` (string · date · required) — Date the work was performed.
- `duration_minutes` (integer · required) — Duration in minutes.
- `description` (string) — Optional description.
- `person_name` (string) — Who performed the work.
- `customer_id` (string) — Customer worked for.
- `project_id` (string) — Project / job.
- `catalog_item_id` (string) — Service item to use as the invoice line.
- `billable` (boolean) — Whether the time is billable.
- `rate_cents` (integer) — Billing rate per hour, in cents.

## Responses

### 201 — Successful Response

Schema: `TimeEntryResponse`

- `id` (string · required)
- `business_id` (string · required)
- `entry_date` (string · date · required)
- `duration_minutes` (integer · required)
- `description` (string)
- `person_name` (string)
- `customer_id` (string)
- `customer_name` (string)
- `project_id` (string)
- `project_name` (string)
- `catalog_item_id` (string)
- `billable` (boolean · required)
- `rate_cents` (integer)
- `billable_amount` (integer) — Computed billable amount in cents.
- `status` (string · required)
- `invoice_id` (string)
- `is_active` (boolean · required)
- `created_at` (string · date-time · required)
- `updated_at` (string · date-time · required)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/time-entries' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "entry_date": "2026-01-01",
  "duration_minutes": 0
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/time-entries', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "entry_date": "2026-01-01",
  "duration_minutes": 0
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "entry_date": "2026-01-01",
  "duration_minutes": 0
}

response = httpx.post("https://api.ondayzero.com/api/v1/time-entries", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/time-entries/create-time-entry
- OpenAPI slice: https://www.ondayzero.com/docs/reference/time-entries/create-time-entry/openapi.json
- Other endpoints in **time-entries**: https://www.ondayzero.com/docs/reference/time-entries
