API Documentation

Talk to Your Data - AI Powered Document Intelligence

Overview

Sparx is an AI powered document intelligence platform that enables natural language querying of PDF documents using advanced Retrieval-Augmented Generation technology. Upload your documents and ask questions to get accurate, sourced answers with page citations.

📄 PDF Processing

Automatic document chunking and vectorization for optimal retrieval

🔍 Smart Search

Semantic search across multiple documents with relevance ranking

💬 Natural Language

Ask questions in plain English and get contextual answers

📚 Source Citations

Every answer includes source document and page number references

🔐 Multi-Tenant

Complete data isolation between tenants with secure authentication

⚡ Streaming

Real-time streaming responses for better user experience

Getting Started

1. Provision Your Instance

Create a Sparx instance through IBM Cloud. Upon provisioning, you'll receive:

2. Upload Documents

Upload PDF documents using the upload endpoint with your API key.

3. Query Your Data

Ask natural language questions and receive AI-generated answers with source citations.

API Endpoints

Base URL https://ibm-sparx.squared.ai

GET /health
Health check endpoint to verify service status
POST /upload
Upload PDF document for processing and indexing
GET /documents
List all documents for your tenant
DELETE /documents/{id}
Delete a specific document by ID
POST /chat/completions
Query documents with natural language questions (streaming response)

Usage Example

Upload a Document

curl -X POST https://ibm-sparx.squared.ai/upload \ -H "X-API-Key: YOUR_API_KEY" \ -F "file=@document.pdf"

Query Your Documents

curl -X POST https://ibm-sparx.squared.ai/chat/completions \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "messages": [ {"role": "user", "content": "What are the key findings?"} ], "stream": true }'

Response Format

Streaming Server-Sent Events (SSE) with JSON payloads containing:

Authentication

All API requests require authentication using your tenant-specific API key. Include the key in the X-API-Key header for all requests.

X-API-Key: YOUR_API_KEY

Multi-Tenancy

Sparx provides complete data isolation between tenants. Each provisioned instance creates a separate tenant with:

Your data is never shared with other tenants and queries only access your own documents.

Supported Documents

Sparx works with PDF documents containing text content.

Service Limits