Skip to main content
The SDK is generated automatically from the LineBundle OpenAPI spec on every release, so types and methods are always in sync with the latest API.

Requirements

  • Node.js 18+ (or any runtime with the native fetch API)
  • ESM project — the package is "type": "module". CommonJS projects can load it with a dynamic await import('@linebundle-sdk/ts').

Installation


Authentication

The SDK authenticates using an API credential you generate directly inside the LineBundle Studio. No OAuth flows, no client secrets — just a token tied to your organization.

Get your API credential

  1. Log in to LineBundle Studio
  2. Open your organization → Settings → API Credentials
  3. Click New Credential, give it a name, and copy the token (sk_lb_...)
  4. Copy your Organization ID from the same settings page
The token is shown only once. Store it in your secrets manager or environment variables immediately.

Set environment variables

Initialize the SDK

That’s it. The base URL defaults to https://api.linebundle.com — nothing else to configure.
Create lb once at module level and reuse it across your application. Each call to createLinebundle creates an isolated client instance scoped to those credentials.

Credential permissions

The credential inherits the permissions of the user who created it, scoped to the organization. If a request returns 403, check that the credential’s associated user has the appropriate role for the operation.

Environments

Staging and production credentials are separate — generate a credential in each environment’s Studio. To target staging, pass baseUrl:

Quick Start


Response Pattern

Every SDK method returns { data, error, response }. HTTP errors never throw — they are captured in error. Always check error before reading data.
Network-level failures (DNS, timeout, connection refused) still throw a regular Error. Wrap calls in try/catch if you need to handle both HTTP errors and network failures.

Error Handling

Use response.status to branch on specific HTTP status codes:

Parameters

Parameters are structured by their location in the HTTP request: All parameter names are snake_case, matching the API exactly. Pagination uses page (1-based) and size. Sorting uses sort_by and sort_dir ('asc' / 'desc').

TypeScript Types

All request and response types are generated from the API schema and exported from the package:

Common Patterns

Paginate through all events

Get spaces linked to an event

Scoped client for server functions

When running server-side (e.g. TanStack Start, Next.js Server Actions), create a new lb instance per request so concurrent calls don’t share state:

Browse the SDK Reference

The full method reference is auto-generated and available in the sidebar, grouped by resource:

Events

List, create, update, publish, archive, and version events

Spaces

Manage spaces, members, roles, and documents

Users & Orgs

Users, organizations, roles, and permissions

AI Agent

AI assistant sessions and cost tracking

Automation

Automation rules, triggers, cron jobs, and metadata

Messaging

Chat rooms, messages, and real-time channels

Analytics

Usage analytics and audit logs

Bookings

Event attendance, bookings, and waitlists

Contacts

Contact management within spaces

Integrations

Third-party integration connections
Last modified on May 14, 2026