Introduction
The Grip AI REST API provides programmatic access to the Grip agent platform over HTTP. The API is built with FastAPI and offers both synchronous request/response and Server-Sent Events (SSE) streaming for real-time agent interactions. All API endpoints require authentication via Bearer token and are protected by per-IP and per-token rate limiting.Base URL
The API server runs on the host and port configured in yourconfig.json:
http://127.0.0.1:8080
All API routes are prefixed with /api/v1.
Versioning
The API uses URL path versioning. All current endpoints are under the/api/v1 prefix:
/api/v2, /api/v3, etc.
Rate Limits
The API implements sliding-window rate limiting at two levels:Per-IP Rate Limit
Applied before authentication to prevent brute-force attacks. Default: 60 requests per minute per IP address. The client IP is extracted from theX-Forwarded-For header (for reverse proxies) or the direct connection address.
Per-Token Rate Limit
Applied after authentication to prevent accidental token drain. Default: 60 requests per minute per token. Configure rate limits inconfig.json:
Rate Limit Responses
When a rate limit is exceeded, the API returns HTTP 429:Retry-After: Seconds until the oldest request expiresX-RateLimit-Remaining: Remaining requests in current window (0 when blocked)
Security Features
Bearer Token Authentication
All endpoints except/health and OAuth callbacks require a Bearer token. Tokens are auto-generated on first startup if not configured.
See Authentication for details.
Request Size Limits
Maximum request body size: 10 MB (configurable)Security Headers
All responses include security headers:X-Content-Type-Options: nosniffX-Frame-Options: DENYStrict-Transport-Security(if HTTPS)
CORS
Configure allowed origins for cross-origin requests:GET, POST, DELETE
Allowed headers: Authorization, Content-Type
Audit Logging
All requests are logged with:- Client IP
- Method and path
- Response status
- Processing time
- Rate limit remaining
Workspace Sandbox
Whentools.restrict_to_workspace is enabled, file operations are restricted to the agent workspace directory.
Error Responses
The API uses standard HTTP status codes:| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created (e.g., cron job created) |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (missing or invalid token) |
| 403 | Forbidden (feature disabled) |
| 404 | Not found (session, tool, workflow) |
| 429 | Too many requests (rate limit) |
| 502 | Bad gateway (agent execution failed) |
| 503 | Service unavailable |
Health Check
The API provides public and authenticated health endpoints:Next Steps
Authentication
Learn how to generate and use Bearer tokens
Chat Endpoint
Send messages to the agent with streaming support
Sessions
Manage conversation sessions
Tools
List and execute tools directly