Home
Cart


Soarenity Blue API Documentation

Integrate Soarenity Blue into your website or application using a secure, modern, and fully automated pipeline.
Questions? support@soarenity.ai

Quick Start

  1. Subscribe and generate your Blue API key.
    Your API key identifies your business and must be kept secret. Store it only on your server as an environment variable.
  2. Create a secure backend proxy for Blue.
    Your frontend must never communicate with Soarenity Blue directly. Instead, you will forward requests through your server.
    Python Flask Secure Proxy Example
    @app.route("/api/blue_v1", methods=["POST"]) def blue_v1_proxy(): """ Secure proxy for Blue. Browser → Your Server → Soarenity Blue (with your API key). """ from flask import request, jsonify import requests, os payload = request.get_json(force=True) or {} api_key = os.environ.get("BLUE_KEY") # store this safely on your server if not api_key: return jsonify({"error": "Blue API key not configured on server"}), 500 try: upstream = requests.post( "https://blue.soarenity.ai/api/blue_v1", headers={ "X-API-Key": api_key, "Content-Type": "application/json" }, json=payload, timeout=30, ) except Exception as ex: return jsonify({"error": f"Upstream Blue error: {ex}"}), 502 return ( upstream.content, upstream.status_code, {"Content-Type": upstream.headers.get("Content-Type", "application/json")} )
    Set your key in your server environment:
    BLUE_KEY=SOAR-XXXXX
  3. Add the Blue widget and point it at your proxy.
    Your site tells the widget where to send user messages. The widget never sees your API key.
    Widget Setup
    <script> window.SOARENITY_BLUE_ENDPOINT = "/api/blue_v1"; </script> <script src="https://soarenity.ai/static/js/soarenity_blue_widget.js"></script>
  4. Implement /soarenity_action to perform custom actions.
    Blue will call this endpoint whenever an action from your API Dashboard is executed.
  5. Configure your Actions, Knowledgebase, and Voice.
    All settings are managed in your API Dashboard. They automatically flow into Blue at runtime.

Endpoints

POST /api/blue_v1

This endpoint runs on your server. Your frontend sends user messages here. Your backend securely forwards the request to Soarenity Blue.

Frontend Request:
Browser → Your Server
POST /api/blue_v1 Content-Type: application/json { "text": "Show me my orders", "device_id": "USER_DEVICE_OR_SESSION_ID" }

device_id is a unique identifier for the user or session. Blue stores conversation memory tied to this value.

Response from Blue (forwarded by your server):
JSON Response
{ "response": "Here are your recent orders...", "audio_url": "/static/audio/blue_tts_xxxx.mp3", "avatar_state": "talking", "next_action": { "method": "GET", "endpoint": "/user/orders", "params": {} }, "pending_action": { "action": "refund_order", "parameters": {} } }

- If pending_action appears, the user must supply missing info. - If next_action appears, execute it in your backend (or via /soarenity_action).

Required: /soarenity_action

This endpoint lives on your server. Whenever Blue detects that an action must be executed, it sends the request here.

Action Payload:
JSON Action Request
{"action": "action_name", "parameters": {}}

Complete Example Implementation:

Python Flask /soarenity_action Example
@app.route("/soarenity_action", methods=["POST"]) def soarenity_action(): import sys print("\n--- /soarenity_action CALLED ---", file=sys.stderr) try: data = request.get_json(force=True) except Exception as ex: return jsonify({"error": "Failed to parse JSON", "detail": str(ex)}), 400 method = (data.get("method") or "GET").upper() endpoint = data.get("endpoint") or "/" params = data.get("params") or {} if not isinstance(endpoint, str): return jsonify({"error": "Invalid endpoint"}), 400 # Simple navigation if method == "GET" and endpoint.startswith("/") and params == {}: return jsonify({"navigate": endpoint}) if method == "GET" and endpoint.startswith("http"): return jsonify({"navigate": endpoint}) if endpoint.startswith("/"): endpoint = request.host_url.rstrip("/") + endpoint try: import requests if method == "GET": resp = requests.get(endpoint, params=params, timeout=12) elif method == "POST": resp = requests.post(endpoint, json=params, timeout=12) elif method == "PUT": resp = requests.put(endpoint, json=params, timeout=12) elif method == "DELETE": resp = requests.delete(endpoint, json=params, timeout=12) elif method == "PATCH": resp = requests.patch(endpoint, json=params, timeout=12) else: return jsonify({"error": f"Unsupported method: {method}"}), 400 try: return jsonify(resp.json()), resp.status_code except: return jsonify({"raw_body": resp.text}), resp.status_code except Exception as ex: return jsonify({"error": str(ex)}), 500

How Clarifications Work

  • When Blue needs more details, it responds with pending_action.
  • Your UI shows the clarification question to the user.
  • Your next request must include both the user's answer and the pending_action.
  • Once all parameters are supplied, Blue executes the action automatically.

Avatars & Animation

  • Swap avatar images or GIFs based on avatar_state (idle or talking).

Customization & Knowledgebase

  • Configure your Actions, Knowledgebase, and Voice in your Soarenity API Dashboard.
  • You may define up to 40 actions and 25 knowledgebase topics per API key.
  • All content is automatically included in the reasoning context sent to Soarenity Blue—with no extra code required.
  • Action definitions power pending_action, next_action, and your /soarenity_action automation.

File & Integration Notes

  • All backend files in your integration package (blue_app.py, gpt_service.py, blue_memory.py, elevenlabs_service.py, and blue_knowledge.py) are drop-in ready and do not require modification.
  • Only blue_action_listener.js (frontend helper) should be customized for your UI.
  • Your frontend should never include your API key. All communication must go through your secure /api/blue_v1 proxy.

API Call Structure

Secure Server-Side Forwarded Request
POST /api/blue_v1 <-- your server Content-Type: application/json { "text": "How do I track my order?", "device_id": "DEVICE_OR_SESSION_ID", "pending_action": { ...optional... } }
- Your frontend never sends X-API-Key.
- Your server attaches X-API-Key when forwarding to Soarenity Blue.
- device_id scopes state, memory, and context.
- Include pending_action only when Blue requests clarification.

Audio Response Handling

  • audio_url will be present when Blue generates speech output. It may point to a pre-recorded or dynamically generated MP3.
  • Audio is not generated for JSON code blocks, instructional responses, or metadata responses.
  • Your frontend can play the MP3 directly while updating avatar_state.

Security Requirements

  • Your Blue API key must NEVER appear in JavaScript or browser-visible files.
  • All communication must follow this path:
    Browser → Your Server (/api/blue_v1) → Soarenity Blue → Your Server → Browser
  • Store your API key in your server’s environment as BLUE_KEY.
  • Always validate user input on /soarenity_action and any automation endpoints.

Support

For developer assistance, action troubleshooting, knowledgebase setup, or advanced automation workflows, email support@soarenity.ai.

Soarenity Blue Avatar
Soarenity Blue