Skip to main content

Overview

The Shieldbase External API provides a comprehensive set of endpoints for integrating AI capabilities into your applications. This API supports:
  • Models Management - List available AI models
  • File Upload & Indexing - Upload documents for semantic search
  • Library Management - Browse and manage uploaded files
  • Semantic Search - Hybrid BM25 + vector search across your content
  • Chat Streaming - Real-time AI conversations via SSE
  • Headless Agents - Blocking agentic task execution
All endpoints are mounted at /external-docs and require API key authentication. Interactive documentation is available at /external-docs/docs (Scalar UI).

Authentication

All API endpoints (except /external/keys/*) require three headers:

Getting API Keys

  1. Login to your Shieldbase account at https://app.sbai.cloud/
  2. Navigate to Settings → API
  3. Click “Generate” to create your API credentials
  4. Save them securely - the API key is only shown once!
Keep your API credentials secure. Never commit them to version control or expose them in client-side code.

Base URLs


Quick Start

1. Set Environment Variables

2. Test Connection


Endpoints

Models

List Available Models

GET /external/models Returns all AI models available in the system with real-time availability status. Example Request:
Example Response:

Upload

Upload Files to Library

POST /external/upload Upload files asynchronously. Files are queued for indexing and become searchable once processing completes. Supported file types:
pdf, doc, docx, xls, xlsx, csv, json, txt, html, ppt, pptx, zip, md, sql, yml, yaml, png, jpg, jpeg, gif, webp
Max file size: 1 GB per file Example Request:
Example Response:

Libraries

List Library Files

GET /external/libraries Retrieve paginated list of library files with advanced filtering options. Query Parameters: Example Request:
Example Response:

POST /external/search Combine keyword matching (BM25) with semantic similarity (vector search) for best results. Payload Fields: Example Request:
Advanced Search Example:
Example Response:

Chat (Streaming)

Create New Conversation

POST /external/conversations Create a new conversation and receive real-time AI responses via SSE streaming. Payload Fields: additional_metadata Options: Example Request:
SSE Event Types:

Continue Existing Conversation

POST /external/conversations/ Send a follow-up message to an existing conversation and stream the AI reply. Example Request:
Use the conversation_id from the conversation_created event to continue the thread.

Agents (Headless Execution)

Run Agentic Task

POST /external/agents/run Headless agentic execution - perfect for automation, scripts, and webhooks. Payload Fields: Example Request:
Example Response:
When to use /external/agents/run vs /external/conversations:
Timeout: Default 10 minutes, max 30 minutes. Returns HTTP 408 if exceeded.

Privacy & Data Redaction

Redacting Sensitive Information

To protect sensitive data in prompts and responses, you can enable automatic redaction of:
  • PII (Personally Identifiable Information): Names, emails, phone numbers, addresses
  • Financial Data: Credit card numbers, bank account numbers
  • Credentials: API keys, passwords, tokens
  • Custom Patterns: Define your own regex patterns for domain-specific data
Example configuration (backend):
Example usage in API request:
The system will automatically redact sensitive information:
  • Input: "John Doe, john@example.com, 555-1234"
  • Processed: "[REDACTED_NAME], [REDACTED_EMAIL], [REDACTED_PHONE]"

Rate Limits

100 requests per minute per API key
Rate limit headers are included in responses:
  • X-RateLimit-Limit: Total requests allowed per minute
  • X-RateLimit-Remaining: Requests remaining in current window
  • X-RateLimit-Reset: Unix timestamp when the limit resets

Error Handling

All errors follow this format:
Common error codes:

Testing Script

Save this as test-external-api.sh:
Make it executable and run:

Additional Resources


Coming Soon

  • Python SDK
  • JavaScript/TypeScript SDK
  • Go SDK
  • Webhook support for async notifications
  • GraphQL endpoint
  • Batch processing API