| name | time-tracking-1-toggl-track-time-entries |
| description | Sub-skill of time-tracking: 1. Toggl Track - Time Entries. |
| version | 1.0.0 |
| category | business |
| type | reference |
| scripts_exempt | true |
1. Toggl Track - Time Entries
1. Toggl Track - Time Entries
REST API - Time Entries:
curl -s -u "$TOGGL_API_TOKEN:api_token" \
"https://api.track.toggl.com/api/v9/me/time_entries/current" | jq
curl -s -u "$TOGGL_API_TOKEN:api_token" \
"https://api.track.toggl.com/api/v9/me/time_entries" | jq
START_DATE=$(date -d "7 days ago" +%Y-%m-%dT00:00:00Z)
END_DATE=$(date +%Y-%m-%dT23:59:59Z)
curl -s -u "$TOGGL_API_TOKEN:api_token" \
"https://api.track.toggl.com/api/v9/me/time_entries?start_date=$START_DATE&end_date=$END_DATE" | jq
curl -s -X POST -u "$TOGGL_API_TOKEN:api_token" \
-H "Content-Type: application/json" \
"https://api.track.toggl.com/api/v9/workspaces/WORKSPACE_ID/time_entries" \
-d '{
"created_with": "api",
"description": "Working on project documentation",
"tags": ["documentation", "writing"],
"billable": false,
"workspace_id": WORKSPACE_ID,
"project_id": PROJECT_ID,
"start": "'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'",
"duration": -1
}' | jq
curl -s -X PATCH -u "$TOGGL_API_TOKEN:api_token" \
-H "Content-Type: application/json" \
"https://api.track.toggl.com/api/v9/workspaces/WORKSPACE_ID/time_entries/TIME_ENTRY_ID/stop" | jq
curl -s -X POST -u "$TOGGL_API_TOKEN:api_token" \
-H "Content-Type: application/json" \
"https://api.track.toggl.com/api/v9/workspaces/WORKSPACE_ID/time_entries" \
-d '{
"created_with": "api",
"description": "Code review session",
"workspace_id": WORKSPACE_ID,
"project_id": PROJECT_ID,
"start": "2025-01-15T09:00:00.000Z",
"duration": 3600,
"tags": ["review", "development"]
}' | jq
curl -s -X PUT -u "$TOGGL_API_TOKEN:api_token" \
-H "Content-Type: application/json" \
"https://api.track.toggl.com/api/v9/workspaces/WORKSPACE_ID/time_entries/TIME_ENTRY_ID" \
-d '{
"description": "Updated description",
"tags": ["updated-tag"]
}' | jq
curl -s -X DELETE -u "$TOGGL_API_TOKEN:api_token" \
"https://api.track.toggl.com/api/v9/workspaces/WORKSPACE_ID/time_entries/TIME_ENTRY_ID"
Python - Toggl Time Entries:
import requests
from datetime import datetime, timedelta
from base64 import b64encode
import os
class TogglClient:
"""Toggl Track API client."""
BASE_URL = "https://api.track.toggl.com/api/v9"
def __init__(self, api_token=None):
self.api_token = api_token or os.environ.get("TOGGL_API_TOKEN")
self.auth = (self.api_token, "api_token")
def _request(self, method, endpoint, data=None):
"""Make API request."""
url = f"{self.BASE_URL}{endpoint}"
response = requests.request(
method,
url,
auth=self.auth,
json=data,
headers={"Content-Type": "application/json"}
)
response.raise_for_status()
return response.json() if response.text else None
def get_me(self):
"""Get current user info."""
return self._request("GET", "/me")
def get_workspaces(self):
._request(, )
():
._request(, )
():
params = []
start_date:
params.append()
end_date:
params.append()
query = params
._request(, )
():
data = {
: ,
: description,
: workspace_id,
: billable,
: datetime.utcnow().strftime(),
: -
}
project_id:
data[] = project_id
tags:
data[] = tags
._request(
,
,
data
)
():
._request(
,
)
():
data = {
: ,
: description,
: workspace_id,
: start_time.strftime(),
: duration_seconds,
: billable
}
project_id:
data[] = project_id
tags:
data[] = tags
._request(
,
,
data
)
():
._request(
,
,
kwargs
)
*Content truncated — see parent skill full reference.*