Skip to main content
LinearService is a container-managed wrapper around the official @linear/sdk client. It exposes a typed, promise-based API for reading and writing Linear issues, teams, projects, labels, workflow states, priorities, and comments, and it normalizes Linear’s GraphQL objects into plain Talos types (Issue, LinearLabelType, LinearStateType, and friends) so call sites never touch the SDK directly. Configuration comes from either the constructor or AppEnv, and every failure is surfaced as a LinearException with a machine-readable key.

Installation

LinearService ships as its own package and depends on the Linear SDK.

Configuration

The service needs a Linear API key. Provide it through the constructor config or expose it through AppEnv as LINEAR_API_KEY. An optional default team id can be set the same way, so team-scoped calls don’t need a teamId argument.
The API key is validated in the constructor, so a missing key fails fast at startup with API_KEY_REQUIRED. Generate a personal API key from your Linear settings under Security & access → Personal API keys.

Environment variables

Config passed to the constructor takes precedence over the environment: config.apiKey || env.LINEAR_API_KEY and config.teamId || env.LINEAR_TEAM_ID.

Usage

Resolve the service from the container and call its methods. Reads return normalized types; writes return the updated entity.
Inject it into a service to drive Linear as part of your domain logic:

API

Issues

When teamId is omitted from getIssues, the default team id from config or LINEAR_TEAM_ID is used.

Teams, projects, and the viewer

Labels

Workflow states

Priorities

Linear priorities are a fixed scale. The service exposes them synchronously and validates any value you set against the scale.

Comments

Use in the app

In an @talosjs/app application, Linear isn’t a dedicated App config slot. LinearService is @injectable(), so it registers with the container as soon as the class is imported, and you resolve or inject it wherever you talk to Linear.
Set LINEAR_API_KEY (and optionally LINEAR_TEAM_ID) in your .env.yml (or environment) so the client can initialize, then inject the service into a controller or service:
The CLI can save your Linear API key for you — see credentials:create, which stores it under the Talos user config:

Exceptions

Every method throws LinearException on failure, carrying a machine-readable key and a data payload with the relevant ids and the original cause. All exceptions map to an InternalServerError status.

Types

The package exports Issue, LinearService, LinearException, the ILinearService interface, LinearConfigType, and the supporting payload types (LinearTeamType, LinearProjectType, LinearUserType, LinearLabelType, LinearStateType, LinearPriorityType, LinearCommentType) from @talosjs/linear.