Official SDKs
Use official SDKs for type-safe, production-ready integrations with Solatis API.
Available SDKs
| Language | Package | Repository | Supported Versions |
|---|---|---|---|
| JavaScript | @solatis/sdk | GitHub | 18.0+ |
| Python | solatis | GitHub | 3.8+ |
| Go | github.com/solatis/solatis-go | GitHub | 1.18+ |
| Ruby | solatis | GitHub | 2.7+ |
JavaScript SDK
Installation
bash
npm install @solatis/sdk
# or
yarn add @solatis/sdk
# or
pnpm add @solatis/sdkQuick Start
javascript
import { Solatis } from '@solatis/sdk';
const client = new Solatis({
apiKey: process.env.SOLATIS_API_KEY
});
// Analyze document
const analysis = await client.documents.analyze({
documentUrl: 'https://example.com/contract.pdf',
analysisType: 'contract_review'
});
console.log('Analysis ID:', analysis.id);Analyze Documents
typescript
// Single document
const analysis = await client.documents.analyze({
documentUrl: 'https://example.com/contract.pdf',
analysisType: 'contract_review',
extractFields: ['parties', 'dates', 'obligations']
});
// Multiple documents
const results = await client.documents.analyzeBatch([
'https://example.com/contract1.pdf',
'https://example.com/contract2.pdf'
]);
// Get document
const doc = await client.documents.get(analysisId);
// List documents
const documents = await client.documents.list({
workspaceId: 'workspace_123',
limit: 20
});Chat with Documents
typescript
const response = await client.documents.chat({
documentId: 'doc_abc123',
question: 'What are the termination clauses?'
});
console.log('Answer:', response.answer);
console.log('Confidence:', response.confidence);Transcribe Meetings
typescript
// Transcribe audio
const transcription = await client.transcribe({
audioUrl: 'https://example.com/meeting.mp3',
language: 'en',
speakerLabels: true
});
// Get transcript
const transcript = await client.transcribe.get(transcription.id);
// Extract action items
const actionItems = await client.meetings.actionItems({
transcriptId: transcription.id,
assignToSpeakers: true
});
// Generate summary
const summary = await client.meetings.summary({
transcriptId: transcription.id,
length: 'medium'
});Webhooks
typescript
// Create webhook
const webhook = await client.webhooks.create({
url: 'https://yourapp.com/webhooks',
events: ['document.analyzed', 'transcription.completed'],
secret: 'your-secret'
});
// List webhooks
const webhooks = await client.webhooks.list();
// Delete webhook
await client.webhooks.delete(webhook.id);Error Handling
typescript
try {
const result = await client.documents.analyze({
documentUrl: 'https://example.com/contract.pdf'
});
} catch (error) {
if (error instanceof Solatis.AuthenticationError) {
console.error('Authentication failed:', error.message);
} else if (error instanceof Solatis.RateLimitError) {
console.error('Rate limited. Retry after:', error.retryAfter);
} else if (error instanceof Solatis.ValidationError) {
console.error('Validation error:', error.details);
} else {
console.error('API error:', error.message);
}
}Python SDK
Installation
bash
pip install solatisQuick Start
python
from solatis import Solatis
client = Solatis(api_key='YOUR_API_KEY')
# Analyze document
analysis = client.documents.analyze(
document_url='https://example.com/contract.pdf',
analysis_type='contract_review'
)
print('Analysis ID:', analysis.id)Analyze Documents
python
# Single document
analysis = client.documents.analyze(
document_url='https://example.com/contract.pdf',
analysis_type='contract_review',
extract_fields=['parties', 'dates', 'obligations']
)
# Multiple documents (batch)
results = client.documents.analyze_batch([
'https://example.com/contract1.pdf',
'https://example.com/contract2.pdf'
])
# Get document
doc = client.documents.get(analysis.id)
# List documents
documents = client.documents.list(
workspace_id='workspace_123',
limit=20
)Chat with Documents
python
response = client.documents.chat(
document_id='doc_abc123',
question='What are the termination clauses?'
)
print('Answer:', response.answer)
print('Confidence:', response.confidence)Transcribe Meetings
python
# Transcribe audio
transcription = client.transcribe(
audio_url='https://example.com/meeting.mp3',
language='en',
speaker_labels=True
)
# Get transcript
transcript = client.transcribe.get(transcription.id)
# Extract action items
action_items = client.meetings.action_items(
transcript_id=transcription.id,
assign_to_speakers=True
)
# Generate summary
summary = client.meetings.summary(
transcript_id=transcription.id,
length='medium'
)Webhooks
python
# Create webhook
webhook = client.webhooks.create(
url='https://yourapp.com/webhooks',
events=['document.analyzed', 'transcription.completed'],
secret='your-secret'
)
# List webhooks
webhooks = client.webhooks.list()
# Delete webhook
client.webhooks.delete(webhook.id)Error Handling
python
from solatis import Solatis
from solatis.exceptions import (
AuthenticationError,
RateLimitError,
ValidationError,
SolatisError
)
try:
result = client.documents.analyze(
document_url='https://example.com/contract.pdf'
)
except AuthenticationError as e:
print('Authentication failed:', e)
except RateLimitError as e:
print('Rate limited. Retry after:', e.retry_after)
except ValidationError as e:
print('Validation error:', e.details)
except SolatisError as e:
print('API error:', e)Go SDK
Installation
bash
go get github.com/solatis/solatis-goQuick Start
go
package main
import (
"fmt"
"github.com/solatis/solatis-go"
)
func main() {
client := solatis.NewClient("YOUR_API_KEY")
// Analyze document
result, err := client.Documents.Analyze(&solatis.AnalyzeRequest{
DocumentURL: "https://example.com/contract.pdf",
AnalysisType: "contract_review",
})
if err != nil {
panic(err)
}
fmt.Println("Analysis ID:", result.ID)
}Analyze Documents
go
// Single document
analysis, err := client.Documents.Analyze(&solatis.AnalyzeRequest{
DocumentURL: "https://example.com/contract.pdf",
AnalysisType: "contract_review",
ExtractFields: []string{"parties", "dates", "obligations"},
})
// Get document
doc, err := client.Documents.Get(analysisID)
// List documents
documents, err := client.Documents.List(&solatis.ListOptions{
WorkspaceID: "workspace_123",
Limit: 20,
})Transcribe Meetings
go
// Transcribe audio
transcription, err := client.Transcribe(&solatis.TranscribeRequest{
AudioURL: "https://example.com/meeting.mp3",
Language: "en",
SpeakerLabels: true,
})
// Get transcript
transcript, err := client.Transcribe.Get(transcription.ID)
// Extract action items
actions, err := client.Meetings.ActionItems(&solatis.ActionItemsRequest{
TranscriptID: transcription.ID,
AssignToSpeakers: true,
})Ruby SDK
Installation
Add to Gemfile:
ruby
gem 'solatis'Then run:
bash
bundle installQuick Start
ruby
require 'solatis'
client = Solatis::Client.new(api_key: ENV['SOLATIS_API_KEY'])
# Analyze document
analysis = client.documents.analyze(
document_url: 'https://example.com/contract.pdf',
analysis_type: 'contract_review'
)
puts "Analysis ID: #{analysis.id}"Analyze Documents
ruby
# Single document
analysis = client.documents.analyze(
document_url: 'https://example.com/contract.pdf',
analysis_type: 'contract_review',
extract_fields: %w[parties dates obligations]
)
# Get document
doc = client.documents.get(analysis.id)
# List documents
documents = client.documents.list(
workspace_id: 'workspace_123',
limit: 20
)Transcribe Meetings
ruby
# Transcribe audio
transcription = client.transcribe(
audio_url: 'https://example.com/meeting.mp3',
language: 'en',
speaker_labels: true
)
# Get transcript
transcript = client.transcribe.get(transcription.id)
# Extract action items
action_items = client.meetings.action_items(
transcript_id: transcription.id,
assign_to_speakers: true
)SDK Comparison
| Feature | JS | Python | Go | Ruby |
|---|---|---|---|---|
| Async/Await | ✅ | ✅ | ✅ | ⚠️ |
| Type Safety | ✅ | ⚠️ | ✅ | ⚠️ |
| Webhook Helpers | ✅ | ✅ | ✅ | ✅ |
| Streaming | ✅ | ✅ | ✅ | ⚠️ |
| Rate Limit Handling | ✅ | ✅ | ✅ | ✅ |
| Retry Logic | ✅ | ✅ | ✅ | ✅ |
Common Patterns
Retry with Exponential Backoff
All SDKs automatically retry with exponential backoff on rate limiting and server errors.
Configuration (JavaScript):
typescript
const client = new Solatis({
apiKey: process.env.SOLATIS_API_KEY,
maxRetries: 3,
retryDelay: 1000 // Initial delay in ms
});Timeouts
Set request timeouts to prevent hanging requests:
JavaScript:
typescript
const client = new Solatis({
apiKey: process.env.SOLATIS_API_KEY,
timeout: 30000 // 30 seconds
});Python:
python
client = Solatis(
api_key='YOUR_API_KEY',
timeout=30
)Custom Headers
Add custom headers for tracking or debugging:
JavaScript:
typescript
const client = new Solatis({
apiKey: process.env.SOLATIS_API_KEY,
headers: {
'X-Custom-Header': 'value',
'X-Request-ID': uuid()
}
});Environment Variables
Store API keys in environment variables:
bash
# .env
SOLATIS_API_KEY=sol_live_abc123...Then load in your code:
JavaScript:
typescript
const client = new Solatis({
apiKey: process.env.SOLATIS_API_KEY
});Python:
python
import os
client = Solatis(api_key=os.getenv('SOLATIS_API_KEY'))Debugging
Enable Debug Logging
JavaScript:
typescript
const client = new Solatis({
apiKey: process.env.SOLATIS_API_KEY,
debug: true // Log all requests/responses
});Python:
python
import logging
logging.basicConfig(level=logging.DEBUG)
client = Solatis(api_key=os.getenv('SOLATIS_API_KEY'))Log Requests
JavaScript:
typescript
client.on('request', (request) => {
console.log('Request:', request.method, request.url);
});
client.on('response', (response) => {
console.log('Response:', response.status);
});TypeScript Types
All SDKs include TypeScript type definitions.
JavaScript SDK Types:
typescript
import { Solatis } from '@solatis/sdk';
import type {
AnalyzeRequest,
AnalyzeResponse,
TranscribeRequest,
TranscribeResponse
} from '@solatis/sdk';
const client: Solatis = new Solatis({
apiKey: process.env.SOLATIS_API_KEY
});
const request: AnalyzeRequest = {
documentUrl: 'https://example.com/contract.pdf',
analysisType: 'contract_review'
};
const response: AnalyzeResponse = await client.documents.analyze(request);Migration Guide
From REST API to SDK
Before (REST API):
javascript
const response = await fetch(
'https://api.solatis.team/v2/documents/analyze',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
document_url: 'https://example.com/contract.pdf',
analysis_type: 'contract_review'
})
}
);
const data = await response.json();After (SDK):
javascript
import { Solatis } from '@solatis/sdk';
const client = new Solatis({
apiKey: process.env.SOLATIS_API_KEY
});
const data = await client.documents.analyze({
documentUrl: 'https://example.com/contract.pdf',
analysisType: 'contract_review'
});Support
- GitHub Issues: Report bugs and request features
- Discussions: Ask questions and share ideas
- Email: developers@solatis.team
- Discord: Join Community
Next Steps
- Getting Started - First request tutorial
- Code Examples - Real-world examples
- Error Handling - Handle errors
- Webhooks - Real-time notifications