# Harvest

:::tip Available
This integration is active and ready to use in Frihet.
:::

Connect Harvest to Frihet. Import time entries and automatically convert worked hours into invoice lines. Define rates by client or project and invoice directly from your ERP.

## What does it do?

With Harvest integrated:

- **Import time entries** — Bring your hours logged in Harvest to Frihet
- **Create invoices from hours** — Convert time into invoices with configurable rates
- **Projects and clients** — Group hours by project for detailed invoices
- **Custom rates** — Define price/hour by client or project
- **No duplicates** — Already imported hours are not re-imported

## Requirements

- **Active Harvest account** — [getharvest.com](https://www.getharvest.com)
- **Personal Access Token** — Generated from Harvest settings
- **Account ID** — Obtained with the token
- **Frihet Pro or higher**

## Connect Harvest with Frihet

### Step 1: Obtain your Personal Access Token

1. Go to [id.getharvest.com/developers](https://id.getharvest.com/developers)
2. Log in with your Harvest account
3. Click on **Create New Personal Access Token**
4. Give it a name (e.g., "Frihet ERP")
5. Click on **Create Personal Access Token**
6. You will see two pieces of data:
   - **Token** — Your access key (e.g., `123456.pt.abcdefg...`)
   - **Account ID** — The numeric identifier of your account (e.g., `987654`)
7. Copy both values

:::caution Save both values
The Token is only shown once. You can check the Account ID later, but copy both now.
:::

### Step 2: Configure in Frihet

1. Go to **Settings** → **Integrations**
2. Search for **Harvest**
3. Click on **Connect**
4. Enter your **Personal Access Token**
5. Enter your **Account ID**
6. Click on **Verify connection**
7. If correct, you will see your company's name in Harvest

### Step 3: Verify connection

1. Frihet will show a summary:
   - Company name in Harvest
   - Number of active projects
   - Recent logged hours
2. You can perform a test import

## How it works

Frihet uses the **Harvest API v2** with two authentication headers:

```
Authorization: Bearer <token>
Harvest-Account-Id: <account-id>
```

1. You provide your Personal Access Token and Account ID
2. Frihet sends both in the headers of each request
3. Time entries are imported on-demand or periodically
4. Each entry includes project, task, client, and hours
5. Credentials are stored encrypted (AES-256-GCM) in Frihet

## Synchronized Data

| Data | Direction | Frequency |
|------|-----------|------------|
| Time entries | Harvest → Frihet | On-demand / periodic |
| Projects | Harvest → Frihet | On-demand |
| Harvest Clients | Harvest → Frihet | On-demand |
| Tasks | Harvest → Frihet | With each entry |

## Example: Convert hours to invoice

### In Harvest

```
Project: Web Redesign - ClientXYZ
  Mon Feb 3: 4h — Wireframe design
  Tue Feb 4: 3h — Responsive layout
  Thu Feb 6: 5h — Frontend development
  Total: 12 hours
```

### In Frihet (after importing)

```
Invoice #1047 - ClientXYZ
Concept: Web Redesign

  Wireframe design:     4h × 75 EUR = 300.00 EUR
  Responsive layout:   3h × 75 EUR = 225.00 EUR
  Frontend development:      5h × 75 EUR = 375.00 EUR

Total: 900.00 EUR
```

## Custom Rates

### Default Rate

When configuring the integration, you define a base rate (e.g., 60 EUR/h). All imports use this default rate.

### Rate per Client

1. Go to **Clients** → open the client
2. In **"Harvest Rate"**, enter the specific rate (e.g., 80 EUR/h)
3. Subsequent imports for this client will use that rate

### Edit in the invoice

After importing, the invoice is in **Draft** status. You can:
- Change the hourly rate of any line
- Add or remove lines
- Adjust the description
- Confirm when ready

### Import time entries

Frihet can automatically convert your time entries into invoice lines:

1. Connect your Harvest account
2. Go to the **Data** tab of the integration
3. Click on **Import time entries**
4. Enter your hourly rate
5. Frihet groups entries by project and creates an invoice draft

Harvest entries directly include project and task names, so each invoice line reflects the task performed.

## Use Cases

### Development Agency

Your team logs hours in Harvest by project and task. At the end of the month, you import the hours into Frihet and generate detailed invoices for each client with task breakdown.

### Independent Consultant

You log your consulting hours in Harvest. Weekly or monthly, you import to Frihet and create invoices per client. Each invoice shows the exact breakdown of what you did and how much time you spent.

### Project Billing

You have a large project with a fixed budget. You use Harvest to track actual hours and Frihet to bill for project milestones. The imported hours give you visibility into profitability.

## Troubleshooting

### "Authentication error"

- Verify that the Personal Access Token is correct
- Check that the Account ID corresponds to your active account
- If you regenerated the token, update it in Frihet

### "I don't see my time entries"

- Verify that you have logged hours in Harvest (not drafts)
- Check that you select the correct date range
- Time entries must have a project assigned

### "Rates are not correct"

- Review the default rate in **Settings** → **Harvest**
- Check if the client has a custom rate configured
- You can edit the rate directly in the invoice draft before confirming

### "I want to change the Account ID"

1. Go to **Settings** → **Integrations** → **Harvest**
2. Click on **Disconnect**
3. Reconnect with the new Account ID and token

## Next Steps

- [Connect Toggl as a time tracking alternative](./toggl)
- [Connect Clockify for another time tracking option](./clockify)
- [Automate invoicing with n8n](./n8n)
