API Manual
Version: 1.0
Overview
LayerClock's external API lets you manipulate work data from CLI scripts, CI/CD pipelines, and other tools.
Base URL: https://layerclock.com
Authentication
Every external API endpoint requires a Personal Access Token (PAT).
Issuing a PAT
Issue one from Settings → API Keys tab. Available on the Business plan and above (Business / Team).
How to send it
Pass it as a Bearer token in the Authorization header.
Authorization: Bearer lc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Token notes
- The token is shown only once, at creation time. Store it somewhere safe.
- Up to 10 tokens per account.
- You can set an expiration date (no expiration if left unset).
- Revoke tokens you no longer need from the settings screen.
Rate limits
| Limit | Value |
|---|---|
| Request cap | 1000 requests / hour / token |
| Window type | Fixed window (1 hour) |
Exceeding the limit returns 429 Too Many Requests, with a Retry-After header giving the seconds until the next window (3600).
HTTP/1.1 429 Too Many Requests
Retry-After: 3600
Response format
All responses are JSON.
Success
{
"success": true,
"data": { ... }
}
Error
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Description of the error"
}
}
Common error codes
| HTTP | code | Description |
|---|---|---|
| 401 | UNAUTHORIZED |
Token invalid/expired, or header missing |
| 403 | FORBIDDEN |
Business plan or higher required |
| 403 | SSO_REQUIRED |
The workspace enforces SSO and the key was not issued while signed in with its IdP |
| 429 | RATE_LIMITED |
Rate limit exceeded |
| 500 | INTERNAL_ERROR |
Internal server error |
Endpoint list
| Method | Path | Description |
|---|---|---|
| GET | /api/external/wbs |
List WBS items |
| POST | /api/external/wbs |
Create a WBS item |
| GET | /api/external/wbs/{id} |
Get a WBS item |
| PUT | /api/external/wbs/{id} |
Update a WBS item |
| DELETE | /api/external/wbs/{id} |
Delete a WBS item |
| GET | /api/external/logs |
List work logs |
| POST | /api/external/logs |
Create a work log |
| GET | /api/external/logs/{id} |
Get a work log |
| PUT | /api/external/logs/{id} |
Update a work log |
| DELETE | /api/external/logs/{id} |
Delete a work log |
| GET | /api/external/logs/summary |
Get a work log summary |
| GET | /api/external/timer/current |
Get the currently running timer |
| POST | /api/external/timer/start |
Start a timer |
| POST | /api/external/timer/stop |
Stop a timer |
Endpoint details
GET /api/external/wbs
List WBS items (project / phase / deliverable / task).
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
level |
integer | - | Filter by hierarchy level (1=project, 2=phase, 3=deliverable, 4=task) |
parent_id |
string | - | Only return children of this parent ID |
status |
string | - | Filter by status (NOT_STARTED / IN_PROGRESS / COMPLETED / ON_HOLD) |
Example response
{
"success": true,
"data": [
{
"id": "uuid",
"name": "Website Renewal",
"level": 1,
"status": "IN_PROGRESS",
"parent_id": null,
"order": 0,
"estimated_hours": "40.00",
"start_date": "2026-04-01T00:00:00.000Z",
"due_date": "2026-06-30T00:00:00.000Z",
"notes": null,
"created_at": "2026-03-01T00:00:00.000Z",
"updated_at": "2026-03-15T00:00:00.000Z"
}
]
}
POST /api/external/wbs
Create a WBS item. Hierarchy is set via level and parent_id (level=1 is a project with parent_id: null; level>=2 requires the parent's parent_id).
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | ✅ | Item name (max 255 chars) |
level |
integer | ✅ | Hierarchy (1=project ... 4=task) |
parent_id |
string | △ | Parent item ID (required for level>=2, null for level=1) |
status |
string | - | NOT_STARTED / IN_PROGRESS / COMPLETED / ON_HOLD |
estimated_hours |
number | - | Estimated hours (>= 0) |
start_date |
string | - | Start date (YYYY-MM-DD) |
due_date |
string | - | Due date (YYYY-MM-DD) |
notes |
string | - | Notes (max 10000 chars) |
Example response (201 Created)
{
"success": true,
"data": {
"id": "uuid",
"name": "Website Renewal",
"level": 1,
"status": "NOT_STARTED",
"parent_id": null,
"order": 0
}
}
Error codes
| HTTP | code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR |
Invalid input |
| 400 | INVALID_HIERARCHY |
Invalid parent/child hierarchy or date constraint |
| 400 | PROJECT_LIMIT_EXCEEDED |
Project limit reached |
| 404 | NOT_FOUND |
Parent item not found |
GET /api/external/wbs/{id}
Get a WBS item, including its descendant tree. Returns 404 NOT_FOUND if it doesn't exist.
PUT /api/external/wbs/{id}
Update a WBS item. Send only the fields you want to change (at least one required). Updatable fields: name / status / order / parent_id / estimated_hours / start_date / due_date / notes. Sending null clears a field (estimated_hours / start_date / due_date / notes).
Example response (200 OK)
{
"success": true,
"data": { "id": "uuid", "name": "Updated name", "status": "IN_PROGRESS" }
}
Error codes
| HTTP | code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR |
Invalid input |
| 400 | INVALID_HIERARCHY |
Invalid parent/child hierarchy or date constraint |
| 404 | NOT_FOUND |
Item not found |
DELETE /api/external/wbs/{id}
Delete a WBS item along with everything below it (child phases, deliverables, tasks). Time logs are not deleted: they are detached from the WBS and keep their task name. Fails if a timer is running underneath it.
impact counts the deleted items; logs is the number of time logs detached from the WBS.
Example response (200 OK)
{
"success": true,
"data": {
"impact": { "phases": 2, "deliverables": 5, "tasks": 12, "logs": 34 }
}
}
Error codes
| HTTP | code | Description |
|---|---|---|
| 404 | NOT_FOUND |
Item not found |
| 409 | ACTIVE_TIMER_EXISTS |
A running timer exists underneath; cannot delete |
GET /api/external/logs
List work logs with pagination.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
startDate |
string | - | Filter by start date (ISO 8601, e.g. 2026-04-01) |
endDate |
string | - | Filter by end date (ISO 8601) |
projectId |
string | - | Filter by project ID |
tagId |
string | - | Filter by tag ID (repeatable: ?tagId=xxx&tagId=yyy) |
page |
integer | - | Page number (default: 1) |
perPage |
integer | - | Items per page (default: 20) |
Example response
{
"success": true,
"data": {
"logs": [
{
"id": "uuid",
"wbs_item_id": "uuid",
"start_time": "2026-04-01T09:00:00.000Z",
"end_time": "2026-04-01T11:30:00.000Z",
"duration": 9000,
"created_at": "2026-04-01T11:30:00.000Z",
"actor": {
"memberKey": "owner",
"name": "Taro Yamada",
"isOwner": true
}
}
],
"total": 42,
"page": 1,
"perPage": 20
}
}
durationis in seconds.
actoridentifies who recorded the log.memberKeyis a workspace-scoped handle ("owner"for the owner, an internal member ID for members,"former"for members who left) — it never contains the global user UUID.nameis the display name (nullif unset or for former members).
POST /api/external/logs
Manually create a work log. Logs can only be added to tasks (level=4).
Request body
| Field | Type | Required | Description |
|---|---|---|---|
wbs_item_id |
string | ✅ | ID of the task to log against (level=4 only) |
start_time |
string | ✅ | Start time (ISO 8601, e.g. 2026-04-01T09:00:00Z) |
end_time |
string | ✅ | End time (ISO 8601, after start_time) |
Example response (201 Created)
{
"success": true,
"data": {
"id": "uuid",
"wbs_item_id": "uuid",
"start_time": "2026-04-01T09:00:00.000Z",
"end_time": "2026-04-01T11:30:00.000Z",
"duration": 9000,
"actor": { "memberKey": "owner", "name": "Taro Yamada", "isOwner": true }
}
}
durationis in seconds (computed server-side). See the GET list description foractor.
Error codes
| HTTP | code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR |
Missing required field, invalid datetime, or target isn't a task |
| 400 | INVALID_TIME_RANGE |
end_time is at or before start_time |
| 403 | FORBIDDEN |
No access to the target task |
| 404 | NOT_FOUND |
Task not found |
GET /api/external/logs/{id}
Get a work log. Returns 404 NOT_FOUND if it doesn't exist, 403 FORBIDDEN if it belongs to another workspace.
PUT /api/external/logs/{id}
Update a work log's start/end time (at least one of start_time / end_time required). duration is recalculated.
Error codes
| HTTP | code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR |
No fields to update, or invalid datetime |
| 400 | INVALID_TIME_RANGE |
end_time is at or before start_time |
| 404 | NOT_FOUND |
Log not found |
DELETE /api/external/logs/{id}
Delete a work log.
Example response (200 OK)
{
"success": true,
"data": { "deleted": true }
}
GET /api/external/logs/summary
Get an aggregated work log summary.
Query parameters
Same as /api/external/logs (except page / perPage).
Example response
{
"success": true,
"data": {
"totalSeconds": 72000,
"tree": [
{
"id": "uuid",
"name": "Website Renewal",
"level": 1,
"totalSeconds": 72000,
"children": [ ... ]
}
]
}
}
GET /api/external/timer/current
Get the currently running timer. Returns data: null if no timer is running.
Example response (timer running)
{
"success": true,
"data": {
"timer_id": "uuid",
"task_id": "uuid",
"started_at": "2026-04-01T09:00:00.000Z",
"elapsed_seconds": 3600,
"task": {
"id": "uuid",
"name": "Write design doc"
}
}
}
Example response (no timer running)
{
"success": true,
"data": null
}
POST /api/external/timer/start
Start a timer on a task. Only one timer can run per account at a time.
Request body
{
"task_id": "uuid"
}
| Field | Type | Required | Description |
|---|---|---|---|
task_id |
string | ✅ | ID of the task to start the timer on (level=4 only) |
Example response (201 Created)
{
"success": true,
"data": {
"timer_id": "uuid",
"task_id": "uuid",
"started_at": "2026-04-01T09:00:00.000Z"
}
}
Error codes
| HTTP | code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR |
task_id missing |
| 404 | NOT_FOUND |
Task not found |
| 409 | TIMER_ALREADY_RUNNING |
A timer is already running |
POST /api/external/timer/stop
Stop the running timer and record a work log.
Request body
{
"task_id": "uuid"
}
| Field | Type | Required | Description |
|---|---|---|---|
task_id |
string | ✅ | ID of the task to stop |
Example response (200 OK)
{
"success": true,
"data": {
"log_id": "uuid",
"task_id": "uuid",
"start_time": "2026-04-01T09:00:00.000Z",
"end_time": "2026-04-01T11:30:00.000Z",
"duration": 9000
}
}
durationis in seconds.
Error codes
| HTTP | code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR |
task_id missing |
| 404 | NOT_FOUND / NO_ACTIVE_TIMER |
Task not found, or no timer is running |
MCP server
LayerClock also exposes this external API as an MCP (Model Context Protocol) server (POST /api/mcp). Claude, Cursor, and custom agents can operate on WBS items, work logs, and timers in natural language. Authentication uses the same PAT (Business plan and above).
For full details (supported methods, tool list, client setup, examples), see the MCP Server Manual.
Examples
curl
TOKEN="lc_your_token_here"
BASE="https://layerclock.com"
# List WBS items (tasks only)
curl -H "Authorization: Bearer $TOKEN" "$BASE/api/external/wbs?level=4"
# Get this month's work logs
curl -H "Authorization: Bearer $TOKEN" \
"$BASE/api/external/logs?startDate=2026-04-01&endDate=2026-04-30"
# Start a timer
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"task_id":"your-task-uuid"}' \
"$BASE/api/external/timer/start"
# Stop a timer
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"task_id":"your-task-uuid"}' \
"$BASE/api/external/timer/stop"
Python
import requests
TOKEN = "lc_your_token_here"
BASE = "https://layerclock.com"
HEADERS = {"Authorization": f"Bearer {TOKEN}"}
# Get a work log summary
res = requests.get(f"{BASE}/api/external/logs/summary", headers=HEADERS)
data = res.json()["data"]
print(f"Total time: {data['totalSeconds'] // 3600} hours")