Installation
- TypeScript / Node.js
- Python
Client Setup
- TypeScript
- Python
Python developers: We provide both synchronous and asynchronous clients. Use
AsyncCortexAI for async/await patterns and CortexAI for traditional synchronous operations.SDK Method Structure & Type Safety
Our SDKs follow a predictable pattern that mirrors the API structure while providing full type safety:Method Mapping:
client.<group>.<function_name> mirrors api.usecortex.ai/<group>/<function_name>For example: client.upload.uploadText() corresponds to POST /upload/upload_textInput and Output Type Matching
The SDKs provide exact type parity with the API specification:- Request Parameters: Every field documented in the API reference (required, optional, types, validation rules) is reflected in the SDK method signatures
- Response Objects: Return types match the exact JSON schema documented for each endpoint
- Error Types: Exception structures mirror the error response formats from the API
- Nested Objects: Complex nested parameters and responses maintain their full structure and typing
- TypeScript: camelCase method names (
uploadText,getAll) with full TypeScript interfaces - Python: snake_case method names (
upload_text,get_all) with type hints and dataclasses
This means you can rely on your IDE’s autocomplete and type checking. If a parameter is optional in the API docs, it’s optional in the SDK. If a response contains a specific field, your IDE will know about it.
Getting Started: Complete Workflow
Let’s walk through a complete example from creating a tenant to searching your data.Step 1: Create a Tenant
- TypeScript
- Python (Sync)
- Python (Async)
For a more detailed explanation of tenant creation, including metadata schemas, sub-tenant management, and advanced configuration options, refer to the Create Tenant endpoint documentation.
Step 2: Index Your Data
Now let’s upload some content to make it searchable:- TypeScript
- Python (Sync)
- Python (Async)
For a more detailed explanation of document upload, including supported file formats, processing pipeline, metadata handling, and advanced configuration options, refer to the Upload Document endpoint documentation.
Step 3: Search and Retrieve
- TypeScript
- Python (Sync)
- Python (Async)
For a more detailed explanation of search and retrieval, including query parameters, scoring mechanisms, result structure, and advanced search features, refer to the Search endpoint documentation.
Special Endpoints
List Sources
The
/list endpoints use special naming in the SDKs for better developer experience:/list/sources→sources.getAll()/sources.get_all()/list/sources_by_id→sources.getByIds()/sources.get_by_ids()
Type Safety
All SDKs are fully typed with TypeScript definitions and Python type hints. Your IDE will provide:
- Autocomplete for all method names and parameters
- Type checking for request and response objects
- Inline documentation for each parameter
- Error prevention through compile-time validation
Error Handling
Both SDKs throw exceptions for API errors. The error objects contain the same structure as documented in our Error Responses section.The Complete Guide: Your IDE Knows Everything
Everything you need is at your fingertips: The examples and patterns shown above are sufficient for understanding our SDK. Your IDE’s autocomplete is your most powerful tool.
The Universal CMD+Space Approach
Whether you’re using TypeScript, Python, VS Code, PyCharm, or any modern IDE, the approach is identical:- Type the method name → See all available methods
- Open the parentheses → See all required and optional parameters
- Press Cmd+Space (Mac) or Ctrl+Space (Windows/Linux) → Get instant documentation
- TypeScript
- Python
Why This Approach is Complete
Our SDKs are auto-generated from the same API specification that powers this documentation, ensuring:- 100% Parameter Coverage: Every field in the API docs appears in your IDE
- Accurate Type Information: Required vs optional, data types, validation rules
- Inline Documentation: Parameter descriptions appear as you type
- Live Examples: The @example annotations in our type definitions show real usage
The examples you’ve seen above demonstrate every pattern you’ll encounter. Once you understand the tenant/sub-tenant concept and the resource organization (
client.upload.uploadText, client.search.retrieve, etc.), your IDE will handle the rest.