API Documentation

Integrate Rubi Professional with your applications using our RESTful API. Pull customer data, interaction history, and analytics with secure authentication.

curl -X GET \
  'https://api.rubiprofessional.com/v2/customers' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Authentication

Generate Your API Key

API keys are generated from your Rubi Professional dashboard and are unique to your tenant.

  1. Log into your Rubi Professional dashboard
  2. Navigate to Settings → API Access
  3. Click "Generate New API Key"
  4. Copy your API GUID (keep this secure!)
  5. Add IP restrictions for enhanced security

Example Request

curl -X GET \
  'https://api.rubiprofessional.com/v2/customers' \
  -H 'Authorization: Bearer rubi_live_4f6b2c8d...' \
  -H 'Content-Type: application/json'

Required Headers

Authorization: Bearer YOUR_API_GUID
Content-Type: application/json
Accept: application/json

API Endpoints

GET

Customers

/v2/customers

Retrieve customer records with filtering and pagination

Parameters

  • tenant_id - Your tenant identifier (required)
  • start_date - Start date (YYYY-MM-DD)
  • end_date - End date (YYYY-MM-DD)
  • page - Page number (default: 1)
  • per_page - Records per page (max: 100)
GET

Interactions

/v2/interactions

Get call history, chat logs, and interaction details

Parameters

  • tenant_id - Your tenant identifier (required)
  • customer_id - Filter by customer ID
  • start_date - Start datetime (ISO 8601)
  • end_date - End datetime (ISO 8601)
  • interaction_type - call, chat, email, sms
GET

Analytics

/v2/analytics/reports

Generate custom reports and analytics data

Parameters

  • tenant_id - Your tenant identifier (required)
  • report_type - daily, weekly, monthly
  • start_date - Report start date
  • end_date - Report end date
GET

Tenant Info

/v2/tenant/info

Get tenant configuration and usage limits

Response Includes

  • • Account limits and current usage
  • • API rate limits
  • • Available features and integrations
  • • Billing information
GET/POST

Data Analytics

/tenant-admin/api/data-analytics.php

Advanced analytics and reporting capabilities

Actions

  • getMetrics - Real-time tenant metrics
  • getCustomerStats - Customer analytics
  • getInteractionTrends - Interaction patterns
  • getPaymentAnalytics - Payment insights
POST

Export Data

/tenant-admin/api/export-data.php

Export data in CSV, JSON, or Excel formats

Export Types

  • customers - Customer database export
  • interactions - Interaction history
  • payments - Payment records
  • analytics - Analytics reports
GET

CRM Search

/crm/api/search.php

Universal search across CRM data

Parameters

  • q - Search query
  • type - customer, interaction, note
  • limit - Results limit
POST

CRM Operations

Core CRM functionality endpoints

Endpoints

  • /crm/api/autosave.php - Auto-save form data
  • /crm/api/interaction.php - Create/update interactions
  • /crm/api/notes.php - Manage customer notes
  • /crm/api/payments.php - Payment operations
  • /crm/api/process-stripe-payment.php - Stripe processing
  • /crm/api/track-module-usage.php - Module tracking
GET/POST

Discovery Questions

