> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Everhour incoming webhooks: event paths, payloads, and response data.

The Everhour plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see [Overview](/plugins/everhour/overview) for setup context and the exact URL shape).

<Info>
  **New to Corsair?** See [webhooks](/concepts/webhooks) and [hooks](/concepts/hooks).
</Info>

## Webhook map

* `client`
  * `created` (`client.created`)
  * `updated` (`client.updated`)
* `estimate`
  * `updated` (`estimate.updated`)
* `invoice`
  * `created` (`invoice.created`)
  * `deleted` (`invoice.deleted`)
  * `updated` (`invoice.updated`)
* `project`
  * `created` (`project.created`)
  * `removed` (`project.removed`)
  * `updated` (`project.updated`)
* `section`
  * `created` (`section.created`)
  * `recovered` (`section.recovered`)
  * `removed` (`section.removed`)
  * `updated` (`section.updated`)
* `task`
  * `created` (`task.created`)
  * `recovered` (`task.recovered`)
  * `removed` (`task.removed`)
  * `updated` (`task.updated`)
* `time`
  * `updated` (`time.updated`)
* `timer`
  * `started` (`timer.started`)
  * `stopped` (`timer.stopped`)

## HTTP handler setup

```ts app/api/webhook/route.ts theme={null}
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";

export async function POST(request: Request) {
    const headers = Object.fromEntries(request.headers);
    const body = await request.json();
    const result = await processWebhook(corsair, headers, body);
    return result.response;
}
```

## Events

## Client

### Created

`client.created`

A client was created

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        client: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`client.updated`

A client was updated

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        client: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Estimate

### Updated

`estimate.updated`

A task estimate was updated

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        estimate: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Invoice

### Created

`invoice.created`

An invoice was created

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        invoice: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Deleted

`invoice.deleted`

An invoice was deleted

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        invoice: {
            deleted: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`invoice.updated`

An invoice was updated

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        invoice: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Project

### Created

`project.created`

A project was created

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        project: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Removed

`project.removed`

A project was removed

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        project: {
            removed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`project.updated`

A project was updated

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        project: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Section

### Created

`section.created`

A section was created

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        section: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Recovered

`section.recovered`

A section was recovered

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        section: {
            recovered: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Removed

`section.removed`

A section was removed

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        section: {
            removed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`section.updated`

A section was updated

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        section: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Task

### Created

`task.created`

A task was created

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        task: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Recovered

`task.recovered`

A task was recovered

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        task: {
            recovered: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Removed

`task.removed`

A task was removed

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        task: {
            removed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`task.updated`

A task was updated

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        task: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Time

### Updated

`time.updated`

A time record is created or modified

**Payload**

| Name         | Type               | Required | Description |
| ------------ | ------------------ | -------- | ----------- |
| `type`       | `api:time:updated` | Yes      | —           |
| `created_at` | `string`           | Yes      | —           |
| `data`       | `object`           | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
      id: string,
      task_id: string,
      user_id: string
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: api:time:updated,
      created_at: string,
      data: {
        id: string,
        task_id: string,
        user_id: string
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        time: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Timer

### Started

`timer.started`

A timer was started

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        timer: {
            started: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Stopped

`timer.stopped`

A timer was stopped

**Payload**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `type`       | `string` | Yes      | —           |
| `created_at` | `string` | Yes      | —           |
| `data`       | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      type: string,
      created_at: string,
      data: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
everhour({
    webhookHooks: {
        timer: {
            stopped: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***
