Skip to main content

Goals API

Endpoints for managing goals across different time horizons.

List Goals

GET /api/workspaces/{workspaceId}/goals

Query Parameters

ParameterTypeDescription
spaceIdstringFilter by space
horizonstringFilter by horizon: short, mid, long
includeTasksbooleanInclude linked tasks
limitnumberMax results (default: 50)
offsetnumberPagination offset

Response

{
"goals": [
{
"id": "goal_123",
"title": "Launch API v2.0",
"description": "Complete API redesign with new endpoints",
"horizon": "mid",
"keywords": ["api", "release"],
"spaceId": "space_456",
"taskCount": 8,
"completedTaskCount": 5,
"progress": 62.5,
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
],
"total": 12,
"limit": 50,
"offset": 0
}

Get Goal

GET /api/workspaces/{workspaceId}/goals/{goalId}

Query Parameters

ParameterTypeDescription
includeTasksbooleanInclude linked tasks with details

Response

{
"id": "goal_123",
"title": "Launch API v2.0",
"description": "Complete API redesign with new endpoints",
"horizon": "mid",
"keywords": ["api", "release"],
"spaceId": "space_456",
"tasks": [
{
"id": "task_001",
"title": "Implement OAuth",
"status": "done",
"priority": "high"
},
{
"id": "task_002",
"title": "Add rate limiting",
"status": "in_progress",
"priority": "high"
}
],
"taskCount": 8,
"completedTaskCount": 5,
"progress": 62.5,
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}

Create Goal

POST /api/workspaces/{workspaceId}/goals

Request Body

{
"title": "Launch API v2.0",
"description": "Complete API redesign with new endpoints",
"horizon": "mid",
"keywords": ["api", "release"],
"spaceId": "space_456"
}

Fields

FieldTypeRequiredDescription
titlestringYesGoal title
descriptionstringNoDetailed description
horizonstringYesshort, mid, or long
keywordsstring[]NoTags for categorization
spaceIdstringNoAssociated space

Response

{
"id": "goal_123",
"title": "Launch API v2.0",
"description": "Complete API redesign with new endpoints",
"horizon": "mid",
"keywords": ["api", "release"],
"spaceId": "space_456",
"taskCount": 0,
"completedTaskCount": 0,
"progress": 0,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}

Update Goal

PATCH /api/workspaces/{workspaceId}/goals/{goalId}

Request Body

{
"title": "Launch API v2.0 Beta",
"description": "Updated description",
"horizon": "short",
"keywords": ["api", "beta"]
}

All fields are optional. Only provided fields are updated.

Response

Returns the updated goal object.

Delete Goal

DELETE /api/workspaces/{workspaceId}/goals/{goalId}

Response

{
"success": true
}

Note: Deleting a goal does not delete linked tasks.

POST /api/workspaces/{workspaceId}/goals/{goalId}/tasks

Request Body

{
"taskId": "task_001"
}

Response

{
"success": true,
"goal": {
"id": "goal_123",
"taskCount": 9
}
}
DELETE /api/workspaces/{workspaceId}/goals/{goalId}/tasks/{taskId}

Response

{
"success": true,
"goal": {
"id": "goal_123",
"taskCount": 8
}
}

Goal Horizons

HorizonValueTypical Timeframe
Short-termshortWeeks
Mid-termmidMonths/Quarter
Long-termlongYear+

Example: Create and Track Goal

// Create a goal
const goal = await fetch('/api/workspaces/ws_123/goals', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: 'Complete Q1 Documentation',
description: 'Update all API docs for v2.0 release',
horizon: 'mid',
keywords: ['docs', 'q1', 'api'],
spaceId: 'space_engineering',
}),
});

// Link existing tasks
await fetch(`/api/workspaces/ws_123/goals/${goal.id}/tasks`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
taskId: 'task_auth_docs',
}),
});

// Check progress
const progress = await fetch(
`/api/workspaces/ws_123/goals/${goal.id}?includeTasks=true`,
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
}
);