# API: Projects

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/work/projects` | Projects, with what's been spent of their budgets where you may see it | `projects:read` |
| POST | `/v1/work/projects` | Add a project, for a client you have or a new one by name. Your common tasks go on it, and you lead it | `projects:write` |
| DELETE | `/v1/work/projects/:id` | Remove a project added by mistake. One with time is archived instead | `projects:write` |
| GET | `/v1/work/projects/:id` | One project: its tasks, team, rates and budget | `projects:read` |
| PATCH | `/v1/work/projects/:id` | Change a project, archive it or bring it back. A change to how it bills reprices time that isn't billed yet | `projects:write` |
| POST | `/v1/work/projects/:id/copy` | Copy a project with its tasks, team, rates and budget, without its time | `projects:write` |
| DELETE | `/v1/work/projects/:id/people/:person_id` | Take someone off a project. Their time on it stays | `projects:write` |
| PUT | `/v1/work/projects/:id/people/:person_id` | Put someone on a project, or make them a lead. Leads see and correct the project's time | `projects:write` |
| PUT | `/v1/work/projects/:id/rates` | Set what an hour on this project bills at: one rate, or one for a person or a task. Billed time never changes | `projects:write` |
| PUT | `/v1/work/projects/:id/tasks/:task_id` | Put a task on a project, or change it there. `off` keeps its time and takes no more | `projects:write` |
| GET | `/v1/work/projects/tasks` | The kinds of work people track time to | `projects:read` |
| POST | `/v1/work/projects/tasks` | Add a kind of work. A common one goes on every new project | `projects:write` |
| PATCH | `/v1/work/projects/tasks/:id` | Rename a task, archive it or bring it back. Time tracked to it stays | `projects:write` |

## Examples

### GET /v1/work/projects

Projects, with what's been spent of their budgets where you may see it

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

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

### POST /v1/work/projects

Add a project, for a client you have or a new one by name. Your common tasks go on it, and you lead it

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects`, {
  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/projects/$ID

Remove a project added by mistake. One with time is archived instead

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

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

### GET /v1/work/projects/$ID

One project: its tasks, team, rates and budget

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

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

### PATCH /v1/work/projects/$ID

Change a project, archive it or bring it back. A change to how it bills reprices time that isn't billed yet

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects/${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/projects/$ID/copy

Copy a project with its tasks, team, rates and budget, without its time

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects/${id}/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();
```

### DELETE /v1/work/projects/$ID/people/$PERSON_ID

Take someone off a project. Their time on it stays

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

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

### PUT /v1/work/projects/$ID/people/$PERSON_ID

Put someone on a project, or make them a lead. Leads see and correct the project's time

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects/${id}/people/${person_id}`, {
  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();
```

### PUT /v1/work/projects/$ID/rates

Set what an hour on this project bills at: one rate, or one for a person or a task. Billed time never changes

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects/${id}/rates`, {
  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();
```

### PUT /v1/work/projects/$ID/tasks/$TASK_ID

Put a task on a project, or change it there. `off` keeps its time and takes no more

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects/${id}/tasks/${task_id}`, {
  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();
```

### GET /v1/work/projects/tasks

The kinds of work people track time to

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

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

### POST /v1/work/projects/tasks

Add a kind of work. A common one goes on every new project

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects/tasks`, {
  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();
```

### PATCH /v1/work/projects/tasks/$ID

Rename a task, archive it or bring it back. Time tracked to it stays

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

```js
const res = await fetch(`https://api.hourfinch.com/v1/work/projects/tasks/${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();
```

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).
