Skip to main content
import Airstore from '@airstore/sdk'

const airstore = new Airstore()

const workspace = await airstore.workspaces.create({ name: 'my-workspace' })
console.log(workspace.external_id) // "ws_abc123..."
The Airstore TypeScript SDK gives you programmatic control over workspaces, integrations, source views, and the virtual filesystem. Use it to provision Airstore from your backend, automate setup for new users, or build custom workflows on top of the filesystem.

Install

npm install @airstore/sdk

Authentication

The SDK reads your API key from the AIRSTORE_API_KEY environment variable automatically. You can also pass it directly:
const airstore = new Airstore({ apiKey: 'org_...' })
You’ll find your API key in the Airstore dashboard under Settings > API Keys.
Organization tokens (org_...) can manage multiple workspaces. Workspace tokens (tok_...) are scoped to a single workspace. For backend provisioning, use an organization token.

Quick example

Here’s a typical provisioning flow — create a workspace, connect Gmail, set up a source view, and generate a mount token:
import Airstore from '@airstore/sdk'

const airstore = new Airstore()

// Create a workspace
const ws = await airstore.workspaces.create({ name: 'acme-eng' })

// Connect Gmail via OAuth
const session = await airstore.oauth.createSession({
  integrationType: 'gmail',
  workspaceId: ws.external_id,
})
console.log(`Authorize here: ${session.authorize_url}`)

// Wait for the user to complete OAuth
const completed = await airstore.oauth.poll(session.session_id)

// Create a source view (smart mode — LLM-inferred)
await airstore.views.create(ws.external_id, {
  integration: 'gmail',
  name: 'Unread Emails',
  guidance: 'unread emails from the inbox',
})

// Or use query mode with structured filters
await airstore.views.create(ws.external_id, {
  integration: 'gmail',
  name: 'From Boss',
  filter: { from: 'boss@company.com', is_unread: true },
})

// Generate a token for CLI mounting
const { token } = await airstore.tokens.create(ws.external_id, {
  name: 'vm-mount',
})
// Use it: airstore mount ~/airstore --token <token>

Configuration

OptionEnv variableDefaultDescription
apiKeyAIRSTORE_API_KEYYour API key (required)
baseURLAIRSTORE_BASE_URLhttps://api.airstore.ai/api/v1API base URL
timeout60000Request timeout in ms
maxRetries2Retries for 429/5xx errors

What’s next

Create and manage workspaces

Provision workspaces for your users.

Connect integrations

Wire up Gmail, GitHub, and more via OAuth.

Create source views

Define source views with natural language or structured filters.

Read files

Browse and read from the virtual filesystem.

Tokens and mounting

Generate tokens for headless CLI mounting.

API Reference

Full method-by-method reference.