SDKs
Official TypeScript/JavaScript client for expand.ai
The TypeScript SDK provides a type-safe interface for interacting with expand.ai's API.
npm install expandaipnpm add expandaibun add expandai
import Expand from 'expandai'
const client = new Expand({
// Your API key (required, or set EXPAND_API_KEY env var)
apiKey: '{{API_KEY}}',
// Custom base URL (optional)
baseUrl: 'https://api.expand.ai/v1',
// Additional headers (optional)
headers: {
'Custom-Header': 'value'
}
})Instead of passing the API key directly, you can set the EXPAND_API_KEY environment variable:
export EXPAND_API_KEY={{API_KEY}}// API key will be read from EXPAND_API_KEY
const client = new Expand()import Expand, { ExpandError, APIError, RateLimitError } from 'expandai'
const client = new Expand({ apiKey: '{{API_KEY}}' })
try {
const result = await client.fetch({
url: 'https://example.com',
select: { markdown: true }
})
console.log(result.data.markdown)
} catch (error) {