This document defines the REST API contract between the Backend Platform and other Orbito components (React SDK and Browser Extension).
Base URL: http://localhost:8001/api/v1
All API requests require an API key in the header:
X-API-Key: <website_api_key>
All IDs use UUID v4 format (string):
"550e8400-e29b-41d4-a716-446655440000"
ISO 8601 format with UTC timezone:
"2025-01-15T10:30:00.000Z"
Endpoint: POST /api/v1/websites/register
Description: Register a new website to get an API key for action registration.
Request Headers:
{
"Content-Type": "application/json"
}Request Body:
{
"domain": "example.com",
"owner_email": "owner@example.com",
"website_name": "Example Website"
}Response (201 Created):
{
"website_id": "550e8400-e29b-41d4-a716-446655440000",
"domain": "example.com",
"api_key": "orbito_key_abc123def456",
"created_at": "2025-01-15T10:30:00.000Z"
}Error Responses:
400 Bad Request: Invalid domain or missing fields409 Conflict: Domain already registered
Endpoint: POST /api/v1/actions/register
Description: Register or update an action from the React SDK.
Request Headers:
{
"Content-Type": "application/json",
"X-API-Key": "orbito_key_abc123def456"
}Request Body:
{
"action_id": "add-to-cart-button",
"intent": "addToCart",
"description": "Adds the current product to the shopping cart",
"selector": "[data-orbito-id='add-to-cart-button']",
"parameters": {
"quantity": {
"type": "number",
"required": false,
"default": 1,
"description": "Number of items to add"
},
"productId": {
"type": "string",
"required": true,
"description": "Product identifier"
}
},
"position": {
"x": 450,
"y": 320
},
"metadata": {
"component_type": "button",
"page_path": "/product/123"
}
}Response (200 OK):
{
"success": true,
"action_id": "add-to-cart-button",
"registered_at": "2025-01-15T10:30:00.000Z"
}Error Responses:
401 Unauthorized: Invalid or missing API key400 Bad Request: Invalid action schema429 Too Many Requests: Rate limit exceeded
Endpoint: GET /api/v1/actions
Description: Get all available actions for a website domain.
Query Parameters:
domain(required): Website domain (e.g., "example.com")is_active(optional): Filter by active status (default: true)
Request Headers:
{
"Content-Type": "application/json"
}Example Request:
GET /api/v1/actions?domain=example.com&is_active=true
Response (200 OK):
{
"domain": "example.com",
"actions": [
{
"action_id": "add-to-cart-button",
"intent": "addToCart",
"description": "Adds the current product to the shopping cart",
"selector": "[data-orbito-id='add-to-cart-button']",
"parameters": {
"quantity": {
"type": "number",
"required": false,
"default": 1,
"description": "Number of items to add"
},
"productId": {
"type": "string",
"required": true,
"description": "Product identifier"
}
},
"position": {
"x": 450,
"y": 320
},
"is_active": true,
"usage_count": 42,
"last_used": "2025-01-15T09:15:00.000Z"
}
],
"total_count": 1
}Error Responses:
404 Not Found: Domain not registered400 Bad Request: Invalid query parameters
Endpoint: GET /api/v1/websites/{website_id}
Description: Get details of a registered website.
Request Headers:
{
"X-API-Key": "orbito_key_abc123def456"
}Response (200 OK):
{
"website_id": "550e8400-e29b-41d4-a716-446655440000",
"domain": "example.com",
"website_name": "Example Website",
"owner_email": "owner@example.com",
"created_at": "2025-01-15T10:30:00.000Z",
"total_actions": 15,
"active_actions": 12
}Endpoint: PATCH /api/v1/actions/{action_id}/status
Description: Enable or disable an action.
Request Headers:
{
"Content-Type": "application/json",
"X-API-Key": "orbito_key_abc123def456"
}Request Body:
{
"is_active": false
}Response (200 OK):
{
"success": true,
"action_id": "add-to-cart-button",
"is_active": false,
"updated_at": "2025-01-15T10:30:00.000Z"
}Endpoint: POST /api/v1/actions/{action_id}/usage
Description: Increment usage counter when action is executed (called by SDK after successful execution).
Request Headers:
{
"X-API-Key": "orbito_key_abc123def456"
}Response (200 OK):
{
"success": true,
"usage_count": 43
}All error responses follow this structure:
{
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid or expired",
"details": {}
}
}INVALID_API_KEY: API key is missing or invalidDOMAIN_NOT_FOUND: Requested domain not registeredACTION_NOT_FOUND: Action ID doesn't existINVALID_SCHEMA: Request body doesn't match expected schemaRATE_LIMIT_EXCEEDED: Too many requestsDOMAIN_ALREADY_EXISTS: Domain already registered
- Action Registration: 100 requests per minute per API key
- Action Discovery: 60 requests per minute per IP
- Website Registration: 10 requests per hour per IP
Backend must allow:
- Origins: All domains (for extension)
- Methods: GET, POST, PATCH, DELETE, OPTIONS
- Headers: Content-Type, X-API-Key