API Reference
All Arif AI endpoints are accessible via the Mjara API framework at:
/api/method/arif_ai.api.{endpoint}Authentication
| Method | Description |
|---|---|
| Mjara Session | Automatic for logged-in users |
| API Key | user@example.com:api_secret |
| Bearer Token | Optional JWT support |
Response Format
All endpoints return a standard response structure:
{
"message": {
"success": true,
"data": {},
"tokens_used": {
"input": 150,
"output": 50,
"total": 200
}
}
}Rate Limits
- Chat & Conversations: 100 requests/minute
- Tool Executions: 50 requests/minute
Rate limit headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
Chat Endpoints
POST /api/method/arif_ai.api.chat_with_tools
Send a message and receive a response with optional tool execution.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
user_message | string | Yes | The user's message |
conversation_id | string | No | Existing conversation ID |
auto_execute_tools | boolean | No | Execute tools automatically |
system_prompt | string | No | Custom system instructions |
max_tokens | integer | No | Maximum response length |
POST /api/method/arif_ai.api.chat_with_tools_multimodal
Send a message with file attachments (images, documents).
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
user_message | string | Yes | The user's message |
files[] | file | No | Attached files |
conversation_id | string | No | Existing conversation ID |
GET /api/method/arif_ai.api.stream_ai_response
Stream responses via Server-Sent Events (SSE).
Event Types: content, tool_start, tool_result, done, error
Conversation Endpoints
POST /api/method/arif_ai.api.create_conversation
Create a new conversation session.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
title | string | No | Conversation title |
GET /api/method/arif_ai.api.list_conversations
List all conversations for the current user.
Parameters:
| Field | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
page_size | integer | 20 | Results per page |
status | string | Active | Filter by status |
GET /api/method/arif_ai.api.get_conversation_history
Retrieve messages from a conversation.
Parameters:
| Field | Type | Default | Description |
|---|---|---|---|
conversation_id | string | — | Required. Conversation ID |
limit | integer | 50 | Max messages to return |
offset | integer | 0 | Pagination offset |
DELETE /api/method/arif_ai.api.delete_conversation
Soft-delete a conversation (permanent after 30 days).
GET /api/method/arif_ai.api.search_conversations
Full-text search across conversations.
Tool Endpoints
GET /api/method/arif_ai.api.get_available_tools
List all available tools with optional schema details.
Parameters:
| Field | Type | Default | Description |
|---|---|---|---|
include_schema | boolean | false | Include JSON schemas |
category | string | null | Filter by category |
POST /api/method/arif_ai.api.execute_tool
Execute a specific tool.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
tool_name | string | Yes | Tool identifier |
params | object | No | Tool parameters |
Returns: success, result, execution_time_ms. May return requires_confirmation and action_id for high-risk operations.
Onboarding Endpoints
POST /api/method/arif_ai.api.start_onboarding
Start a new onboarding session.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
modules | array | No | Modules to set up |
company_name | string | No | Pre-fill company name |
POST /api/method/arif_ai.api.submit_onboarding_answer
Submit an answer to an onboarding question.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | Onboarding session ID |
question_key | string | Yes | Question identifier |
answer | any | Yes | User's answer |
POST /api/method/arif_ai.api.execute_onboarding_configuration
Execute the generated configuration after review.
GET /api/method/arif_ai.api.get_onboarding_status
Check the status of an onboarding session.
Confirmation Endpoints
POST /api/method/arif_ai.api.confirm_action
Confirm a pending high-risk action.
POST /api/method/arif_ai.api.reject_action
Reject a pending action with an optional reason.
GET /api/method/arif_ai.api.list_pending_actions
List all pending confirmations for the current user.
Settings Endpoints
GET /api/method/arif_ai.api.get_settings
Retrieve full Arif AI Settings (admin only).
GET /api/method/arif_ai.api.get_config
Retrieve client-safe configuration subset.
Example: REST API Usage
# Create a conversation
curl -X POST https://your-site/api/method/arif_ai.api.create_conversation \
-H "Content-Type: application/json" \
-H "Authorization: Bearer api_key" \
-d '{"title": "My Query"}'
# Send a message
curl -X POST https://your-site/api/method/arif_ai.api.chat_with_tools \
-H "Content-Type: application/json" \
-H "Authorization: Bearer api_key" \
-d '{"user_message": "List my customers", "conversation_id": "123"}'
# Stream responses
curl -N https://your-site/api/method/arif_ai.api.stream_ai_response?prompt=Hello \
-H "Authorization: Bearer api_key"