TypeScript SDK
@linea/sdk — trigger workflows, poll executions, and stream SSE events.
TypeScript SDK
@linea/sdk is a zero-dependency TypeScript client for Linea. It handles authentication, execution triggering, result polling, and real-time SSE streaming.
Installation
The SDK uses the built-in fetch API (Node.js 18+ / all modern browsers). No additional dependencies are required.
Quick Start
Authentication
All requests use the x-api-key header. Generate a Linea API key (lnk_…) from the workspace settings page.
API Reference
client.trigger(options)
Starts a workflow execution and returns immediately.
client.getExecution(workspaceId, podId, executionId)
Fetches the current state of an execution.
client.waitForCompletion(workspaceId, podId, executionId, options?)
Polls until the execution reaches a terminal status.
Throws LineaExecutionError if the execution fails, or LineaTimeoutError if the budget is exceeded.
client.run(options, waitOptions?)
Convenience wrapper — trigger + waitForCompletion in one call.
client.streamEvents(workspaceId, podId, executionId, onEvent, onError?)
Opens an SSE stream for a running execution. Returns a cleanup function.
Error Classes
| Class | When thrown |
|---|---|
LineaApiError | HTTP error from the API (statusCode property) |
LineaExecutionError | Execution reached failed status (execution property) |
LineaTimeoutError | waitForCompletion exceeded its budget |
Types
Package Location
The SDK lives at packages/sdk/ in the monorepo and is published as @linea/sdk. It has no runtime dependencies and targets ES2020 / Node 18+.