/crm/modules/api/discovery/*

Dynamic questionnaire system

Key Endpoints

  • get-questions.php - Get question set
  • save-answers.php - Save responses
  • get-dependencies.php - Conditional logic
  • import-questions.php - Bulk import
POST

NICE CXone

/api/nice-cxone/*

Contact center integration

Features

  • click-to-dial.php - Click-to-dial functionality
  • status.php - Agent status monitoring
  • • Real-time call events
  • • Agent state management

Code Examples

JavaScript (Node.js)

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://api.rubiprofessional.com/v2',
  headers: {
    'Authorization': 'Bearer rubi_live_YOUR_API_GUID_HERE',
    'Content-Type': 'application/json'
  }
});

// Get customers for a date range
async function getCustomers() {
  try {
    const response = await apiClient.get('/customers', {
      params: {
        tenant_id: 'your_tenant_id',
        start_date: '2025-01-01',
        end_date: '2025-01-31',
        per_page: 25
      }
    });
    
    console.log('Customers:', response.data.data);
    return response.data;
  } catch (error) {
    console.error('API Error:', error.response.data);
  }
}

Python

import requests
from datetime import datetime, timedelta

class RubiAPI:
    def __init__(self, api_key, tenant_id):
        self.base_url = 'https://api.rubiprofessional.com/v2'
        self.headers = {
            'Authorization': f'Bearer {api_key}',
            'Content-Type': 'application/json'
        }
        self.tenant_id = tenant_id
    
    def get_interactions(self, start_date, end_date, customer_id=None):
        params = {
            'tenant_id': self.tenant_id,
            'start_date': start_date,
            'end_date': end_date
        }
        
        if customer_id:
            params['customer_id'] = customer_id
        
        response = requests.get(
            f'{self.base_url}/interactions',
            headers=self.headers,
            params=params
        )
        
        return response.json() if response.status_code == 200 else None

# Usage Example
api = RubiAPI('rubi_live_YOUR_API_GUID_HERE', 'your_tenant_id')
interactions = api.get_interactions('2025-01-01', '2025-01-31')

PHP

Data Export (JavaScript)

// Export customer data to CSV
async function exportCustomerData() {
  const exportRequest = {
    export_type: 'customers',
    format: 'csv',
    filters: {
      date_from: '2025-01-01',
      date_to: '2025-01-31',
      status: 'active'
    }
  };
  
  try {
    const response = await fetch('/tenant-admin/api/export-data.php', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(exportRequest)
    });
    
    const blob = await response.blob();
    const url = window.URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = 'customers_export.csv';
    a.click();
  } catch (error) {
    console.error('Export failed:', error);
  }
}

Analytics Query (Python)

# Get real-time analytics metrics
import requests
import json

def get_analytics_metrics(api_key, tenant_id):
    url = 'https://api.rubiprofessional.com/tenant-admin/api/data-analytics.php'
    
    payload = {
        'action': 'getMetrics',
        'tenant_id': tenant_id,
        'period': 'last_30_days',
        'metrics': ['customer_growth', 'interaction_volume', 'payment_total']
    }
    
    headers = {
        'Authorization': f'Bearer {api_key}',
        'Content-Type': 'application/json'
    }
    
    response = requests.post(url, json=payload, headers=headers)
    
    if response.status_code == 200:
        metrics = response.json()
        print(f"Customer Growth: {metrics['customer_growth']}%")
        print(f"Total Interactions: {metrics['interaction_volume']}")
        print(f"Revenue: ${metrics['payment_total']}")
    else:
        print(f"Error: {response.status_code}")

# Usage
get_analytics_metrics('YOUR_API_KEY', 'YOUR_TENANT_ID')

Discovery Questions (JavaScript)

// Dynamic questionnaire management
class DiscoveryQuestions {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = '/crm/modules/api/discovery';
  }
  
  async getQuestions(customerId) {
    const response = await fetch(`${this.baseUrl}/get-questions.php`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ customer_id: customerId })
    });
    
    return response.json();
  }
  
  async saveAnswers(customerId, answers) {
    const response = await fetch(`${this.baseUrl}/save-answers.php`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        customer_id: customerId,
        answers: answers
      })
    });
    
    return response.json();
  }
  
  // Handle conditional logic
  async checkDependencies(questionCode, answer) {
    const response = await fetch(`${this.baseUrl}/get-dependencies.php`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        question_code: questionCode,
        answer: answer
      })
    });
    
    return response.json();
  }
}

// Usage
const discovery = new DiscoveryQuestions('YOUR_API_KEY');
const questions = await discovery.getQuestions('CUST-12345');

NICE CXone Click-to-Dial (PHP)

Rate Limits

Lite Edition

1,000

requests per hour

Pro Edition

5,000

requests per hour

Enterprise

Unlimited

with custom SLA

Rate Limit Headers

Monitor your usage with these response headers:

X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1640995200

Webhooks

Stripe Payment Webhooks

Receive real-time payment notifications

Supported Events

  • payment_intent.succeeded
  • payment_intent.failed
  • charge.refunded
  • invoice.payment_succeeded

Endpoint: /webhooks/stripe.php
Configure in your Stripe Dashboard with your webhook signing secret

Module Activation Webhooks

Track module usage and activation events

Event Types

  • module.activated
  • module.deactivated
  • module.usage_limit_reached
  • module.trial_expired

Endpoint: /webhooks/modules.php
Automatically triggered by system events

Webhook Implementation Example