api · guide
Make your first API call
How to create an API key and call the Vendu REST API from curl, JavaScript, Python or Go.
The Vendu API has official client libraries in TypeScript, Python (planned), and Go (planned). All SDKs are generated from the single source of truth: the OpenAPI specification.
TypeScript (working)
Install
Publishing to npm is pending. Until then, install from source.
npm install @vendu/sdk # once published
# OR from monorepo source:
npm install ./sdks/ts
Auth
Every request is authenticated with an API key from Settings → Developers → API Keys.
Keys start with vk_live_ in production.
These are not the same keys the MCP server uses. Vendu has two key types, for two different surfaces: a REST API key (
vk_live_…, Settings → Developers) authenticates/api/v1/*, and an MCP key (vndu_…, Settings → Integrations) authenticates an AI assistant connecting to your workspace. One will not work in place of the other, and a401when they are swapped is the most common first mistake.
First call
import { VenduClient, VenduApiError } from '@vendu/sdk'
const client = new VenduClient({ apiKey: 'vk_live_...' })
// List orders (page 1)
const page = await client.orders.list({ limit: 20 })
console.log(page.data) // Order[]
console.log(page.next_cursor) // string | null
// Fetch next page
if (page.has_more) {
const page2 = await client.orders.list({ cursor: page.next_cursor! })
}
// Single order
const order = await client.orders.get('uuid')
// Products
const products = await client.products.list()
const newProduct = await client.products.create({ name: 'Dress', price: 499 })
// Conversations
const conversations = await client.conversations.list()
Error handling
try {
await client.orders.list()
} catch (err) {
if (err instanceof VenduApiError) {
// HTTP 4xx / 5xx
console.error(err.status) // e.g. 429
console.error(err.problem.title) // "Rate limit exceeded"
console.error(err.problem.retry_after_sec) // 30
} else {
throw err // network / TLS error
}
}
Regenerating types
Types in sdks/ts/src/types.ts are derived from openapi.yaml.
npm run sdk:generate # regenerate
npm run sdk:check # CI check: fail if stale
Python (skeleton)
pip install vendu-sdk # once published — see docs/BLOCKERS.md
from vendu import VenduClient, VenduApiError
client = VenduClient(api_key="vk_live_...")
orders = client.orders.list(limit=20)
Status: skeleton — methods raise
NotImplementedError. Full transport pending publish blocker indocs/BLOCKERS.md.
Go (skeleton)
go get github.com/vendu/sdk-go # once published — see docs/BLOCKERS.md
client := vendu.NewClient("vk_live_...")
orders, err := client.Orders.List(ctx, vendu.ListParams{Limit: 20})
Status: skeleton — methods return
ErrNotImplemented. Full transport pending publish blocker indocs/BLOCKERS.md.
Generate script reference
| Script | Command | Description |
|---|---|---|
sdk:generate | npm run sdk:generate | Regenerate sdks/ts/src/types.ts from openapi.yaml |
sdk:check | npm run sdk:check | CI check — exits 1 if types are stale |
See sdks/README.md for the full directory structure.
CLI (npx vendu)
The vendu CLI (in cli/) is the fastest way to make a first
API call from the terminal — it reuses @vendu/sdk.
# Authenticate (paste a key or set VENDU_API_KEY), then make a call
npx vendu auth
npx vendu list-orders --limit 5 --json
| Command | Description |
|---|---|
vendu init | Interactive setup → writes .vendu config |
vendu auth | Validate + persist an API key (paste/env, not device-flow yet) |
vendu list-orders / list-conversations | Read resources (--json for scripting) |
vendu test-webhook <url> | POST a sample event to your webhook URL |
vendu docs | Open the developer portal |
Auth is key-based today; the full browser device-flow and npm publish of the
vendupackage are tracked indocs/BLOCKERS.md(T-6).