微算力 · API 导航与自营网关
API 接入 EN
未登录登录
⏱️

专业时间追踪与项目管理助手

toggl-track · vv1.0.0
效率 安全 S+ 级 作者 byungkyu 公开目录收录
下载 2k 安装 636 收藏 6.1k 浏览 41.4k
原始页面

简介

通过 Maton 网关安全接入 Toggl Track API,提供完整的时间记录、项目客户管理与团队协作能力,助力精准工时统计与效率分析。

原始描述

Manage Toggl Track time entries, projects, clients, tags, and workspaces via API with OAuth authentication and CRUD operations.

中文使用说明 来自收录源

核心用法

toggl-track skill 是一个纯文档型的 API 集成网关,通过 Maton 平台代理访问 Toggl Track 官方 API。用户需先在 maton.ai 注册获取 MATON_API_KEY,并在 ctrl.maton.ai 完成 Toggl Track 的 OAuth 授权,即可通过标准 HTTP 请求管理时间条目、项目、客户和标签。

关键流程:

  1. 获取 Maton API Key 并设置环境变量
  2. 在 ctrl.maton.ai 创建 OAuth 连接并完成授权
  3. 通过 https://gateway.maton.ai/toggl-track/{api-path} 发送请求
  4. 支持多连接场景,通过 Maton-Connection 头指定特定连接

支持的 API 操作:

  • 用户与 workspace 信息查询
  • 时间条目的创建、查询、更新、停止、删除
  • 项目的 CRUD 管理(支持分页、状态过滤)
  • 客户的增删改查及归档/恢复
  • 标签的全生命周期管理

显著优点

  1. 零代码安全风险:纯 Markdown 文档型技能,无可执行代码,静态/动态分析均满分通过
  2. 托管 OAuth 简化授权:用户无需处理复杂的 OAuth 2.0 流程,Maton 自动管理 token 刷新
  3. 完整 API 覆盖:涵盖 Toggl Track v9 API 的核心功能,包括实时计时器(duration: -1)
  4. 多语言示例:提供 Python、JavaScript、Bash 等即拷即用的代码片段
  5. 官方背书:由 Maton 团队维护,MIT 许可证,T2 可信来源级别
  6. 透明合规:仅申请功能必需的 MATON_API_KEY,符合 GDPR 数据最小化原则

潜在缺点与局限性

  1. 依赖第三方网关:所有请求需经过 gateway.maton.ai,若 Maton 服务中断则不可用
  2. API 速率限制:受 Toggl Track 官方和 Maton 网关双重限流,高并发场景需注意
  3. 无离线功能:必须保持网络连接,无法本地缓存或离线记录时间
  4. 连接管理复杂度:多 workspace 用户需手动管理 Maton-Connection 头
  5. 文档型限制:无智能提示、参数校验或自动补全,纯靠用户阅读文档
  6. 地域延迟:网关服务器位置可能影响非美地区用户的响应速度

适合人群

  • 需要自动化时间追踪的开发者/自由职业者
  • 团队管理员需批量管理项目/客户/标签
  • 已有 Toggl Track 账号且熟悉 REST API 的技术用户
  • 希望避免自建 OAuth 集成的中小企业
  • 对代码安全敏感、偏好纯文档型工具的用户

常规风险

  1. API Key 泄露风险:MATON_API_KEY 一旦泄露,攻击者可访问该账号下所有 Toggl 数据
  2. OAuth 令牌生命周期:长期活跃的连接若未定期审查,可能存在权限蔓延
  3. 数据同步延迟:网关层可能引入额外的请求延迟,对实时性要求高的场景需测试
  4. 供应商锁定:深度使用 Maton 网关后迁移至原生 Toggl API 需重新适配

技能正文


name: toggl-track description: | Toggl Track API integration with managed OAuth. Track time, manage projects, clients, and tags. Use this skill when users want to create, read, update, or delete time entries, projects, clients, or tags in Toggl Track. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). compatibility: Requires network access and valid Maton API key metadata: author: maton version: "1.0" clawdbot: emoji: 🧠 homepage: "https://maton.ai" requires: env: - MATON_API_KEY

Toggl Track

Access the Toggl Track API with managed OAuth authentication. Track time, manage projects, clients, tags, and workspaces.

Quick Start

# Get current user info
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/toggl-track/api/v9/me')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://gateway.maton.ai/toggl-track/{native-api-path}

Replace {native-api-path} with the actual Toggl Track API endpoint path. The gateway proxies requests to api.track.toggl.com and automatically injects your credentials.

