API Status: Operational

All systems functioning normally

API Documentation

Build powerful integrations with the Serve AI platform. Our REST API provides programmatic access to all platform features.

Quick Start

1. Get Your API Key

Sign up for an account and generate your API key from the dashboard

2. Install SDK

Choose from our official SDKs or use the REST API directly

3. Make First Call

Authenticate and make your first API request to list alerts

4. Go Live

Deploy your integration and start receiving real-time alerts

Authentication

API Key Authentication
All API requests must include your API key in the Authorization header
// Include your API key in the Authorization header
const response = await fetch('https://api.serve-ai.com/v1/alerts', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});

Important: Keep your API key secure and never expose it in client-side code. Use environment variables and server-side requests.

API Endpoints

GET
/api/v1/alerts
Auth Required

Retrieve a list of all alerts

POST
/api/v1/alerts
Auth Required

Create a new alert rule

GET
/api/v1/alerts/{id}
Auth Required

Get a specific alert by ID

PUT
/api/v1/alerts/{id}
Auth Required

Update an existing alert

DELETE
/api/v1/alerts/{id}
Auth Required

Delete an alert

PUT
/api/v1/alerts/{id}/resolve
Auth Required

Resolve an alert and mark it as addressed

PUT
/api/v1/alerts/{id}/assign
Auth Required

Assign an alert to a group member

GET
/api/v1/integrations
Auth Required

List all connected integrations

POST
/api/v1/integrations/connect
Auth Required

Connect a new integration

GET
/api/v1/reports
Auth Required

Get performance reports

POST
/api/v1/webhooks
Auth Required

Configure webhook endpoints

GET
/api/v1/groups
Auth Required

List all groups

POST
/api/v1/groups
Auth Required

Create a new group

GET
/api/v1/groups/{id}
Auth Required

Get group details

PUT
/api/v1/groups/{id}
Auth Required

Update group information

DELETE
/api/v1/groups/{id}
Auth Required

Delete a group

GET
/api/v1/users
Auth Required

List all users in the organization

POST
/api/v1/users
Auth Required

Create a new user

GET
/api/v1/users/{id}
Auth Required

Get user details

PUT
/api/v1/users/{id}
Auth Required

Update user information

DELETE
/api/v1/users/{id}
Auth Required

Delete a user

POST
/api/v1/users/{id}/groups
Auth Required

Add user to groups

DELETE
/api/v1/users/{id}/groups/{groupId}
Auth Required

Remove user from a group

Alerts API

The Alerts API allows you to create, manage, and respond to real-time alerts about your restaurant operations.

GET
/api/v1/alerts
Auth Required

Retrieve a list of all alerts

POST
/api/v1/alerts
Auth Required

Create a new alert rule

GET
/api/v1/alerts/{id}
Auth Required

Get a specific alert by ID

PUT
/api/v1/alerts/{id}
Auth Required

Update an existing alert

DELETE
/api/v1/alerts/{id}
Auth Required

Delete an alert

PUT
/api/v1/alerts/{id}/resolve
Auth Required

Resolve an alert and mark it as addressed

PUT
/api/v1/alerts/{id}/assign
Auth Required

Assign an alert to a group member

Integrations API

Connect and manage third-party services and platforms with your Serve AI account.

GET
/api/v1/integrations
Auth Required

List all connected integrations

POST
/api/v1/integrations/connect
Auth Required

Connect a new integration

Groups API

Manage groups, assign responsibilities, and control access permissions across your organization. Users can be part of multiple groups and have alerts assigned to them.

GET
/api/v1/groups
Auth Required

List all groups

POST
/api/v1/groups
Auth Required

Create a new group

GET
/api/v1/groups/{id}
Auth Required

Get group details

PUT
/api/v1/groups/{id}
Auth Required

Update group information

DELETE
/api/v1/groups/{id}
Auth Required

Delete a group

POST
/api/v1/users/{id}/groups
Auth Required

Add user to groups

DELETE
/api/v1/users/{id}/groups/{groupId}
Auth Required

Remove user from a group

Users API

Manage users within your organization. Users can be part of multiple groups and have alerts assigned to them directly.

GET
/api/v1/users
Auth Required

List all users in the organization

POST
/api/v1/users
Auth Required

Create a new user

GET
/api/v1/users/{id}
Auth Required

Get user details

PUT
/api/v1/users/{id}
Auth Required

Update user information

DELETE
/api/v1/users/{id}
Auth Required

Delete a user

POST
/api/v1/users/{id}/groups
Auth Required

Add user to groups

DELETE
/api/v1/users/{id}/groups/{groupId}
Auth Required

Remove user from a group

Webhooks API

Configure webhooks to receive real-time notifications when events occur in your Serve AI account.

GET
/api/v1/reports
Auth Required

Get performance reports

POST
/api/v1/webhooks
Auth Required

Configure webhook endpoints

Code Examples

Create an Alert
Set up a new alert rule to monitor your restaurant metrics
// Create a new alert rule
const response = await fetch('https://api.serve-ai.com/v1/alerts', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Cash Drawer Variance Alert',
    type: 'variance',
    threshold: 50,
    frequency: 'immediate',
    channels: ['push', 'email'],
    conditions: {
      metric: 'cash_drawer_variance',
      operator: 'greater_than',
      value: 50
    }
  })
});

