Skip to main content

Overview

The Granite API provides programmatic access to all platform features. It’s a RESTful API with JSON request/response bodies.

Base URL

https://api.getgranite.ai
For local development:
http://localhost:8000

Authentication

For server-to-server communication:
curl -X GET "https://api.getgranite.ai/api/me" \
  -H "X-Granite-API-Key: gk_live_abc123..."

API Categories

The API is organized into these categories:
CategoryDescriptionEndpoints
AuthenticationUser login, logout, sessions7
OrganizationsOrg management, members7
AgentAgent execution, runs8
AutomationsWorkflow jobs, processes7
RPARPA execution5
AnalyticsMetrics and dashboards15
API ManagementKeys, endpoints10
DriversMachine management6
VM ManagementMIG, installation VMs16
Total: 110+ endpoints

Request Format

All requests should include:
-H "Content-Type: application/json"
Request bodies are JSON:
{
  "name": "My Process",
  "description": "Does something useful"
}

Response Format

Successful responses return JSON:
{
  "id": "job_abc123",
  "name": "My Process",
  "status": "ready",
  "created_at": "2024-01-15T10:30:00Z"
}
Error responses include:
{
  "error": "not_found",
  "message": "Resource not found",
  "code": 404
}

Status Codes

CodeMeaning
200Success
201Created
400Bad request
401Unauthorized
403Forbidden
404Not found
429Rate limited
500Server error

Rate Limits

PlanLimit
Free100 requests/hour
Pro1,000 requests/hour
EnterpriseCustom
Rate limit headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1705320000

Pagination

List endpoints support pagination:
GET /api/agent/runs?limit=20&offset=40
Response includes pagination info:
{
  "items": [...],
  "total": 150,
  "limit": 20,
  "offset": 40
}

Streaming Endpoints

Some endpoints return Server-Sent Events (SSE):
  • GET /api/agent/run - Agent execution stream
  • GET /api/rpa/run - RPA execution stream
const eventSource = new EventSource(
  'https://api.getgranite.ai/api/agent/run?prompt=...',
  { withCredentials: true }
);

eventSource.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data);
};

WebSocket Endpoints

Real-time communication:
  • wss://api.getgranite.ai/ws/driver - Driver connection
  • wss://api.getgranite.ai/api/frontend-ws - Frontend updates

OpenAPI Specification

The complete API specification is available:
  • Swagger UI: https://api.getgranite.ai/docs
  • ReDoc: https://api.getgranite.ai/redoc
  • OpenAPI JSON: https://api.getgranite.ai/openapi.json

SDK

Use our TypeScript SDK for easier integration:
import { client } from '@getgraniteai/ts-sdk';

client.setConfig({
  baseUrl: 'https://api.getgranite.ai',
  headers: { 'X-Granite-API-Key': 'your-key' },
});

const user = await client.getCurrentUser();
See TypeScript SDK for details.

Explore the API

Browse endpoints by category in the sidebar, or use the interactive API playground.