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

# Subscribe to Manual Time Entry Webhooks

> Set up real-time webhook notifications for manual time entry creation events in your Zapier integrations.

## Overview

Subscribe to webhook events to receive instant notifications when manual time entries are created in your workspace. This endpoint enables Zapier's "Manual Time Entry" trigger integration, automatically forwarding manual time entry data to your connected workflows.

<Note>
  This endpoint is primarily designed for Zapier integrations but can be used with any webhook service that follows the same pattern.
</Note>

## Authentication

All requests require a valid API key in the Authorization header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Subscribe to Events

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://app.timetracker.in/api/integrations/zapier/webhooks/subscribe' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -d '{
      "url": "https://hooks.zapier.com/hooks/catch/123456/abcdef/",
      "events": ["MANUAL_TIME_ADDED"],
      "description": "Zapier webhook for manual time entry"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://app.timetracker.in/api/integrations/zapier/webhooks/subscribe', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      url: 'https://hooks.zapier.com/hooks/catch/123456/abcdef/',
      events: ['MANUAL_TIME_ADDED'],
      description: 'Zapier webhook for manual time entry'
    })
  });
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.timetracker.com/api/integrations/zapier/webhooks/subscribe"
  headers = {
      "Content-Type": "application/json",
      "Authorization": "Bearer YOUR_API_KEY"
  }
  data = {
      "url": "https://hooks.zapier.com/hooks/catch/123456/abcdef/",
      "events": ["MANUAL_TIME_ADDED"],
      "description": "Zapier webhook for manual time entry"
  }

  response = requests.post(url, headers=headers, json=data)
  ```
</CodeGroup>

### Request Body

<ParamField body="url" type="string" required>
  The destination URL for webhook notifications. Must be a valid HTTPS URL format.

  **Example:** `https://hooks.zapier.com/hooks/catch/123456/abcdef/`
</ParamField>

<ParamField body="events" type="string[]" required>
  Array of event types to monitor. Currently supports:

  * `MANUAL_TIME_ADDED` - Triggered when a manual time entry is added

  **Example:** `["MANUAL_TIME_ADDED"]`
</ParamField>

<ParamField body="description" type="string" optional>
  Optional description to identify this webhook in your dashboard.

  **Example:** `"Zapier integration for manual time entry notifications"`
</ParamField>

## Response

### Success Response

```json theme={null}
{
  "success": true,
  "webhook": {
    "id": "wh_1234567890abcdef",
    "url": "https://hooks.zapier.com/hooks/catch/123456/abcdef/",
    "events": ["MANUAL_TIME_ADDED"],
    "status": "ACTIVE"
  }
}
```

<ResponseField name="success" type="boolean">
  Confirms successful webhook creation.
</ResponseField>

<ResponseField name="webhook" type="object">
  The created webhook subscription details.

  <Expandable title="Webhook Object Properties">
    <ResponseField name="id" type="string">
      Unique webhook identifier for future reference.
    </ResponseField>

    <ResponseField name="url" type="string">
      The registered webhook endpoint URL.
    </ResponseField>

    <ResponseField name="events" type="string[]">
      Confirmed list of subscribed event types.
    </ResponseField>

    <ResponseField name="status" type="string">
      Webhook status - `ACTIVE` for new subscriptions.
    </ResponseField>
  </Expandable>
</ResponseField>

### Error Responses

<AccordionGroup>
  <Accordion title="400 Bad Request - Invalid URL">
    ```json theme={null}
    {
      "error": "Invalid URL format"
    }
    ```

    The provided URL doesn't meet the required format standards.
  </Accordion>

  <Accordion title="400 Bad Request - Missing Fields">
    ```json theme={null}
    {
      "error": "URL and events array are required"
    }
    ```

    Required parameters `url` or `events` are missing from the request.
  </Accordion>

  <Accordion title="401 Unauthorized">
    ```json theme={null}
    {
      "error": "Unauthorized"
    }
    ```

    Invalid or missing API key in the Authorization header.
  </Accordion>

  <Accordion title="500 Internal Server Error">
    ```json theme={null}
    {
      "error": "Internal server error"
    }
    ```

    An unexpected server error occurred. Try again or contact support.
  </Accordion>
