Docs menu

Platform APIs

Linear API

Every handle of the Linear fake: the linear fixture, the people and objects a test creates on it, and what they read and wait for. How to test a Linear app or agent, step by step, is in the Linear guide.

Each call is shown in every SDK's language, with its required options (the table under it lists them all). Arguments go first; options are TypeScript's trailing object, Python's keyword arguments and Rust's builder setters. The variable names are the ones the calls return elsewhere on these pages, so user is a LinearUser handle.

Besides the errors listed with each method, most methods can fail with action_requires, cross_workspace_credential, fake_actor_in_live_world, internal, invalid_argument, live_misconfigured, live_not_allowlisted, not_found, session_not_found, unauthorized, unsupported_in_live: a bad request, a closed session, or live mode refusing or misconfigured.

LinearFixture#

Returned by Session.linear().

FieldPython / RustType
appappLinearApp
apiUrlapi_urlstring

createUser()#

Create a person in the workspace.

const user = await linear.createUser({ name: "…" });
ParameterPython / RustTypeRequired
namenamestringyesoption
ididstringnooption
displayNamedisplay_namestringnooption
emailemailstringnooption
adminadminbooleannooption
guestguestbooleannooption
tokentokenstringnooption; read from CHANNELSTACK_LINEAR_USER_{name}_TOKEN when left out

Returns LinearUser.

users()#

The people this session created.

const users = await linear.users();

Returns LinearUsers.

createApp()#

Make another OAuth app in the workspace, installed with actor=app: its own app user (mentionable and assignable), access token, client and webhook secret. Or return the one made with this name and settings. Its webhooks go to CHANNELSTACK_LINEAR_APP_<NAME>_WEBHOOK_URL.

const app = await linear.createApp({ name: "…" });
ParameterTypeRequired
namestringyesoption
eventsstring[]nooption

Returns LinearApp.

Live: refused with unsupported_in_live: Live, the Linear workspace has the built-in app only: another app needs a sandbox app of its own.

apps()#

The apps this session used: the built-in one first, then each it got from createApp, in the order it first did. Another session's are not_found here.

const apps = await linear.apps();

Returns LinearApps.

teams()#

The teams this session created.

const teams = await linear.teams();

Returns LinearTeams.

createTeam()#

Create a team: its members, workflow states and labels. Without a key one is made up, so parallel tests never share one.

const team = await linear.createTeam({ key: "…" });
ParameterTypeRequired
keystringnooption
namestringnooption
membersLinearUser[]nooption
statesArray<{ name: string; type: "backlog" | "unstarted" | "started" | "completed" | "canceled" | "triage" }>nooption
labelsstring[]nooption

Returns LinearTeam.

issues()#

The issues in this session's teams, read again from Linear live, oldest first.

const issues = await linear.issues();

Returns LinearIssues.

deliveries()#

Every webhook channelstack sent the agent for this session, with every attempt.

const deliveries = await linear.deliveries({ type: "…" });
ParameterPython / RustTypeRequired
typetype · r#typestringnooption
resourceresourceLinearIssuenooption
appappLinearAppnooption

Returns LinearDeliveries.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

calls()#

The GraphQL operations the agent sent about this session's issues and sessions, by root field (agentActivityCreate).

const apiCalls = await linear.calls({ operation: "…" });
ParameterTypeRequired
operationstringnooption
errortrue | stringnooption

Returns LinearApiCalls.

