Airstore class is the entry point for all SDK operations. It exposes resource namespaces (workspaces, connections, smartFolders, tokens, members, oauth, fs) that map to the Airstore REST API.
Constructor
AirstoreError if no API key is provided.
ClientOptions
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | process.env.AIRSTORE_API_KEY | API key for authentication. Organization tokens start with org_, workspace tokens with tok_. |
baseURL | string | https://api.airstore.ai/api/v1 | Base URL for the API. Also reads AIRSTORE_BASE_URL env var. |
timeout | number | 60000 | Request timeout in milliseconds. |
maxRetries | number | 2 | Maximum retries for 429 and 5xx errors. Uses exponential backoff with jitter. |
defaultHeaders | Record<string, string> | {} | Extra headers added to every request. |
RequestOptions
Every resource method acceptsRequestOptions as the last argument to override client-level settings for a single call:
| Option | Type | Description |
|---|---|---|
timeout | number | Override the client-level timeout for this request. |
maxRetries | number | Override the client-level retry count. |
signal | AbortSignal | Abort signal for cancellation. |
headers | Record<string, string> | Extra headers merged with client defaults. |
ResponseMeta
Every response object has a non-enumerablelastResponse property with HTTP metadata:
| Field | Type | Description |
|---|---|---|
statusCode | number | HTTP status code. |
headers | Headers | Response headers. |
requestId | string | undefined | Value of the x-request-id header, if present. |
rawRequest()
Escape hatch for endpoints not yet covered by the SDK:| Parameter | Type | Required | Description |
|---|---|---|---|
method | string | Yes | HTTP method (GET, POST, etc.) |
path | string | Yes | API path (appended to baseURL) |
opts.body | unknown | No | Request body (JSON-serialized automatically) |
opts.params | Record<string, string> | No | Query parameters |
opts.timeout | number | No | Request timeout |
opts.signal | AbortSignal | No | Abort signal |
opts.headers | Record<string, string> | No | Extra headers |
Promise<Response> — the raw Fetch API response.
Resource namespaces
| Namespace | Description | Reference |
|---|---|---|
airstore.workspaces | Create and manage workspaces | Workspaces |
airstore.connections | Manage integration connections | Connections |
airstore.smartFolders | Create and manage smart folders | Smart Folders |
airstore.tokens | Manage workspace tokens | Tokens |
airstore.members | Manage workspace members | Members |
airstore.oauth | OAuth session management | OAuth |
airstore.fs | Read from the virtual filesystem | Filesystem |
Retry behavior
The client automatically retries on status codes408, 409, 429, 500, 502, 503, and 504. Retries use exponential backoff starting at 500ms, capped at 8 seconds, with jitter. If the response includes a Retry-After or retry-after-ms header, the client respects that instead.
Set maxRetries: 0 to disable retries entirely.