Vexar API

Data API (function calling)

Unlike the rest of this reference, the Data API is an outbound integration: you implement a single endpoint, and the Vexar AI calls it in real time to fetch your live data (products, orders, accounts). Configure it in Chatbot Settings → Data API.

How it works
  1. A visitor asks: “Do you have red sneakers under $50?”
  2. The AI decides to call search_products with {"query":"red sneakers","max_price":50}.
  3. Vexar sends a POST to your endpoint; your server returns matching items.
  4. The AI turns the result into a natural reply.

Setup

Enable and point Vexar at your endpoint via the chatbot config (see Chatbot Settings):

ParamDescription
data_api_enabledTurn the Data API on/off
data_api_urlYour endpoint URL (POST, JSON)
data_api_keySecret sent as Bearer token to your endpoint
data_api_timeoutRequest timeout, 3–30 sec (default 5)

Request your endpoint receives

POST {your data_api_url}
Authorization: Bearer {your data_api_key}
Content-Type: application/json
User-Agent: VexarChat-DataAPI/1.0

{
  "action": "search_products",
  "params": { "query": "red sneakers", "max_price": 50, "in_stock": true }
}

Response your endpoint returns

{
  "success": true,
  "data": [
    { "id": 123, "name": "Nike Air Max Red", "price": 45.99, "currency": "USD", "url": "https://…", "in_stock": true }
  ]
}

// on error:
{ "success": false, "error": "Product not found" }

Actions

Implement the actions your chatbot needs (at minimum ping). Each action sends an action name and a params object.

ActionParamsDescription
pingHealth check. Return {"success":true,"data":{"status":"ok"}}.
search_productsquery, category, min_price, max_price, in_stock, limitSearch products/services. Return an array of items.
get_productproduct_idDetails of one product.
get_categoriesList of categories.
check_availabilityproduct_idStock or booking availability.
check_order_statusorder_id, emailOrder status (at least one identifier).
lookup_accountaccount_id, phone, email, contract_numberAccount/subscription lookup (ISP, telecom, SaaS…). Return any relevant fields.

Test your connection

Vexar exposes one authenticated endpoint to test your Data API endpoint (it sends a ping):

POST /api/v1/data-api/test Auth

Send a ping to the given URL and report the result.

Request body
{ "url": "https://your-site.com/vexar-api", "api_key": "your-key", "timeout": 5 }
Response
{ "success": true, "message": "Connection successful", "data": { "status": "ok" } }

Example endpoint (PHP)

<?php
header('Content-Type: application/json');
$auth = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
if (str_replace('Bearer ', '', $auth) !== 'YOUR_SECRET_KEY') {
    http_response_code(401);
    echo json_encode(['success' => false, 'error' => 'Unauthorized']); exit;
}
$in = json_decode(file_get_contents('php://input'), true);
switch ($in['action'] ?? '') {
    case 'ping':
        echo json_encode(['success' => true, 'data' => ['status' => 'ok']]); break;
    case 'search_products':
        // … query your DB, return ['success'=>true,'data'=>[…]]
    default:
        echo json_encode(['success' => false, 'error' => 'Unknown action']);
}

Rules & limits

Max items per response10
Timeout5 s default, 30 s max
Method / formatPOST, JSON only
Max tool calls per message3
Supported AI providersOpenAI, Anthropic (Claude), Google Gemini — not DeepSeek
Live demos: e-commerce and ISP sample endpoints.