Configuration
All SDK configuration options for TypeScript, Python, and Go.
Each SDK accepts the same core configuration options with language-appropriate naming.
TypeScript
import { PlatformXeClient } from '@caldera/platformxe-sdk';
const px = new PlatformXeClient({
apiKey: 'pxk_live_your_api_key_here',
baseUrl: 'https://api.platformxe.com',
retries: 3,
timeoutMs: 10000,
failOpen: false,
});
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | -- | Required. Your PlatformXe API key |
baseUrl | string | https://api.platformxe.com | API base URL |
retries | number | 3 | Max retry attempts on transient failures |
timeoutMs | number | 10000 | Request timeout in milliseconds |
failOpen | boolean | false | Return error envelope instead of throwing on failure |
Python
from platformxe import PlatformXeClient
client = PlatformXeClient(
api_key="pxk_live_your_api_key_here",
base_url="https://api.platformxe.com",
retries=3,
timeout=10.0,
fail_open=False,
)
| Option | Type | Default | Description |
|---|---|---|---|
api_key | str | -- | Required. Your PlatformXe API key |
base_url | str | https://api.platformxe.com | API base URL |
retries | int | 3 | Max retry attempts on transient failures |
timeout | float | 10.0 | Request timeout in seconds |
fail_open | bool | False | Return error dict instead of raising on failure |
Go
client := px.NewClient(px.ClientConfig{
APIKey: "pxk_live_your_api_key_here",
BaseURL: "https://api.platformxe.com",
Retries: 3,
Timeout: 10,
FailOpen: false,
})
| Option | Type | Default | Description |
|---|---|---|---|
APIKey | string | -- | Required. Your PlatformXe API key |
BaseURL | string | https://api.platformxe.com | API base URL |
Retries | int | 3 | Max retry attempts on transient failures |
Timeout | int | 10 | Request timeout in seconds |
FailOpen | bool | false | Return error value instead of panicking on failure |
Common options
apiKey
Your API key, starting with pxk_live_ (production) or pxk_test_ (test). The key is sent as the x-api-key header on every request.
All SDKs also read the PLATFORMXE_API_KEY environment variable as a fallback.
baseUrl
Override the API endpoint. Useful for local development or testing against a staging environment.
// TypeScript
const px = new PlatformXeClient({ apiKey: '...', baseUrl: 'http://localhost:3000' });
# Python
client = PlatformXeClient(api_key="...", base_url="http://localhost:3000")
// Go
client := px.NewClient(px.ClientConfig{APIKey: "...", BaseURL: "http://localhost:3000"})
retries
Number of retry attempts for transient failures (5xx errors, network timeouts). Retries use exponential backoff with jitter.
timeout
Request timeout. If a request takes longer than this, it is aborted and retried (if retries remain).
- TypeScript: milliseconds (
timeoutMs: 5000for 5 seconds) - Python: seconds (
timeout=5.0for 5 seconds) - Go: seconds (
Timeout: 5for 5 seconds)
failOpen
When enabled, the SDK returns an error envelope instead of throwing/raising exceptions. This is useful for permission checks where you want to handle failures gracefully.
// TypeScript
const result = await px.permissions.check({ adminId: 'user_xyz', path: 'articles', action: 'read' });
if (!result.success) {
console.error(result.error.code, result.error.message);
}
# Python
result = client.permissions.check(admin_id="user_xyz", path="articles", action="read")
if not result["success"]:
print(result["error"]["code"], result["error"]["message"])
// Go
result, err := client.Permissions.Check("user_xyz", "articles", "read")
if err != nil {
fmt.Println(err)
}
Enable failOpen in production for permission checks. If PlatformXe is unreachable, your application can fall back to a default policy instead of crashing.