Skip to main content

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_token>

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

id
string (uuid)
Unique identifier for the organization
name
string
Organization name (2-255 characters)
logo_url
string
URL to the organization’s logo image
settings
object
Custom settings and configuration for the organization
created_at
timestamp
When the organization was created
updated_at
timestamp
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:
id
string (uuid)
required
Organization ID
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:
id
string (uuid)
required
Organization ID
Body Parameters:
name
string
Organization name (2-255 characters)
logo_url
string
URL to organization logo (must be valid URL)
settings
object
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

Build docs developers (and LLMs) love