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, smart folders, 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 smart folder, 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 smart folder
await airstore.smartFolders.create(ws.external_id, {
  integration: 'gmail',
  name: 'Unread Emails',
  guidance: 'unread emails from the inbox',
})

// 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