# API: Time

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/work/time` | Time someone tracked between two days (yours unless you say whose), with each week's status and what's running | `time:read` |
| POST | `/v1/work/time` | Add time, or start a timer. Sending the same id again changes nothing | `time:write` |
| DELETE | `/v1/work/time/:id` | Remove time that isn't billed | `time:write` |
| PATCH | `/v1/work/time/:id` | Change time, stop its timer, or start it again the same day | `time:write` |
| DELETE | `/v1/work/time/calendar` | Stop showing your calendar. Its address is forgotten (web app only) | `time:write` |
| GET | `/v1/work/time/calendar` | Events from your own calendar that you could add as time. Only you see them (web app only) | `time:read` |
| PUT | `/v1/work/time/calendar` | Show your own calendar's events beside your time (web app only) | `time:write` |
| POST | `/v1/work/time/copy` | Fill an empty week with the time from the last week you tracked | `time:write` |
| GET | `/v1/work/time/home` | Your hours today and this week, and what's waiting for you | `time:read` |
| PUT | `/v1/work/time/lock` | Lock time up to a day, so only people who approve time can change it | `time:write` |
| POST | `/v1/work/time/many` | Move, change or remove up to 500 entries. Any that can't change stay as they are, and the answer says why | `time:write` |
| GET | `/v1/work/time/month` | What a month still needs before it's closed: missing hours, weeks to approve, timers and notes | `time:read` |
| GET | `/v1/work/time/places` | The projects and tasks someone can track time to, the ones used lately first | `time:read` |
| GET | `/v1/work/time/repeats` | Your time that's added by itself every week | `time:read` |
| POST | `/v1/work/time/repeats` | Add the same time by itself every week, on the days you choose. Days off are skipped | `time:write` |
| DELETE | `/v1/work/time/repeats/:id` | Stop time from repeating. What's already added stays | `time:write` |
| GET | `/v1/work/time/running` | Your running timer, if there is one | `time:read` |
| GET | `/v1/work/time/weeks` | Everyone's week: hours, whether it's sent or approved, and which other weeks wait for approval | `time:read` |
| PUT | `/v1/work/time/weeks/:week` | Send a week for approval, take it back, approve it, or open it again | `time:write` |

## Examples

### GET /v1/work/time

Time someone tracked between two days (yours unless you say whose), with each week's status and what's running

```bash
curl -s "https://api.hourfinch.com/v1/work/time" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/work/time

Add time, or start a timer. Sending the same id again changes nothing

```bash
curl -s -X POST "https://api.hourfinch.com/v1/work/time" \
  -H "Authorization: Bearer $TK_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/work/time/$ID

Remove time that isn't billed

```bash
curl -s -X DELETE "https://api.hourfinch.com/v1/work/time/$ID" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### PATCH /v1/work/time/$ID

Change time, stop its timer, or start it again the same day

```bash
curl -s -X PATCH "https://api.hourfinch.com/v1/work/time/$ID" \
  -H "Authorization: Bearer $TK_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/${id}`, {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/work/time/copy

Fill an empty week with the time from the last week you tracked

```bash
curl -s -X POST "https://api.hourfinch.com/v1/work/time/copy" \
  -H "Authorization: Bearer $TK_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/copy`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/work/time/home

Your hours today and this week, and what's waiting for you

```bash
curl -s "https://api.hourfinch.com/v1/work/time/home" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/home`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### PUT /v1/work/time/lock

Lock time up to a day, so only people who approve time can change it

```bash
curl -s -X PUT "https://api.hourfinch.com/v1/work/time/lock" \
  -H "Authorization: Bearer $TK_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/lock`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/work/time/many

Move, change or remove up to 500 entries. Any that can't change stay as they are, and the answer says why

```bash
curl -s -X POST "https://api.hourfinch.com/v1/work/time/many" \
  -H "Authorization: Bearer $TK_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/many`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/work/time/month

What a month still needs before it's closed: missing hours, weeks to approve, timers and notes

```bash
curl -s "https://api.hourfinch.com/v1/work/time/month" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/month`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/work/time/places

The projects and tasks someone can track time to, the ones used lately first

```bash
curl -s "https://api.hourfinch.com/v1/work/time/places" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/places`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/work/time/repeats

Your time that's added by itself every week

```bash
curl -s "https://api.hourfinch.com/v1/work/time/repeats" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/repeats`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/work/time/repeats

Add the same time by itself every week, on the days you choose. Days off are skipped

```bash
curl -s -X POST "https://api.hourfinch.com/v1/work/time/repeats" \
  -H "Authorization: Bearer $TK_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/repeats`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/work/time/repeats/$ID

Stop time from repeating. What's already added stays

```bash
curl -s -X DELETE "https://api.hourfinch.com/v1/work/time/repeats/$ID" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/repeats/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/work/time/running

Your running timer, if there is one

```bash
curl -s "https://api.hourfinch.com/v1/work/time/running" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/running`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/work/time/weeks

Everyone's week: hours, whether it's sent or approved, and which other weeks wait for approval

```bash
curl -s "https://api.hourfinch.com/v1/work/time/weeks" \
  -H "Authorization: Bearer $TK_API_KEY"
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/weeks`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}` },
});
const data = await res.json();
```

### PUT /v1/work/time/weeks/$WEEK

Send a week for approval, take it back, approve it, or open it again

```bash
curl -s -X PUT "https://api.hourfinch.com/v1/work/time/weeks/$WEEK" \
  -H "Authorization: Bearer $TK_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/time/weeks/${week}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.TK_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

Request and response schemas: [https://www.hourfinch.com/openapi.json](https://www.hourfinch.com/openapi.json). All resources: [API reference](https://www.hourfinch.com/docs/api).
