# Tracking Time

**URL:** <https://community.toggl.com/t/tracking-time/153>\
**Category:** Getting Started With API\
**Tags:** time-entries, api, endpoints, documentation\
**Created:** [November 20, 2024, 5:50pm UTC](https://community.toggl.com/t/tracking-time/153 "2024-11-20T17:50:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Support](https://yyz2.discourse-cdn.com/flex012/user_avatar/community.toggl.com/support/32/1577_2.png) [@Support](https://community.toggl.com/u/Support)\
**Post date:** [November 20, 2024, 5:50pm UTC](https://community.toggl.com/t/tracking-time/153/1 "2024-11-20T17:50:44Z")

</div>

### Run a new time entry[​](https://engineering.toggl.com/docs/tracking/#run-a-new-time-entry)

What are you waiting for? Start to track your time now!

```auto
curl -u <email>:<password> \ -H "Content-Type: application/json" \ -d '{"created_with":"API example code","description":"Hello Toggl","tags":[],"billable":false,"workspace_id":{workspace_id},"duration":-1,"start":"1984-06-08T11:02:53.000Z","stop":null}' \ -X POST https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries

```

A new time entry will start tracking time. You can see the running time in the [Toggl Track web app](https://track.toggl.com/timer).

[image]

Remember to replace `{workspace_id}` for the corresponding one both in the URL path and in the payload field `"workspace_id"`.

You can always ask the details about your running time entry as follows:

```auto
  curl -u <email>:<password> \ -H "Content-Type: application/json" \ -X GET https://api.track.toggl.com/api/v9/me/time_entries/current

```

```auto
{ "data": { "id": 436694100, "wid": 777, "pid": 193791, "billable": false, "start": "1984-01-30T09:08:04+00:00", "duration": -1, "description": "Running time entry", "at": "1984-01-30T09:08:12+00:00" }}

```

#### About the duration field[​](https://engineering.toggl.com/docs/tracking/#about-the-duration-field)

To create a time entry that started and stopped you can provide both the `start` and the `duration` fields. Where the:

- `start` field will have the format “2022-10-27T15:38:45Z”
- `duration` field will have the duration in seconds, for example 120.

To create a time entry that started and continues to be running, the `duration` field must be negative. In UNIX environments you can create a running time entry for the current date using the following command:

```auto
curl -u <email>:<password> \ -H "Content-Type: application/json" \ -d '{"created_with":"API example code","description":"Hello Toggl","tags":[],"billable":false,"workspace_id":{workspace_id},"duration":-1,"start":"'$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)'","stop":null}' \ -X POST https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries

```

### Stop an existing time entry[​](https://engineering.toggl.com/docs/tracking/#stop-an-existing-time-entry)

Don’t forget to stop your running time entry!

```auto
curl -u <email>:<password> \ -X PATCH https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop

```

And now, the time entry is in your history.

[image]

### Manual mode[​](https://engineering.toggl.com/docs/tracking/#manual-mode)

It is always possible to insert a time entry specifying the start time and the duration.

info

The stop time will be considered as the start time plus the specified duration.

```auto
curl -u <email>:<password> \ -H "Content-Type: application/json" \ -d '{"description":"Meeting with clients","tags":["billed"],"workspace_id":{workspace_id},"duration":1200,"start":"2022-03-05T07:58:58.000Z","created_with":"curl"}' \ -X POST https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries

```

### Time entry history[​](https://engineering.toggl.com/docs/tracking/#time-entry-history)

If you want to retrieve the list of time entries in a specific time window, you can use `start_date` and `end_date` parameters as below.

> ⚠ CAUTION
> 
> The limit of returned time entries is 1000. Consider using detailed reports for the whole list.

```auto
curl -u <email>:<password> \ -H "Content-Type: application/json" \ -X GET "https://api.track.toggl.com/api/v9/me/time_entries?start_date=1984-03-10&end_date=1984-03-12"

```

The result is an array composed of time entry objects.

Check the docs on [Time Entry](https://engineering.toggl.com/docs/api/time_entries/) for further time entry operations.
