Guide
Endpoints
API Reference: Endpoints & Request Structure
Overview
The Kambrium API allows you to interact with Large Language Models (LLMs) to retrieve data, generate insights, or take actions within your connected SaaS applications. This section details the available endpoint, including request format, response structure, and best practices.
1. Endpoint: Create an AI-Driven Action
Endpoint URL
Purpose
This endpoint processes a natural language prompt to execute actions within your integrated SaaS platforms or retrieve structured data insights. The AI interprets the request, triggers necessary SaaS integrations, and returns a structured response.
Request Format
Headers
Body Parameters
api_key: string
(required) Your authentication key.
prompt: string
(required): Natural language instruction for the AI.
Example Request (Python)
2. Response Structure
A successful request returns a structured JSON response.
Example Response (201 Created)
Response Fields
run_id: string
A unique identifier for this request.
prompt:string
The original prompt sent in the request.
result:string
The outcome of the request (e.g., confirmation message).
time_needed:float
Time taken (in seconds) to process the request.
tokens_usage:int
Number of tokens consumed for this request.
status:string
Status of the request (success
or failed
).
3. Error Handling
If the request fails, the API returns an error message along with an appropriate HTTP status code.
Example Error Response
Common Errors & Fixes
400 Bad Request
: Invalid request format: Check JSON structure
401 Unauthorized
: Missing or incorrect API key: Verify API key in payload
500 Internal Server Error
: Kambrium API is down or experiencing issues: Retry later or contact support
4. Best Practices for API Usage
Use Clear, Concise Prompts
Example: "Retrieve the latest deal updates from Salesforce for John Doe."
Avoid vague prompts like: "Get me some sales data."
Monitor Token Usage
Each request consumes tokens based on prompt complexity.
Track usage in your Kambrium Dashboard to optimize efficiency.
Handle API Rate Limits
Ensure your system can handle errors gracefully in case of API throttling.
Implement exponential backoff when retrying failed requests.
Secure Your API Key
Never expose your API key in client-side code.
Store it securely in environment variables or secret management tools.