packages/sdk-ts.1234import { Orsel, ApprovalRequiredError } from 'orsel'; const orsel = new Orsel({ apiKey, baseUrl, project }); const run = await orsel.act({ domain, actionId, input }, { wait: true });
apiKey (env ORSEL_KEY), baseUrl (env ORSEL_URL, required), project (env ORSEL_PROJECT, sent as X-Project-Id), fetch, retries (2), timeoutMs (30000).123const blog = await orsel.site('egeuysal.com', { explore: true }); const { slugs } = await blog.list_blog(); const post = await blog.read_blog_page({ slug: slugs[0] });
site(domain) loads the site's actions and gives one method per action: input in, typed output out, run waited for. A run that does not succeed throws ActionError (.run, .code, and a message that says what failed and how to look closer). A missing input is named before anything is sent. explore: true makes read actions from the site's public pages first if it has none. site.run(id, input) returns the whole run without throwing. For typed inputs and outputs, generate the types with orsel typegen <domain> and pass them: orsel.site<EgeuysalComActions>(domain). See use a website as an API.act({ wait: true }) no longer makes a second request when the answer to the act already says the run finished.act carries an idempotency key (sdk-<uuid> unless you pass one), so you can retry yourself safely with the same key.Retry-After.OrselError, ApiError (code, status, requestId, hint), RateLimitError, NetworkError, TimeoutError, ApprovalRequiredError, PaymentRequiredError, WebhookSignatureError.act.stream() yields step, approval and result events.orsel/verify verifies a ledger and a recipe without trusting the server. orsel/webhooks verifies webhook signatures.