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
  • Workflow Execution - Queue published workflows for background execution
  • Chat Streaming - Real-time AI conversations via SSE
  • Headless Agents - Blocking agentic task execution
API endpoints use the /external/* path. Interactive documentation is available at /external-docs/docs (Scalar UI).

Authentication

All API endpoints (except /external/keys/*) require three headers:
For multitenant accounts, add the optional X-Tenant-ID header to select the tenant whose workflows, library, and data the request should use. The API key owner must have access to the selected tenant. The examples below include a tenant ID; omit that header if you do not need to select a tenant.

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:

Workflows (Background Execution)

The workflow endpoints let you find published workflows available to the API key owner, inspect their current input steps, queue a run, and check its progress. A queued workflow continues in the background after the trigger request returns.

Find a Workflow

GET /external/workflows Returns the latest published version of each workflow group the API key owner can access. Use group_id as the workflow path parameter in the active-workflow and run endpoints. The workflow_id in this response identifies a particular published version and is not used in those paths. Query parameters: page (default 1), page_size (default 20, maximum 100), and optional search (matches workflow title or description).
Example response:

Inspect Workflow Inputs

GET /external/workflows//active Returns the latest published workflow, including its steps and connectors. Use each step’s id or workflow_step_group_id as a key when sending form or file inputs. This lets integrations keep using the same step key when a workflow is republished with new version-specific step IDs.

Queue a Workflow Run

POST /external/workflows//runs Queues the latest published version for background execution. inputs is optional when the workflow does not need external form or file values. File URLs must be reachable by the workflow runtime. Use signed URLs when the file source requires access credentials.
The response includes the generated or supplied run_id, the selected version-specific workflow_id, and the initial queue status:

Check Run Status

GET /external/workflows/runs/ Poll this endpoint using the run_id returned by the trigger request. The response’s data.run contains the workflow run and step details; data.queue contains the latest queue item’s status. Requests must use the same API credentials and tenant selection as the trigger request.

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