API Integration
The Connect page in Hindsight Cloud provides everything you need to integrate the Hindsight API into your applications.
Accessing the Connect Page
- Log in to Hindsight Cloud
- Click the Connect button in the top navigation bar
API Endpoint
Your API endpoint is displayed at the top of the Connect page. This is the base URL for all API requests:
https://api.hindsight.vectorize.io
Click the Copy button to copy the endpoint to your clipboard.
Managing API Keys
Viewing Your API Key
The Connect page displays your most recent active API key:
- Key Prefix: The first few characters of your key (for identification)
- Status: Active or Revoked
- Created: When the key was created
Creating a New API Key
- Click Create API Key
- Enter a descriptive name (e.g., "Production Server", "Development")
- Choose an expiration period:
- Never - Key doesn't expire
- 30 days
- 90 days
- 1 year
- Custom - Enter a specific number of days
- Click Create
Your API key is only shown once after creation. Copy it immediately and store it securely. If you lose it, you'll need to create a new key.
Managing All API Keys
Click Manage API Keys to access the full API Keys page where you can:
- View all active and revoked keys
- Filter by status
- Revoke keys that are no longer needed
Quick Start Code Examples
The Connect page provides ready-to-use code examples in multiple languages. Each example includes your actual API key (when available) for easy copy-paste.
Installation
- Python
- TypeScript
pip install hindsight-client
npm install @vectorize-io/hindsight-client
Basic Usage
- Python
- TypeScript
- cURL
from hindsight_client import Hindsight
client = Hindsight(
base_url="https://api.hindsight.vectorize.io",
api_key="your-api-key"
)
# Store a memory
client.retain(
bank_id="my-bank",
content="The user prefers dark mode."
)
# Retrieve memories
result = client.recall(
bank_id="my-bank",
query="What are the user's preferences?"
)
for memory in result.results:
print(memory.text)
import { HindsightClient } from '@vectorize-io/hindsight-client';
const client = new HindsightClient({
baseUrl: 'https://api.hindsight.vectorize.io',
apiKey: 'your-api-key'
});
// Store a memory
await client.retain(
'my-bank',
'The user prefers dark mode.'
);
// Retrieve memories
const result = await client.recall(
'my-bank',
"What are the user's preferences?"
);
result.results.forEach(memory => {
console.log(memory.text);
});
# Store a memory
curl -X POST https://api.hindsight.vectorize.io/v1/default/banks/my-bank/memories \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"items": [{"content": "The user prefers dark mode."}]}'
# Retrieve memories
curl -X POST https://api.hindsight.vectorize.io/v1/default/banks/my-bank/memories/recall \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"query": "What are the user'\''s preferences?"}'
Authentication
All API requests require authentication using your API key. Include it in the Authorization header:
Authorization: Bearer your-api-key
Or when using the SDK:
- Python
- TypeScript
client = Hindsight(api_key="your-api-key")
const client = new HindsightClient({ apiKey: 'your-api-key' });
Error Handling
The API returns standard HTTP status codes:
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Check your request parameters |
| 401 | Unauthorized - Invalid or expired API key |
| 402 | Payment Required - Insufficient credits |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource doesn't exist |
| 500 | Server Error - Contact support |
Next Steps
- View detailed API Key Management
- Learn about Memory Operations
- Check out the Python SDK Guide
- Check out the TypeScript SDK Guide