Authentication

All requests require the Maton API key in the Authorization header:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your Toggl Track OAuth connections at https://ctrl.maton.ai.

List Connections

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=toggl-track&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'toggl-track'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Get Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Response:

{
  "connection": {
    "connection_id": "0acc2145-4d3e-4eaf-bdfd-7b04e0e0d649",
    "status": "ACTIVE",
    "creation_time": "2026-02-13T19:31:31.452264Z",
    "last_updated_time": "2026-02-13T19:36:10.489069Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "toggl-track",
    "metadata": {}
  }
}

Open the returned url in a browser to complete OAuth authorization.

Delete Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Specifying Connection

If you have multiple Toggl Track connections, specify which one to use with the Maton-Connection header:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/toggl-track/api/v9/me')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '0acc2145-4d3e-4eaf-bdfd-7b04e0e0d649')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

If omitted, the gateway uses the default (oldest) active connection.

API Reference

User & Workspace

Get Current User

GET /toggl-track/api/v9/me

Response:

{
  "id": 12932942,
  "email": "user@example.com",
  "fullname": "John Doe",
  "timezone": "America/Los_Angeles",
  "default_workspace_id": 21180405,
  "beginning_of_week": 1,
  "image_url": "https://assets.track.toggl.com/images/profile.png"
}

List Workspaces

GET /toggl-track/api/v9/me/workspaces

Get Workspace

GET /toggl-track/api/v9/workspaces/{workspace_id}

List Workspace Users

GET /toggl-track/api/v9/workspaces/{workspace_id}/users

Time Entries

List Time Entries

GET /toggl-track/api/v9/me/time_entries

Query Parameters:

  • since (integer) - UNIX timestamp for entries modified after this time
  • before (string) - Get entries before this date (RFC3339 or YYYY-MM-DD)
  • start_date (string) - Filter start date (YYYY-MM-DD)
  • end_date (string) - Filter end date (YYYY-MM-DD)

Get Current (Running) Time Entry

GET /toggl-track/api/v9/me/time_entries/current

Returns null if no time entry is currently running.

Get Time Entry by ID

GET /toggl-track/api/v9/me/time_entries/{time_entry_id}

Create Time Entry

POST /toggl-track/api/v9/workspaces/{workspace_id}/time_entries
Content-Type: application/json

{
  "description": "Working on project",
  "start": "2026-02-13T10:00:00Z",
  "duration": -1,
  "workspace_id": 21180405,
  "project_id": 216896134,
  "tag_ids": [20053808],
  "created_with": "maton-api"
}

Note: Set duration to -1 to start a running timer. The created_with field is required.

Response:

{
  "id": 4290254971,
  "workspace_id": 21180405,
  "project_id": null,
  "task_id": null,
  "billable": false,
  "start": "2026-02-13T19:58:43Z",
  "stop": null,
  "duration": -1,
  "description": "Working on project",
  "tags": null,
  "tag_ids": null,
  "user_id": 12932942
}

Update Time Entry

PUT /toggl-track/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}
Content-Type: application/json

{
  "description": "Updated description",
  "project_id": 216896134
}

Stop Running Time Entry

PATCH /toggl-track/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop

Delete Time Entry

DELETE /toggl-track/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}

Projects

List Projects

GET /toggl-track/api/v9/workspaces/{workspace_id}/projects

Query Parameters:

  • active (boolean) - Filter by active status
  • since (integer) - UNIX timestamp for modification filter
  • name (string) - Filter by project name
  • page (integer) - Page number
  • per_page (integer) - Items per page (max 200)

Get Project

GET /toggl-track/api/v9/workspaces/{workspace_id}/projects/{project_id}

Create Project

POST /toggl-track/api/v9/workspaces/{workspace_id}/projects
Content-Type: application/json

{
  "name": "New Project",
  "active": true,
  "is_private": true,
  "client_id": 68493239,
  "color": "#0b83d9",
  "billable": true
}

Response:

{
  "id": 216896134,
  "workspace_id": 21180405,
  "client_id": null,
  "name": "New Project",
  "is_private": true,
  "active": true,
  "color": "#0b83d9",
  "billable": true,
  "created_at": "2026-02-13T19:58:36+00:00"
}

Update Project

PUT /toggl-track/api/v9/workspaces/{workspace_id}/projects/{project_id}
Content-Type: application/json

{
  "name": "Updated Project Name",
  "color": "#ff0000"
}

