3.7 KiB
Assistant Internal API
The Assistant Internal API provides capabilities for OpenCode agents to interact with the manager backend via a secure bearer-token API.
Authentication
All endpoints require a bearer token. The token can be found at:
.opencode/internal-token(relative to the assistant workspace cwd)
Include the token in requests:
Authorization: Bearer <token>
Endpoints
Notifications
POST /api/internal/notifications/send
Send push notifications to the user's registered devices.
Request Body:
{
title: string // 1-120 characters
body: string // 1-500 characters
url?: string // Optional: deep link (1-500 chars)
tag?: string // Optional: notification tag (max 80 chars)
priority?: 'normal' | 'high'
}
Query Parameters:
userId(optional): Defaults to"default"
Response:
{
delivered: number
expired: number
failed: number
noSubscriptions: boolean
}
Rate Limiting: 10 requests per minute per token. Returns 429 Too Many Requests with Retry-After header when exceeded.
Status Codes:
200: Notification sent400: Invalid request body401: Missing or invalid bearer token429: Rate limit exceeded503: Push notifications not configured (missing VAPID)
Settings
GET /api/internal/settings
Retrieve the user's full settings and preferences.
Query Parameters:
userId(optional): Defaults to"default"
Response:
{
preferences: {
theme: 'dark' | 'light' | 'system',
mode: 'plan' | 'build',
defaultModel?: string,
defaultAgent?: string,
autoScroll: boolean,
expandDiffs: boolean,
expandToolCalls: boolean,
showReasoning: boolean,
simpleChatMode: boolean,
leaderKey?: string,
directShortcuts?: string[],
keyboardShortcuts: Record<string, string>,
customCommands: Array<{ name: string; description: string; promptTemplate: string }>,
notifications?: { enabled: boolean; ... },
repoOrder?: number[],
repoSortMode: 'recent' | 'manual' | 'name',
gitCredentials?: [...], // Read-only
gitIdentity?: {...}, // Read-only
tts?: {...}, // Read-only
stt?: {...}, // Read-only
},
updatedAt: number
}
PATCH /api/internal/settings
Update a subset of safe user preferences.
Allowed Keys: The following preference keys can be modified:
theme,mode,defaultModel,defaultAgentautoScroll,expandDiffs,expandToolCalls,showReasoningsimpleChatMode,leaderKey,directShortcutskeyboardShortcuts,customCommands,notificationsrepoOrder,repoSortMode
Restricted Keys: The following keys are NOT allowed and will be rejected:
gitCredentials- Git credentials must be managed via the full UIgitIdentity- Git identity must be managed via the full UItts.apiKey- TTS credentials must be managed via the full UIstt.apiKey- STT credentials must be managed via the full UIlastKnownGoodConfig- Internal state, do not modify
Request Body: Partial object with any of the allowed keys.
Response: Returns the updated settings object.
Status Codes:
200: Settings updated400: Invalid request body or disallowed key401: Missing or invalid bearer token
Skills
The assistant workspace includes three skills that document these capabilities:
- Schedule Management (
.opencode/skills/schedule-management/SKILL.md) - Notifications (
.opencode/skills/notifications/SKILL.md) - Manager Settings (
.opencode/skills/manager-settings/SKILL.md)
These skills are automatically provisioned when assistant mode is initialized and contain detailed examples and usage patterns.