Live: needs proxy mode: Linear doesn't report the app's calls; proxy mode sees them. Proxy mode doesn't read the app's calls back live yet (#24), so for now the call is refused with action_requires and the test is skipped.

waitForCall()#

Waits for the next API call from the agent after the last one this handle returned: it polls calls() and never sleeps longer than it must.

const apiCall = await linear.waitForCall({ operation: "…" });
ParameterTypeRequired
operationstringnofilter
errortrue | stringnofilter
timeoutDurationnodefault 10s

Returns LinearApiCall. When the time is up, it fails with what it was waiting for.

LinearApp#

Returned by LinearFixture.createApp(), LinearIssue.delegatedTo().

FieldPython / RustType
ididstring
namenamestring
kindkind"app"
botUserIdbot_user_idstring
accessTokenaccess_tokenstring
webhookSecretwebhook_secretstring
clientIdclient_idstring
clientSecretclient_secretstring

comment()#

An app a test made comments on an issue, as its own commentCreate would. Its mention of another app is refused (to confirm, B6).

const comment = await app.comment("…", { issue });
ParameterTypeRequired
bodystringyespositional
issueLinearIssueyesoption

Returns LinearComment.

Live: refused with unsupported_in_live: Live, the Linear workspace has the built-in app only: another app needs a sandbox app of its own.

reply()#

An app a test made replies in a comment's thread, as its own commentCreate with a parentId would.

const result = await app.reply("…", { comment });
ParameterTypeRequired
bodystringyespositional
commentLinearCommentyesoption

Returns LinearComment.

Live: refused with unsupported_in_live: Live, the Linear workspace has the built-in app only: another app needs a sandbox app of its own.

LinearUser#

Returned by LinearFixture.createUser(), LinearIssue.assignee().

FieldPython / RustType
ididstring
namenamestring
kindkind"user"
displayNamedisplay_namestring
emailemailstring | undefined
adminadminboolean
guestguestboolean

createIssue()#

Create an issue. Sends Issue (create); with delegate, it opens an agent session and sends AgentSessionEvent (created).

const result = await user.createIssue(issue, { team });
ParameterTypeRequired
issue{ title: string; description?: string; priority?: number; state?: string; labels?: string[]; assignee?: LinearUser; delegate?: LinearApp; parent?: LinearIssue }yespositional
teamLinearTeamyesoption

Returns LinearIssue.

Errors forbidden.

editIssue()#

Edit an issue's title, description or priority. Sends Issue (update).

const delivery = await user.editIssue(changes, { issue });
ParameterTypeRequired
changes{ title?: string; description?: string; priority?: number }yespositional
issueLinearIssueyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

undelegate()#

Take an issue back from the app. Sends Issue (update).

const delivery = await user.undelegate({ issue });
ParameterTypeRequired
issueLinearIssueyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

assign()#

Assign an issue to a person, or (with no one) unassign it. Sends Issue (update).

const delivery = await user.assign({ issue });
ParameterTypeRequired
assigneeLinearUsernopositional
issueLinearIssueyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

setState()#

Move an issue to a workflow state, by name. Sends Issue (update).

const delivery = await user.setState("…", { issue });
ParameterTypeRequired
statestringyespositional
issueLinearIssueyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

label()#

Put labels on an issue, by name. Sends Issue (update).

const delivery = await user.label(labels, { issue });
ParameterTypeRequired
labelsstring | string[]yespositional
issueLinearIssueyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

delegate()#

Delegate an issue to an app. Opens that app's agent session and sends it AgentSessionEvent (created); an issue delegated to another app moves.

const agentSession = await user.delegate(app, { issue });
ParameterTypeRequired
appLinearAppyespositional
issueLinearIssueyesoption

Returns LinearAgentSession.

Errors forbidden.

comment()#

Comment on an issue. A mention of the app opens an agent session and sends AgentSessionEvent (created).

const comment = await user.comment("…", { issue });
ParameterTypeRequired
bodystringyespositional
issueLinearIssueyesoption

Returns LinearComment.

Errors forbidden.

reply()#

Reply in a comment's thread. In an agent session's thread, it prompts the session (AgentSessionEvent prompted).

const result = await user.reply("…", { comment });
ParameterTypeRequired
bodystringyespositional
commentLinearCommentyesoption

Returns LinearComment.

Errors forbidden.

edit()#

Edit a comment. Sends Comment (update).

const delivery = await user.edit("…", { comment });
ParameterTypeRequired
bodystringyespositional
commentLinearCommentyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

delete()#

Delete a comment. Sends Comment (remove).

const delivery = await user.delete({ comment });
ParameterTypeRequired
commentLinearCommentyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

react()#

React to a comment with an emoji. Linear sends no webhook for it.

await user.react("…", { comment });
ParameterTypeRequired
emojistringyespositional
commentLinearCommentyesoption

Returns nothing.

Errors forbidden.

prompt()#

Send a follow-up in an agent session. Sends AgentSessionEvent (prompted).

const delivery = await user.prompt("…", { session });
ParameterTypeRequired
bodystringyespositional
sessionLinearAgentSessionyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

answer()#

Answer a question the agent asked (an elicitation activity). Sends AgentSessionEvent (prompted).

const delivery = await user.answer("…", { elicitation });
ParameterTypeRequired
bodystringyespositional
elicitationLinearAgentActivityyesoption

Returns LinearDelivery | undefined.

Errors forbidden.

stop()#

Press Stop on an agent session. Sends AgentSessionEvent (prompted) with the stop signal.

const delivery = await user.stop({ session });
ParameterTypeRequired
sessionLinearAgentSessionyesoption

Returns LinearDelivery.

Errors forbidden.

Live: needs the browser actor: Linear sends the stop signal only when a person presses Stop, and it can't be published through the API. The browser actor doesn't do this yet (#47), so for now the call is refused with action_requires and the test is skipped.

LinearComment#

Returned by LinearApp.comment(), LinearApp.reply(), LinearUser.comment(), LinearUser.reply().

FieldPython / RustType
ididstring
issueissueLinearIssue
authorauthorLinearUser | LinearApp
bodybodystring
createdAtcreated_atstring
urlurlstring
sessionsessionLinearAgentSession | undefined
deliverydeliveryLinearDelivery | undefined

replies()#

The replies in a comment's thread, once the agent is quiet.

const commentReplies = await comment.replies();

Returns LinearCommentReplies. It reads once the app is quiet.

deliveryFor()#

The Comment (create) delivery this comment caused to this app (decision 0027), or nothing when it wasn't told. The comment's delivery is the built-in app's.

const delivery = await comment.deliveryFor(app);
ParameterTypeRequired
appLinearAppyespositional

Returns LinearDelivery | undefined.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

transcript()#

A comment's thread as a person reads it.

const transcript = await comment.transcript();

Returns LinearTranscript.

LinearIssue#

Returned by LinearUser.createIssue(), LinearIssue.refresh(), LinearTeam.issue().

FieldType
idstring
identifierstring
urlstring
teamLinearTeam
creatorLinearUser | LinearApp

refresh()#

Read the issue again.

const updated = await issue.refresh();

Returns LinearIssue.

title()#

The issue's title as it is now.

const result = await issue.title();

Returns string.

state()#

The issue's workflow state.

const issueState = await issue.state();

Returns LinearIssueState.

assignee()#

Who the issue is assigned to, if anyone.

const user = await issue.assignee();

Returns LinearUser | undefined.

delegatedTo()#

The app the issue is delegated to, if any.

const app = await issue.delegatedTo();

Returns LinearApp | undefined.

labels()#

The names of the labels on the issue.

const items = await issue.labels();

Returns string[].

comments()#

The comments on the issue, oldest first, without the one Linear writes to open a delegated session's thread.

const comments = await issue.comments();

Returns LinearComments.

sessions()#

The agent sessions on the issue, oldest first.

const agentSessions = await issue.sessions();

Returns LinearAgentSessions.

session()#

The issue's latest agent session, waiting for one to be opened.

const agentSession = await issue.session();

Returns LinearAgentSession. While refused with not_found, it tries again until the wait's timeout.

transcript()#

The issue as a person reads it: description, comments and the agent's sessions.

const transcript = await issue.transcript();

Returns LinearTranscript.

waitForComment()#

Waits for the next comment after the last one this handle returned: it polls comments() and never sleeps longer than it must.

const comment = await issue.waitForComment({ from: "my-agent" });
ParameterPython / RustTypeRequired
fromfrom_ · fromLinearUser | LinearApp | stringnoa handle, or a name
bodybodystring | RegExpnocontains, or matches
timeouttimeoutDurationnodefault 10s

Returns LinearComment. When the time is up, it fails with what it was waiting for.

latestComment()#

The latest comment, once the app is quiet. Waits for at least one: it polls comments() and never sleeps longer than it must.

const comment = await issue.latestComment({ from: "my-agent" });
ParameterPython / RustTypeRequired
fromfrom_ · fromLinearUser | LinearApp | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s
quietForquiet_forDurationnodefault 750ms

Returns LinearComment. When the time is up, it fails with what it was waiting for.

LinearTeam#

Returned by LinearFixture.createTeam().

FieldType
idstring
keystring
namestring

issue()#

An issue of this team by its identifier (ENG-12).

const issue = await team.issue("…");
ParameterTypeRequired
identifierstringyespositional

Returns LinearIssue.

LinearAgentSession#

Returned by LinearUser.delegate(), LinearIssue.session().

FieldPython / RustType
ididstring
issueissueLinearIssue
appappLinearApp
startedBystarted_byLinearUser
deliverydeliveryLinearDelivery | undefined

state()#

The session's status.

const result = await agentSession.state();

Returns "pending" | "active" | "stopping" | "awaitingInput" | "complete" | "error" | "stale".

activities()#

The session's activities, oldest first: the agent's, and the prompts of people.

const agentActivities = await agentSession.activities();

Returns LinearAgentActivities.

externalUrls()#

The links the agent attached to the session.

const externalUrls = await agentSession.externalUrls();

Returns LinearExternalUrls.

plan()#

The agent's plan: each step and its status.

const plan = await agentSession.plan();

Returns LinearPlan.

transcript()#

The session as a person reads it.

const transcript = await agentSession.transcript();

Returns LinearTranscript.

waitForState()#

Waits for the agent session to reach that state: it polls state() and never sleeps longer than it must.

const result = await agentSession.waitForState(wanted);
ParameterTypeRequired
wanted"pending" | "active" | "stopping" | "awaitingInput" | "complete" | "error" | "stale" | Array<"pending" | "active" | "stopping" | "awaitingInput" | "complete" | "error" | "stale">yespositional
timeoutDurationnodefault 10s

Returns "pending" | "active" | "stopping" | "awaitingInput" | "complete" | "error" | "stale". When the time is up, it fails with what it was waiting for.

waitForActivity()#

Waits for the next activity after the last one this handle returned: it polls activities() and never sleeps longer than it must.

const agentActivity = await agentSession.waitForActivity();
ParameterPython / RustTypeRequired
typetype · r#typestring | RegExpnocontains, or matches
timeouttimeoutDurationnodefault 10s

Returns LinearAgentActivity. When the time is up, it fails with what it was waiting for.

LinearDelivery#

Returned by LinearUser.editIssue(), LinearUser.undelegate(), LinearUser.assign(), LinearUser.setState().

FieldPython / RustType
ididstring
channelchannel"linear"
appappstring
typetype · r#typestring
actionactionstring
webhookIdwebhook_idstring
payloadpayloadunknown | undefined
attemptsattemptsDeliveryAttempt[]
statusstatus"pending" | "acknowledged" | "failed" | "timed_out" | "unreachable"

refresh()#

Re-read a delivery: its attempts and status.

const updated = await delivery.refresh();

Returns LinearDelivery.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

redeliver()#

Redeliver, as Linear retries: the same delivery, with a new webhookTimestamp and a new signature.

const deliveryAttempt = await delivery.redeliver();

Returns DeliveryAttempt.

Live: refused with unsupported_in_live: Linear has no API to redeliver a webhook.

resend()#

Send the delivery again: stale (its webhookTimestamp two minutes old), or signed with a secret that isn't the app's.

const deliveryAttempt = await delivery.resend({ badSignature });
ParameterPython / RustTypeRequired
badSignaturebad_signaturebooleannooption
stalestalebooleannooption

Returns DeliveryAttempt.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

settled()#

Waits for the delivery to settle: it polls refresh() and never sleeps longer than it must.

const updated = await delivery.settled();
ParameterTypeRequired
timeoutDurationnodefault 10s

Returns LinearDelivery. When the time is up, it fails with what it was waiting for.

LinearAgentActivity#

FieldPython / RustType
ididstring
sessionsessionLinearAgentSession
typetype · r#type"thought" | "action" | "elicitation" | "response" | "error" | "prompt"
authorauthorLinearUser | LinearApp
bodybodystring | undefined
actionaction{ action: string; parameter?: string; result?: string } | undefined
ephemeralephemeralboolean
createdAtcreated_atstring

Types#

Plain values the handles return and take.

LinearApps#

type LinearApps = LinearApp[];

LinearUsers#

type LinearUsers = LinearUser[];

LinearTeams#

type LinearTeams = LinearTeam[];

LinearIssues#

type LinearIssues = LinearIssueListing[];

LinearIssueListing#

FieldType
issueLinearIssue
titlestring

LinearIssueState#

FieldPython / RustType
namenamestring
typetype · r#type"backlog" | "unstarted" | "started" | "completed" | "canceled" | "triage" | "duplicate"

LinearComments#

type LinearComments = LinearComment[];

LinearAgentSessions#

type LinearAgentSessions = LinearAgentSession[];

LinearTranscript#

FieldType
entriesLinearTranscriptEntry[]
textstring

LinearTranscriptEntry#

FieldType
idstring
authorLinearPrincipal
atstring
textstring
controlsstring[]
editedboolean
depthnumber

LinearPrincipal#

FieldType
idstring
namestring
kind"user" | "app"

LinearCommentReplies#

type LinearCommentReplies = LinearComment[];

LinearAgentActivities#

type LinearAgentActivities = LinearAgentActivity[];

LinearExternalUrls#

type LinearExternalUrls = Array<{ label: string; url: string }>;

LinearPlan#

type LinearPlan = Array<{ content: string; status: "pending" | "inProgress" | "completed" | "canceled" }>;

LinearDeliveries#

type LinearDeliveries = LinearDelivery[];

LinearApiCalls#

type LinearApiCalls = LinearApiCall[];

LinearApiCall#

FieldPython / RustType
ididstring
channelchannel"linear"
operationoperationstring
methodmethodstring
pathpathstring
atatstring
durationMsduration_msnumber
requestrequestunknown | undefined
responseStatusresponse_statusnumber
responseresponseunknown | undefined
errorerrorstring | undefined

This page is generated from the control API's routes by codegen/src/emit/docs.ts: suggest changes there.