Overview
The Organizations API allows you to manage organizations within the RestAI platform. Organizations represent the top-level entity in the system hierarchy and contain branches, users, menus, and other business resources.
Base URL
https://api.restai.com/v1/orgs
Authentication
All organization endpoints require authentication via Bearer token:
Authorization: Bearer < your_toke n >
Permissions
Organization endpoints require specific permissions:
org:read - View organization details
org:update - Modify organization settings
org:create - Create new organizations (super_admin only)
Organization Object
Unique identifier for the organization
Organization name (2-255 characters)
URL to the organization’s logo image
Custom settings and configuration for the organization
When the organization was created
When the organization was last updated
Endpoints
List Organizations
GET /orgs Retrieve all organizations. Super admins see all organizations, org admins only see their own.
Required Permission: org:read
Request:
curl https://api.restai.com/v1/orgs \
-H "Authorization: Bearer <token>"
Response:
{
"success" : true ,
"data" : [
{
"id" : "123e4567-e89b-12d3-a456-426614174000" ,
"name" : "Restaurante El Buen Sabor" ,
"logo_url" : "https://example.com/logo.png" ,
"settings" : {
"timezone" : "America/Lima" ,
"currency" : "PEN"
},
"created_at" : "2024-01-15T10:00:00Z" ,
"updated_at" : "2024-03-01T15:30:00Z"
}
]
}
Get Organization
GET /orgs/:id Retrieve a specific organization by ID
Required Permission: org:read
Path Parameters:
Request:
curl https://api.restai.com/v1/orgs/123e4567-e89b-12d3-a456-426614174000 \
-H "Authorization: Bearer <token>"
Response:
{
"success" : true ,
"data" : {
"id" : "123e4567-e89b-12d3-a456-426614174000" ,
"name" : "Restaurante El Buen Sabor" ,
"logo_url" : "https://example.com/logo.png" ,
"settings" : {
"timezone" : "America/Lima" ,
"currency" : "PEN"
},
"created_at" : "2024-01-15T10:00:00Z" ,
"updated_at" : "2024-03-01T15:30:00Z"
}
}
Error Responses:
// 403 Forbidden - Non-super admin accessing another org
{
"success" : false ,
"error" : {
"code" : "FORBIDDEN" ,
"message" : "Sin acceso a esta organización"
}
}
// 404 Not Found
{
"success" : false ,
"error" : {
"code" : "NOT_FOUND" ,
"message" : "Organización no encontrada"
}
}
Update Organization
PATCH /orgs/:id Update organization details and settings
Required Permission: org:update
Path Parameters:
Body Parameters:
Organization name (2-255 characters)
URL to organization logo (must be valid URL)
Custom settings object with any key-value pairs
Request:
curl -X PATCH https://api.restai.com/v1/orgs/123e4567-e89b-12d3-a456-426614174000 \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Restaurante El Mejor Sabor",
"logo_url": "https://example.com/new-logo.png",
"settings": {
"timezone": "America/Lima",
"currency": "PEN",
"tax_included": true
}
}'
Response:
{
"success" : true ,
"data" : {
"id" : "123e4567-e89b-12d3-a456-426614174000" ,
"name" : "Restaurante El Mejor Sabor" ,
"logo_url" : "https://example.com/new-logo.png" ,
"settings" : {
"timezone" : "America/Lima" ,
"currency" : "PEN" ,
"tax_included" : true
},
"created_at" : "2024-01-15T10:00:00Z" ,
"updated_at" : "2024-03-02T10:15:00Z"
}
}
Next Steps
Branches Manage organization branches
Settings Configure organization settings