0
# Team & User Management
1
2
Team and user operations for managing workspace members, teams, permissions, and organizational structure within Linear.
3
4
## Capabilities
5
6
### Team Queries
7
8
Query individual teams or collections with filtering and pagination support.
9
10
```typescript { .api }
11
/**
12
* Get a single team by ID
13
* @param id - The team ID
14
* @returns Promise resolving to the team
15
*/
16
team(id: string): LinearFetch<Team>;
17
18
/**
19
* Get a paginated list of teams with optional filtering
20
* @param variables - Query parameters including filters and pagination
21
* @returns Promise resolving to a connection of teams
22
*/
23
teams(variables?: TeamsQueryVariables): LinearFetch<TeamConnection>;
24
25
interface TeamsQueryVariables extends LinearConnectionVariables {
26
/** Filter conditions for teams */
27
filter?: TeamFilter;
28
/** Sort order for teams */
29
orderBy?: PaginationOrderBy;
30
/** Include archived teams */
31
includeArchived?: boolean;
32
}
33
34
interface TeamFilter {
35
/** Filter by team name */
36
name?: StringFilter;
37
/** Filter by team key */
38
key?: StringFilter;
39
/** Filter by team description */
40
description?: NullableStringFilter;
41
/** Combine filters with AND logic */
42
and?: TeamFilter[];
43
/** Combine filters with OR logic */
44
or?: TeamFilter[];
45
}
46
```
47
48
**Usage Examples:**
49
50
```typescript
51
import { LinearClient } from "@linear/sdk";
52
53
const client = new LinearClient({ apiKey: "your-api-key" });
54
55
// Get a single team
56
const team = await client.team("team-id");
57
console.log(team.name, team.key);
58
59
// Get all active teams
60
const teams = await client.teams({
61
filter: {
62
key: { neq: "archived" }
63
}
64
});
65
66
// Find team by key
67
const engineeringTeam = await client.teams({
68
filter: {
69
key: { eq: "ENG" }
70
}
71
});
72
```
73
74
### Team Mutations
75
76
Create, update, and manage teams with comprehensive configuration options.
77
78
```typescript { .api }
79
/**
80
* Create a new team
81
* @param input - Team creation data
82
* @returns Promise resolving to the creation result
83
*/
84
createTeam(input: TeamCreateInput): LinearFetch<TeamPayload>;
85
86
/**
87
* Update an existing team
88
* @param id - The team ID to update
89
* @param input - Team update data
90
* @returns Promise resolving to the update result
91
*/
92
updateTeam(id: string, input: TeamUpdateInput): LinearFetch<TeamPayload>;
93
94
/**
95
* Archive a team
96
* @param id - The team ID to archive
97
* @returns Promise resolving to the archive result
98
*/
99
archiveTeam(id: string): LinearFetch<ArchivePayload>;
100
101
interface TeamCreateInput {
102
/** Team name */
103
name: string;
104
/** Team key (unique identifier) */
105
key: string;
106
/** Team description */
107
description?: string;
108
/** Team icon */
109
icon?: string;
110
/** Team color */
111
color?: string;
112
/** Timezone for the team */
113
timezone?: string;
114
/** Whether the team is private */
115
private?: boolean;
116
/** Issue estimation type */
117
issueEstimationType?: IssueEstimationType;
118
/** Issue estimation scale */
119
issueEstimationExtended?: boolean;
120
/** Issue estimation allow zero */
121
issueEstimationAllowZero?: boolean;
122
/** Issue auto-assignment on creation */
123
issueOrderingNoPriorityFirst?: boolean;
124
/** Default issue state for new issues */
125
defaultIssueStateId?: string;
126
/** Default template for issues */
127
defaultTemplateForMembersId?: string;
128
/** Default template for non-members */
129
defaultTemplateForNonMembersId?: string;
130
/** Triage state ID */
131
triageStateId?: string;
132
/** Whether to automatically archive completed issues */
133
autoArchivePeriod?: number;
134
}
135
136
interface TeamUpdateInput {
137
/** Update team name */
138
name?: string;
139
/** Update team key */
140
key?: string;
141
/** Update team description */
142
description?: string;
143
/** Update team icon */
144
icon?: string;
145
/** Update team color */
146
color?: string;
147
/** Update timezone */
148
timezone?: string;
149
/** Update privacy setting */
150
private?: boolean;
151
/** Update estimation settings */
152
issueEstimationType?: IssueEstimationType;
153
issueEstimationExtended?: boolean;
154
issueEstimationAllowZero?: boolean;
155
/** Update default state */
156
defaultIssueStateId?: string;
157
/** Update auto-archive period */
158
autoArchivePeriod?: number;
159
}
160
161
enum IssueEstimationType {
162
NotUsed = "notUsed",
163
Exponential = "exponential",
164
Fibonacci = "fibonacci",
165
Linear = "linear",
166
TShirt = "tShirt"
167
}
168
```
169
170
**Usage Examples:**
171
172
```typescript
173
// Create a new engineering team
174
const newTeam = await client.createTeam({
175
name: "Backend Engineering",
176
key: "BE",
177
description: "Backend services and infrastructure team",
178
color: "#3b82f6",
179
issueEstimationType: IssueEstimationType.Fibonacci,
180
issueEstimationExtended: true
181
});
182
183
// Update team settings
184
const updatedTeam = await client.updateTeam("team-id", {
185
description: "Updated team description",
186
autoArchivePeriod: 30 // days
187
});
188
```
189
190
### User Queries
191
192
Query workspace users and members with filtering and pagination.
193
194
```typescript { .api }
195
/**
196
* Get a single user by ID
197
* @param id - The user ID
198
* @returns Promise resolving to the user
199
*/
200
user(id: string): LinearFetch<User>;
201
202
/**
203
* Get a paginated list of users with optional filtering
204
* @param variables - Query parameters including filters and pagination
205
* @returns Promise resolving to a connection of users
206
*/
207
users(variables?: UsersQueryVariables): LinearFetch<UserConnection>;
208
209
/**
210
* Get the current authenticated user
211
* @returns Promise resolving to the viewer user
212
*/
213
viewer: LinearFetch<User>;
214
215
interface UsersQueryVariables extends LinearConnectionVariables {
216
/** Filter conditions for users */
217
filter?: UserFilter;
218
/** Sort order for users */
219
orderBy?: PaginationOrderBy;
220
/** Include deactivated users */
221
includeDisabled?: boolean;
222
}
223
224
interface UserFilter {
225
/** Filter by display name */
226
displayName?: StringFilter;
227
/** Filter by email */
228
email?: StringFilter;
229
/** Filter by name */
230
name?: StringFilter;
231
/** Filter by active status */
232
active?: BooleanFilter;
233
/** Filter by admin status */
234
admin?: BooleanFilter;
235
/** Combine filters with AND logic */
236
and?: UserFilter[];
237
/** Combine filters with OR logic */
238
or?: UserFilter[];
239
}
240
```
241
242
**Usage Examples:**
243
244
```typescript
245
// Get current user
246
const currentUser = await client.viewer;
247
console.log(currentUser.email);
248
249
// Get all active users
250
const activeUsers = await client.users({
251
filter: {
252
active: { eq: true }
253
}
254
});
255
256
// Find user by email
257
const userByEmail = await client.users({
258
filter: {
259
email: { eq: "john@company.com" }
260
}
261
});
262
```
263
264
### Team Memberships
265
266
Manage team memberships and user permissions.
267
268
```typescript { .api }
269
/**
270
* Get team memberships with filtering
271
* @param variables - Query parameters
272
* @returns Promise resolving to a connection of team memberships
273
*/
274
teamMemberships(variables?: TeamMembershipsQueryVariables): LinearFetch<TeamMembershipConnection>;
275
276
/**
277
* Create a team membership
278
* @param input - Team membership creation data
279
* @returns Promise resolving to the creation result
280
*/
281
createTeamMembership(input: TeamMembershipCreateInput): LinearFetch<TeamMembershipPayload>;
282
283
/**
284
* Update a team membership
285
* @param id - The membership ID to update
286
* @param input - Membership update data
287
* @returns Promise resolving to the update result
288
*/
289
updateTeamMembership(id: string, input: TeamMembershipUpdateInput): LinearFetch<TeamMembershipPayload>;
290
291
/**
292
* Delete a team membership
293
* @param id - The membership ID to delete
294
* @returns Promise resolving to the deletion result
295
*/
296
deleteTeamMembership(id: string): LinearFetch<DeletePayload>;
297
298
interface TeamMembershipCreateInput {
299
/** Team ID */
300
teamId: string;
301
/** User ID */
302
userId: string;
303
/** Whether user is owner of the team */
304
owner?: boolean;
305
/** Sort order within team */
306
sortOrder?: number;
307
}
308
309
interface TeamMembershipUpdateInput {
310
/** Update owner status */
311
owner?: boolean;
312
/** Update sort order */
313
sortOrder?: number;
314
}
315
```
316
317
### Organization Settings
318
319
Manage organization-wide settings and configurations.
320
321
```typescript { .api }
322
/**
323
* Get organization information
324
* @returns Promise resolving to the organization
325
*/
326
organization: LinearFetch<Organization>;
327
328
/**
329
* Update organization settings
330
* @param input - Organization update data
331
* @returns Promise resolving to the update result
332
*/
333
updateOrganization(input: UpdateOrganizationInput): LinearFetch<OrganizationPayload>;
334
335
interface UpdateOrganizationInput {
336
/** Organization name */
337
name?: string;
338
/** Organization logo URL */
339
logoUrl?: string;
340
/** Organization URL slug */
341
urlKey?: string;
342
/** Allow members to create teams */
343
allowMembersToCreateTeams?: boolean;
344
/** Roadmap visibility */
345
roadmapEnabled?: boolean;
346
/** Git branch format */
347
gitBranchFormat?: string;
348
/** Git linkback messages enabled */
349
gitLinkbackMessagesEnabled?: boolean;
350
/** Git public linkback messages enabled */
351
gitPublicLinkbackMessagesEnabled?: boolean;
352
}
353
```
354
355
## Core Team & User Types
356
357
```typescript { .api }
358
/** Team model representing a Linear team */
359
class Team extends Request {
360
/** Unique team identifier */
361
id: string;
362
/** Team name */
363
name: string;
364
/** Team key (unique identifier) */
365
key: string;
366
/** Team description */
367
description?: string;
368
/** Team color */
369
color: string;
370
/** Team icon */
371
icon?: string;
372
/** Team timezone */
373
timezone: string;
374
/** Whether team is private */
375
private: boolean;
376
/** Issue estimation settings */
377
issueEstimationType: IssueEstimationType;
378
issueEstimationExtended: boolean;
379
issueEstimationAllowZero: boolean;
380
/** Auto-archive period in days */
381
autoArchivePeriod: number;
382
/** Default issue state */
383
defaultIssueState?: WorkflowState;
384
/** Triage workflow state */
385
triageState?: WorkflowState;
386
/** Team members */
387
members: UserConnection;
388
/** Team memberships with roles */
389
memberships: TeamMembershipConnection;
390
/** Team issues */
391
issues: IssueConnection;
392
/** Team projects */
393
projects: ProjectConnection;
394
/** Team cycles */
395
cycles: CycleConnection;
396
/** Team workflow states */
397
states: WorkflowStateConnection;
398
/** Team labels */
399
labels: IssueLabelConnection;
400
/** Creation timestamp */
401
createdAt: DateTime;
402
/** Last update timestamp */
403
updatedAt: DateTime;
404
/** Archive timestamp */
405
archivedAt?: DateTime;
406
}
407
408
/** User model representing a workspace user */
409
class User extends Request {
410
/** Unique user identifier */
411
id: string;
412
/** User display name */
413
displayName: string;
414
/** User email address */
415
email: string;
416
/** User name/handle */
417
name: string;
418
/** User avatar URL */
419
avatarUrl?: string;
420
/** User timezone */
421
timezone?: string;
422
/** Whether user is active */
423
active: boolean;
424
/** Whether user is admin */
425
admin: boolean;
426
/** Whether user is guest */
427
guest: boolean;
428
/** User creation timestamp */
429
createdAt: DateTime;
430
/** Last update timestamp */
431
updatedAt: DateTime;
432
/** Last seen timestamp */
433
lastSeenAt?: DateTime;
434
/** User's teams */
435
teams: TeamConnection;
436
/** User's team memberships */
437
teamMemberships: TeamMembershipConnection;
438
/** Issues assigned to user */
439
assignedIssues: IssueConnection;
440
/** Issues created by user */
441
createdIssues: IssueConnection;
442
}
443
444
/** Team membership model */
445
class TeamMembership extends Request {
446
/** Unique membership identifier */
447
id: string;
448
/** Associated team */
449
team: Team;
450
/** Associated user */
451
user: User;
452
/** Whether user is team owner */
453
owner: boolean;
454
/** Sort order within team */
455
sortOrder: number;
456
/** Creation timestamp */
457
createdAt: DateTime;
458
/** Last update timestamp */
459
updatedAt: DateTime;
460
}
461
462
/** Organization model */
463
class Organization extends Request {
464
/** Unique organization identifier */
465
id: string;
466
/** Organization name */
467
name: string;
468
/** Organization logo URL */
469
logoUrl?: string;
470
/** Organization URL key */
471
urlKey: string;
472
/** Whether members can create teams */
473
allowMembersToCreateTeams: boolean;
474
/** Whether roadmap is enabled */
475
roadmapEnabled: boolean;
476
/** Git branch format */
477
gitBranchFormat?: string;
478
/** Git linkback settings */
479
gitLinkbackMessagesEnabled: boolean;
480
gitPublicLinkbackMessagesEnabled: boolean;
481
/** Creation timestamp */
482
createdAt: DateTime;
483
/** Last update timestamp */
484
updatedAt: DateTime;
485
}
486
487
/** Response payload for team mutations */
488
interface TeamPayload {
489
/** The mutated team */
490
team?: Team;
491
/** Whether the mutation was successful */
492
success: boolean;
493
/** Last sync ID */
494
lastSyncId: number;
495
}
496
497
/** Paginated connection of teams */
498
class TeamConnection extends Connection<Team> {
499
/** Teams in this page */
500
nodes: Team[];
501
/** Pagination information */
502
pageInfo: PageInfo;
503
}
504
505
/** Paginated connection of users */
506
class UserConnection extends Connection<User> {
507
/** Users in this page */
508
nodes: User[];
509
/** Pagination information */
510
pageInfo: PageInfo;
511
}
512
```