@respira/sdk
The TypeScript SDK powering Respira CLI. Typed read and write operations for Elementor, Divi, Bricks, WooCommerce, and more. Zod-validated, dual ESM/CJS output.
@respira/sdk is the typed TypeScript client that powers Respira CLI. Use it directly in scripts, CI jobs, or agent frameworks.
Install
npm install @respira/sdk
Usage
import { respira } from '@respira/sdk';
const sites = await respira.sites.list();
const page = await respira.read.page('mysite.com', 'about');
await respira.write.editElement('mysite.com', 'about', 'heading-123', {
title: 'welcome',
});
Custom configuration
import { createRespiraClient } from '@respira/sdk';
const client = createRespiraClient({
apiKey: process.env.RESPIRA_API_KEY,
baseUrl: 'https://respira.press/api/v1',
timeoutMs: 30000,
});
Anonymous mode
Skip the keychain lookup for public-only operations:
const client = createRespiraClient({ anonymous: true });
const ds = await client.read.designSystem('anywordpress.com');
Types and validation
Every method has full TypeScript types. Runtime inputs and outputs are validated with zod so bad responses surface as typed errors, not silent data corruption.
The full type surface is:
auth:whoami,statussites:list,info,healthread:page,pages,post,posts,media,taxonomy,structure,designSystem,elementorFooter,diviModule,findElementwrite:createPage,editPage,editElement,createPost,updateDesignSystem,uploadMedia,deletePagetools:list,describe,searchdocs:get,searchsnapshots:list,restore,show
Error handling
The SDK throws typed RespiraError instances with a stable code field:
import { isRespiraError } from '@respira/cli-core';
try {
await respira.auth.whoami();
} catch (err) {
if (isRespiraError(err) && err.code === 'AUTH_REQUIRED') {
console.error('run: respira auth login');
}
}
Was this page helpful?
Last updated today
Built with Documentation.AI