ProtonIQ Agent API
The ProtonIQ Agent API allows you to programmatically run AI-powered analysis on your CRM data. Submit prompts, receive structured insights, and integrate ProtonIQ's intelligence into your workflows.
Base URL
https://your-domain.com/api/v1/agent
Quick Start
- Generate an API key from the Admin Panel
- Submit a run with your prompt
- Poll for results (typically 5-30 seconds)
Authentication
All API requests require a Bearer token. API keys can be created and managed in the Admin Panel.
API Key Format
Keys are prefixed with piq_ for easy identification.
The full key is only shown once at creation—store it securely.
Header Format
Authorization: Bearer piq_xxxxxxxxxxxxxxxxxxxxx
Keep your API keys secure
Never expose keys in client-side code or public repositories. Rotate keys immediately if compromised.
Rate Limits
Rate limits are enforced per API key to ensure fair usage and system stability. Each API key has its own quota, independent of other keys.
Limits by Endpoint
| Endpoint | Limit | Notes |
|---|---|---|
POST /runs |
5 requests/minute | Expensive async agent jobs |
GET /runs/{id} |
60 requests/minute | Status polling |
GET /models |
60 requests/minute | Reference data |
GET /tools |
60 requests/minute | Reference data |
Rate Limit Response
When a rate limit is exceeded, the API returns HTTP 429 with a structured error
and a Retry-After header.
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Limit: 5 per 1 minute",
"retry_after_seconds": 60
}
}
Handling Rate Limits
When you receive a 429 response, wait for the number of seconds specified in
retry_after_seconds
before retrying. Implement exponential backoff for robust integrations.
# Check Retry-After header
curl -i https://your-domain.com/api/v1/agent/runs \
-H "Authorization: Bearer piq_xxxxx" \
-H "Content-Type: application/json" \
-d '{"prompt": "Test"}' 2>&1 | grep -i retry-after
/api/v1/agent/runs
Submit a new agent run. The run is processed asynchronously—poll the status endpoint to get results.
Request Body
| Parameter | Type | Description |
|---|---|---|
prompt required |
string | The question or instruction for the agent |
model |
string | Model to use (default: gemini-3-pro). See available models. |
response_format |
object | JSON schema for structured output. Format: {"type": "json_schema", "schema": {...}} |
context_config |
object | Pre-load specific entities using HubSpot IDs: {"deal_ids": ["12345"], "company_ids": ["67890"], "contact_ids": ["11111"]} |
Example Request
curl -X POST https://your-domain.com/api/v1/agent/runs \
-H "Authorization: Bearer piq_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"prompt": "What deals are closing this month and what are the risks?",
"model": "gemini-3-pro"
}'
Response
{
"run_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"created_at": "2026-01-14T12:00:00Z"
}
/api/v1/agent/runs/{run_id}
Retrieve the status and results of a run. Poll this endpoint until status is completed or failed.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
run_id required |
string (UUID) | The run ID returned from POST /runs |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
response_detail |
string | Detail level for response: full_trace, tool_summary (default), or final_only |
Example Request
curl "https://your-domain.com/api/v1/agent/runs/550e8400-e29b-41d4-a716-446655440000?response_detail=full_trace" \
-H "Authorization: Bearer piq_xxxxx"
Run Status Values
| Status | Description |
|---|---|
pending |
Run is queued and waiting to be processed |
running |
Run is currently being processed by the agent |
completed |
Run finished successfully—results available |
failed |
Run encountered an error—check error field |
Response (Completed)
{
"run_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"prompt": "What deals are closing this month?",
"model": "gemini-3-pro",
"result": "Based on your pipeline, there are 5 deals expected to close this month...",
"structured_output": null,
"tool_calls": [
{"tool": "search_deals", "summary": "Found 5 deals closing in January"},
{"tool": "get_deal_details", "summary": "Retrieved details for Acme Corp deal"}
],
"usage": {
"input_tokens": 1250,
"output_tokens": 890,
"duration_ms": 12500
},
"created_at": "2026-01-14T12:00:00Z",
"started_at": "2026-01-14T12:00:01Z",
"completed_at": "2026-01-14T12:00:14Z"
}
Response Detail Levels
| Level | tool_calls Content |
|---|---|
full_trace |
Complete tool call history with inputs and outputs |
tool_summary |
Tool names and brief summaries (default) |
final_only |
No tool calls returned—only final result |
/api/v1/agent/models
List available models for agent runs.
Example Request
curl https://your-domain.com/api/v1/agent/models \
-H "Authorization: Bearer piq_xxxxx"
Available Models
| Model ID | Name | Provider | JSON Mode |
|---|---|---|---|
gemini-3-pro |
Gemini 3 Pro | ✓ | |
gemini-3-flash |
Gemini 3 Flash | ✓ | |
claude-opus-4.6 |
Claude Opus 4.6 | Anthropic | – |
claude-sonnet-4.5 |
Claude Sonnet 4.5 | Anthropic | – |
gpt-5.2-pro |
GPT-5.2 Pro | OpenAI | ✓ |
gpt-5.2 |
GPT-5.2 | OpenAI | ✓ |
Models are loaded dynamically. This list updates automatically.
Error Codes
The API uses standard HTTP status codes. Errors include a JSON body with details.
Error Response Format
{
"error": {
"code": "invalid_api_key",
"message": "The provided API key is invalid or has been revoked."
}
}
Common Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
invalid_api_key |
401 | API key is missing, malformed, or revoked |
permission_denied |
403 | API key doesn't have the required permission |
run_not_found |
404 | The specified run_id doesn't exist |
invalid_model |
400 | Specified model is not available |
invalid_schema |
400 | response_format contains an invalid JSON schema |
rate_limit_exceeded |
429 | Too many requests—slow down |
internal_error |
500 | Unexpected server error |