Delete Project

DELETE /toggl-track/api/v9/workspaces/{workspace_id}/projects/{project_id}

Clients

List Clients

GET /toggl-track/api/v9/workspaces/{workspace_id}/clients

Query Parameters:

  • status (string) - Filter: active, archived, or both
  • name (string) - Case-insensitive name filter

Get Client

GET /toggl-track/api/v9/workspaces/{workspace_id}/clients/{client_id}

Create Client

POST /toggl-track/api/v9/workspaces/{workspace_id}/clients
Content-Type: application/json

{
  "name": "New Client",
  "notes": "Client notes here"
}

Response:

{
  "id": 68493239,
  "wid": 21180405,
  "archived": false,
  "name": "New Client",
  "at": "2026-02-13T19:58:36+00:00",
  "creator_id": 12932942
}

Update Client

PUT /toggl-track/api/v9/workspaces/{workspace_id}/clients/{client_id}
Content-Type: application/json

{
  "name": "Updated Client Name"
}

Delete Client

DELETE /toggl-track/api/v9/workspaces/{workspace_id}/clients/{client_id}

Archive Client

POST /toggl-track/api/v9/workspaces/{workspace_id}/clients/{client_id}/archive

Restore Client

POST /toggl-track/api/v9/workspaces/{workspace_id}/clients/{client_id}/restore
Content-Type: application/json

{
  "restore_all_projects": true
}

Tags

List Tags

GET /toggl-track/api/v9/workspaces/{workspace_id}/tags

Query Parameters:

  • page (integer) - Page number
  • per_page (integer) - Items per page

Create Tag

POST /toggl-track/api/v9/workspaces/{workspace_id}/tags
Content-Type: application/json

{
  "name": "New Tag"
}

Response:

{
  "id": 20053808,
  "workspace_id": 21180405,
  "name": "New Tag",
  "at": "2026-02-13T19:58:37.115714Z",
  "creator_id": 12932942
}

Update Tag

PUT /toggl-track/api/v9/workspaces/{workspace_id}/tags/{tag_id}
Content-Type: application/json

{
  "name": "Updated Tag Name"
}

Delete Tag

DELETE /toggl-track/api/v9/workspaces/{workspace_id}/tags/{tag_id}

Pagination

Toggl Track uses page-based pagination for most list endpoints:

GET /toggl-track/api/v9/workspaces/{workspace_id}/projects?page=1&per_page=50

For time entries, use timestamp-based filtering:

GET /toggl-track/api/v9/me/time_entries?since=1707840000&start_date=2026-02-01&end_date=2026-02-28

Code Examples

JavaScript

const response = await fetch(
  'https://gateway.maton.ai/toggl-track/api/v9/me/time_entries',
  {
    headers: {
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    }
  }
);
const timeEntries = await response.json();

Python

import os
import requests

response = requests.get(
    'https://gateway.maton.ai/toggl-track/api/v9/me/time_entries',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
time_entries = response.json()

Start a Timer

import os
import requests
from datetime import datetime, timezone

response = requests.post(
    'https://gateway.maton.ai/toggl-track/api/v9/workspaces/21180405/time_entries',
    headers={
        'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
        'Content-Type': 'application/json'
    },
    json={
        'description': 'Working on task',
        'start': datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),
        'duration': -1,
        'workspace_id': 21180405,
        'created_with': 'maton-api'
    }
)

Notes

  • Workspace IDs are integers (e.g., 21180405)
  • Time entry IDs are large integers (e.g., 4290254971)
  • Duration is in seconds; use -1 for running timers
  • Timestamps use ISO 8601 format (e.g., 2026-02-13T19:58:43Z)
  • The created_with field is required when creating time entries
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets to disable glob parsing
  • IMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments

Error Handling

Status Meaning
400 Missing Toggl Track connection or invalid request
401 Invalid or missing Maton API key
403 Access denied
404 Resource not found
429 Rate limited
4xx/5xx Passthrough error from Toggl Track API

Troubleshooting: API Key Issues

  1. Check that the MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
  1. Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Troubleshooting: Invalid App Name

  1. Ensure your URL path starts with toggl-track. For example:
  • Correct: https://gateway.maton.ai/toggl-track/api/v9/me
  • Incorrect: https://gateway.maton.ai/api/v9/me

Resources

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

其他来源收录

同一技能在不同目录的原始页面:

标签

productivitytime-trackingapiproject-managementofficeautomation

同类 Skill