const alert = await response.json();
List Alerts
Retrieve all configured alerts with pagination support
// Get all alerts with pagination
const response = await fetch('https://api.serve-ai.com/v1/alerts?page=1&limit=20', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const data = await response.json();
console.log(data.alerts); // Array of alert objects
console.log(data.pagination); // Pagination details
Configure Webhooks
Receive real-time notifications when alerts are triggered
// Configure a webhook endpoint
const response = await fetch('https://api.serve-ai.com/v1/webhooks', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    url: 'https://your-server.com/webhook',
    events: ['alert.triggered', 'alert.resolved'],
    secret: 'your-webhook-secret'
  })
});
Resolve an Alert
Mark an alert as resolved with details about the resolution
// Resolve an alert
const response = await fetch('https://api.serve-ai.com/v1/alerts/alert_1234567890/resolve', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    resolution: 'Cash drawer discrepancy was due to incorrect change given. Staff retrained.',
    resolved_by: 'user_987654321',
    resolution_time: new Date().toISOString()
  })
});

const resolvedAlert = await response.json();
Assign an Alert
Assign an alert to a specific team member for follow-up
// Assign an alert to a group member
const response = await fetch('https://api.serve-ai.com/v1/alerts/alert_1234567890/assign', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    assignee_id: 'user_123456789',
    group_id: 'group_456789',
    priority: 'high',
    notes: 'Please investigate ASAP - multiple occurrences this week'
  })
});

const assignedAlert = await response.json();
Create a Group
Create a new group with members and alert preferences
// Create a new group
const response = await fetch('https://api.serve-ai.com/v1/groups', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Morning Shift Group',
    description: 'Handles operations from 6 AM to 2 PM',
    location_ids: ['loc_123', 'loc_456'],
    manager_id: 'user_789',
    members: [
      { user_id: 'user_111', role: 'shift_lead' },
      { user_id: 'user_222', role: 'cashier' },
      { user_id: 'user_333', role: 'server' }
    ],
    alert_preferences: {
      channels: ['push', 'email'],
      severity_levels: ['high', 'critical'],
      categories: ['cash_management', 'labor', 'compliance']
    }
  })
});

const group = await response.json();
Create a User
Create a new user with permissions and notification preferences
// Create a new user
const response = await fetch('https://api.serve-ai.com/v1/users', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    email: 'john.doe@restaurant.com',
    name: 'John Doe',
    role: 'manager',
    department: 'operations',
    phone: '+1-555-0123',
    permissions: ['view_alerts', 'manage_alerts', 'view_reports'],
    notification_preferences: {
      channels: ['email', 'push'],
      alert_types: ['critical', 'high']
    }
  })
});

const user = await response.json();
List Users
Retrieve all users with filtering and pagination support
// Get all users with filtering
const response = await fetch('https://api.serve-ai.com/v1/users?role=manager&department=operations', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const data = await response.json();
console.log(data.users); // Array of user objects
console.log(data.pagination); // Pagination details

Response Format

Standard Response Structure
All API responses follow a consistent format
// Successful response
{
  "success": true,
  "data": {
    "id": "alert_1234567890",
    "name": "Cash Drawer Variance Alert",
    "type": "variance",
    "status": "active",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z",
    "conditions": {
      "metric": "cash_drawer_variance",
      "operator": "greater_than",
      "value": 50
    },
    "last_triggered": null,
    "trigger_count": 0
  }
}

// Error response
{
  "success": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "The threshold value must be a positive number",
    "field": "threshold"
  }
}

Rate Limits

API Rate Limiting
Rate limits help us provide a stable service for all users

Free Tier

1,000

requests per hour

Pro Tier

10,000

requests per hour

Enterprise

Custom

Contact sales

Rate limit information is included in response headers: X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset

Official SDKs

JavaScript/TypeScript
Official SDK for Node.js and browser environments
npm install @serve-ai/sdk
Python
Official SDK for Python applications
pip install serve-ai
Ruby
Official SDK for Ruby applications
gem install serve-ai
Go
Coming Soon
Official SDK for Go applications
go get github.com/serve-ai/go-sdk

The Go SDK is currently in development. Join our Discord to get notified when it's released.

Error Handling

Error Response Format
All API errors follow a consistent format to help you handle them gracefully
// Error Response Structure
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "field": "email",
    "details": {
      "constraint": "email",
      "value": "invalid-email"
    }
  },
  "request_id": "req_abc123xyz"
}
Common Error Codes
  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 429 - Rate Limited
  • 500 - Server Error
Error Codes
  • VALIDATION_ERROR
  • AUTHENTICATION_FAILED
  • INSUFFICIENT_PERMISSIONS
  • RESOURCE_NOT_FOUND
  • RATE_LIMIT_EXCEEDED
  • INTERNAL_ERROR

Pagination

Paginating Results
Large result sets are paginated to improve performance
// Request with pagination
GET /api/v1/alerts?page=2&limit=20

// Response with pagination metadata
{
  "data": [...],
  "pagination": {
    "page": 2,
    "limit": 20,
    "total": 156,
    "pages": 8,
    "has_next": true,
    "has_prev": true,
    "next_page": 3,
    "prev_page": 1
  }
}

Default Limit

20

items per page

Maximum Limit

100

items per page

Cursor Support

Yes

for real-time data

Changelog

Version 2.0.0
Latest
Released on January 15, 2024
  • Improved webhook reliability with retry mechanism
  • Enhanced error messages with more context
  • !Deprecated v1 authentication method (use Bearer tokens)
Version 1.5.0
Released on December 1, 2023
  • Added Groups API endpoints
  • Introduced alert assignment functionality
  • Performance improvements for large datasets

Developer Support

API Status

Check the current API status and subscribe to updates

Community

Join our Discord community for discussions and help

Premium Support

Get dedicated support for enterprise integrations

Need Help?

Our developer support team is here to help you build amazing integrations