Skip to main content

Introduction

The External API allows you to integrate Junis AI agents into your own applications. Use your API key to invoke agents, manage sessions, and build powerful AI-powered features.
External API requires an active subscription (Basic or Pro). Credits are consumed for each API call.

Base URL

For OpenAI-compatible endpoints:

Authentication

All External API requests require an API key in the X-API-Key header:
Never expose your API key in client-side code. Use server-side calls or a backend proxy.

API Key Scopes

API keys can be created with specific scopes to limit access:

Available Endpoints

OpenAI-Compatible

Chat Completions

POST /v1/chat/completions - OpenAI-compatible chat API

Agent Management

List Agents

GET /agents - List available agents

Invoke Agent

POST /agents/{agent_id}/completions - Invoke specific agent

Session Management

List Sessions

GET /sessions - List chat sessions

Get Messages

GET /sessions/{session_id}/messages - Get session messages

RAG Knowledge Base

Create DataStore

POST /rag/datastores - Create new DataStore

Upload Files

POST /rag/upload - Upload files to DataStore

List Uploads

GET /rag/uploads - List upload history

List DataStores

GET /rag/datastores - List DataStores

Quick Start

1. Get Your API Key

  1. Go to Admin > API Keys
  2. Click Create API Key
  3. Select required scopes
  4. Copy and securely store the key (shown only once)

2. Make Your First Call

3. Parse the Response


SDK Support

OpenAI Python SDK

OpenAI Node.js SDK


Streaming

Enable streaming for real-time responses:

Rate Limits

Rate limit headers are included in all responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

Error Handling

All errors follow a consistent format:

Common Error Codes


Chat Completions

OpenAI-compatible chat API

Agent API

Individual agent invocation