API overview
What the Grape API does, how to authenticate, which resource endpoints exist, and the global conventions to know before calling it.
Grape exposes an HTTP API for:
- Scripts and CI to read repositories, Issues, tasks, and events
- Agents to report progress, report results, and initiate handoff during execution
- Platform integrations to read Runtimes, Skills, Scenes, and settings
- External systems to receive events, query logs, and trigger Pipelines
Every public endpoint starts with /api/ and uses HTTPS.
1. Choose a reading path first
| What you want to do | Where to start |
|---|---|
| Send your first request | Quickstart |
| Understand authentication and token types | Authentication and credentials |
| Look up the endpoints of a resource | Resources API |
2. Three things to remember about authentication
- User-level API key: starts with
grape_, suitable for scripts and long-term integrations - Session token: starts with
tk_, valid only during Agent task execution - Browser session: the JWT or Cookie after login, suitable only for web pages
Calls usually look like this:
curl -fsS -H @~/.grape.auth \
"https://<your-domain>/api/auth/profile"
For authentication details, the three ways to pass credentials, and scope limits, see Authentication and credentials.
3. Resource endpoints
| Group | Endpoints | Purpose |
|---|---|---|
| Tasks and events | Tasks · Events · TaskLogs | Task reporting, event queries, execution logs |
| Issues and reviews | Issues · A2A | Issue cards, status transitions, Agent handoff |
| Repositories and code | Repos · Git Repos | Repository hosting, branches, commits, files, PRs |
| Scenes and Skills | Scenes · Skills · Agents | Scene templates, Skills, Agent configuration |
| Chat and knowledge | Chat · Knowledge | Conversations, sessions, Knowledge Base |
| Platform and Runtime | Runtime · Settings · DevStage | Workers, Engines, credentials, development environments |
| Account and other | Auth / Dashboard / other · Feedback · Patrol | Accounts, dashboards, feedback, inspections |
For the full list and per-page scope, see Resources API.
Endpoints added in 2026-12
These endpoints are part of the public contract now; see the owning resource page for parameters and responses:
| Method | Path | Owning page |
|---|---|---|
POST |
/api/issues/{issue_id}/workspace/reset |
Issues |
PUT / DELETE |
/api/repos/favorite |
Repos |
PUT |
/api/repos/{owner}/{repo}/default-scene |
Repos |
GET |
/api/runs/{run_id} |
Runtime |
PATCH |
/api/scenes/{scene_id}/nodes/{node_id}/skill |
Scenes |
GET |
/api/tasks/preflight |
Tasks |
4. Global conventions
Base URL
https://<your-domain>/api/...
For self-hosted deployments, the address is determined by server_base_url or the actual access domain; Agent tasks usually receive GRAPE_SERVER_URL.
Request format
| Item | Convention |
|---|---|
| Request has a body | Content-Type: application/json |
| Authentication | One of Authorization, PRIVATE-TOKEN, or access_token |
| Response | application/json by default |
| Streaming response | Accept: text/event-stream |
Pagination
Pagination parameters are not unified across endpoints:
- Most endpoints use
page+page_size - The Issues family uses
per_page - Streaming and cursor endpoints use
limitorsince
Follow the specific endpoint page. Do not assume every list accepts the same set of parameters.
Time
Most time fields are YYYY-MM-DD HH:MM:SS with no timezone suffix; SQLite and MySQL have different wall-clock semantics, and a few fields return ISO 8601. When comparing across systems, measure each field; do not assume a timezone.
IDs and repository identifiers
| Identifier | Meaning |
|---|---|
grape_... |
User-level API key |
tk_... |
Session token |
t_... |
Agent execution instance / task |
seq |
Event sequence number |
issue_id |
Issue card id |
owner/repo |
Repository; the full form is <provider>:owner/repo |
Error format
4xx business errors:
{"detail": {"code": 404, "message": "Not Found", "error_code": "REPO_NOT_FOUND"}}
500 fallback:
{"code": 500, "message": "Internal Server Error", "request_id": "..."}
Callers branch on code / error_code; do not parse the message text. For the full list of error codes, see the Error code dictionary.
Rate limiting
On 429, back off according to retry_after in the response; do not retry in a loop immediately.
5. Versioning and compatibility
Current endpoints have no version number; use /api/... uniformly.
Breaking changes are handled through new paths or an explicit deprecation process; callers should note:
- New response fields are generally backward compatible
- Field removal, type changes, and semantic changes are breaking changes
- Retired endpoints return
410 Gone
6. Next steps
- First call: Quickstart
- Writing long-running scripts: Authentication and credentials
- Look up a specific endpoint: Resources API