</AccordionGroup>

## Webhook Payload Structure

When a manual time entry is created, your webhook endpoint receives a POST request with this payload:

```json theme={null}
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "description": "Working on user authentication implementation",
  "date": "2024-01-15T00:00:00.000Z",
  "startTime": "2024-01-15T10:00:00.000Z",
  "endTime": "2024-01-15T12:30:00.000Z",
  "duration": 9000,
  "billable": true,
  "action": "manual_entry",
  "workspace": {
    "id": "abc12345-e89b-12d3-a456-426614174003",
    "name": "Development Team"
  },
  "teamMember": {
    "id": "def67890-e89b-12d3-a456-426614174004",
    "name": "John Doe"
  },
  "project": {
    "id": "456e7890-e89b-12d3-a456-426614174001",
    "name": "Mobile App Development"
  },
  "task": {
    "id": "789e0123-e89b-12d3-a456-426614174002",
    "name": "Implement user authentication"
  },
  "tags": [
    {
      "id": "ghi11111-e89b-12d3-a456-426614174005",
      "name": "authentication"
    },
    {
      "id": "jkl22222-e89b-12d3-a456-426614174006",
      "name": "mobile"
    }
  ],
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-01-15T10:00:00.000Z"
}
```

### Payload Fields

<ResponseField name="id" type="string">
  Unique time entry identifier
</ResponseField>

<ResponseField name="description" type="string">
  Time entry description
</ResponseField>

<ResponseField name="date" type="string">
  Date of the time entry in ISO 8601 format
</ResponseField>

<ResponseField name="startTime" type="string">
  Time entry start time in ISO 8601 format
</ResponseField>

<ResponseField name="endTime" type="string">
  Time entry end time in ISO 8601 format
</ResponseField>

<ResponseField name="duration" type="integer">
  Total duration in seconds (e.g., 9000 = 2.5 hours)
</ResponseField>

<ResponseField name="billable" type="boolean">
  Whether the time entry is billable
</ResponseField>

<ResponseField name="action" type="string">
  Action type - always `"manual_entry"` for this trigger
</ResponseField>

<ResponseField name="workspace" type="object">
  Associated workspace information

  <Expandable title="Workspace Properties">
    <ResponseField name="id" type="string">
      Workspace unique identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      Workspace display name
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="teamMember" type="object">
  Team member who created the manual entry

  <Expandable title="Team Member Properties">
    <ResponseField name="id" type="string">
      Team member unique identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      Team member name
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="project" type="object">
  Associated project information

  <Expandable title="Project Properties">
    <ResponseField name="id" type="string">
      Project unique identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      Project display name
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="task" type="object">
  Associated task information

  <Expandable title="Task Properties">
    <ResponseField name="id" type="string">
      Task unique identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      Task display name
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="tags" type="array">
  Array of tags associated with the time entry

  <Expandable title="Tag Properties">
    <ResponseField name="id" type="string">
      Tag unique identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      Tag name
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of time entry creation
</ResponseField>

<ResponseField name="updatedAt" type="string">
  ISO 8601 timestamp of last update
</ResponseField>

## Zapier Integration Guide

### Setting Up the Trigger

1. **Automatic Setup**: Zapier automatically calls this endpoint when you configure a "Manual Time Entry" trigger
2. **Event Subscription**: The integration subscribes to `MANUAL_TIME_ADDED` events
3. **Data Flow**: Manual time entry data is instantly sent to your Zap workflow

<Tip>
  Zapier automatically provides the webhook URL via `bundle.targetUrl` when setting up the trigger. You don't need to manually generate URLs.
</Tip>

## Important Notes

<Warning>
  **Workspace Scope**: Webhook subscriptions are tied to your specific API key and workspace. Ensure you're using the correct credentials for your intended workspace.
</Warning>

<Info>
  **Data Format**: The webhook payload structure matches the standard time entry data format used across all time tracking API endpoints, ensuring consistency in your integrations.
</Info>

<Check>
  **Best Practices**:

  * Validate webhook signatures if implementing custom security
  * Implement proper error handling for webhook delivery failures
  * Use HTTPS endpoints only for security
  * Test your webhook endpoint before subscribing
</Check>
