# Issues

> Every issue query and mutation: inbox, create, reply, status, priority, tags, assignment, spam/trash.

Product: Clad API
Source: https://docs.useclad.ai/api/reference-issues

---

Create issues, read the inbox, reply, and manage status, priority, tags, assignment, and spam/trash state.

### Queries

#### `issue`

```graphql
issue(id: ID!): Issue
```

| Argument | Type | Description |
| --- | --- | --- |
| `id` | `ID!` | Required. |

#### `issues`

```graphql
issues(accountId: ID, after: String, assigneeProfileId: ID, first: Int, search: String, sortKey: IssueSortKey, status: IssueStatus, tag: String, target: InboxTarget): IssueConnection
```

| Argument | Type | Description |
| --- | --- | --- |
| `accountId` | `ID` | Filter to issues linked to this account (opaque Account id). |
| `after` | `String` |  |
| `assigneeProfileId` | `ID` | Filter to issues assigned to this org member (opaque Profile id). |
| `first` | `Int` |  |
| `search` | `String` | Case-insensitive match on subject or last message preview. |
| `sortKey` | `IssueSortKey` | Sort anchor (descending). Defaults to createdAt. |
| `status` | `IssueStatus` |  |
| `tag` | `String` | Filter to issues carrying this tag (exact match). |
| `target` | `InboxTarget` |  |

### Mutations

#### `assignIssue`

```graphql
assignIssue(assigneeProfileId: ID, issueId: ID!): IssueMutationResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `assigneeProfileId` | `ID` | Opaque Profile id of an org member, or null to unassign. |
| `issueId` | `ID!` | Required. |

#### `createIssue`

```graphql
createIssue(input: CreateIssueInput!): CreateIssueResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `input` | `CreateIssueInput!` | Required. |

#### `followIssue`

```graphql
followIssue(issueId: ID!, profileId: ID): IssueMutationResult
```

Add a follower to an issue. Humans follow themselves when profileId is omitted; machine actors must name an org member.

| Argument | Type | Description |
| --- | --- | --- |
| `issueId` | `ID!` | Required. |
| `profileId` | `ID` | Opaque Profile id of the member to add (defaults to the caller for human sessions). |

#### `replyToIssue`

```graphql
replyToIssue(input: ReplyToIssueInput!): ReplyToIssueResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `input` | `ReplyToIssueInput!` | Required. |

#### `setIssueAccount`

```graphql
setIssueAccount(accountId: ID, issueId: ID!): IssueMutationResult
```

Link an issue to a CRM account (null unlinks). Team routing inherited from the account follows automatically.

| Argument | Type | Description |
| --- | --- | --- |
| `accountId` | `ID` | Opaque Account id, or null to unlink. |
| `issueId` | `ID!` | Required. |

#### `setIssuePriority`

```graphql
setIssuePriority(issueId: ID!, priority: IssuePriority!): IssueMutationResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `issueId` | `ID!` | Required. |
| `priority` | `IssuePriority!` | Required. |

#### `setIssueSpam`

```graphql
setIssueSpam(isSpam: Boolean!, issueId: ID!): IssueMutationResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `isSpam` | `Boolean!` | Required. |
| `issueId` | `ID!` | Required. |

#### `setIssueStatus`

```graphql
setIssueStatus(issueId: ID!, status: IssueStatus!): IssueMutationResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `issueId` | `ID!` | Required. |
| `status` | `IssueStatus!` | Required. |

#### `setIssueTags`

```graphql
setIssueTags(issueId: ID!, tags: [String!]!): IssueMutationResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `issueId` | `ID!` | Required. |
| `tags` | `[String!]!` | Required. |

#### `setIssueTeams`

```graphql
setIssueTeams(issueId: ID!, teamIds: [ID!]!): IssueMutationResult
```

Replace the manual team assignments on an issue (same semantics as the inbox team picker).

| Argument | Type | Description |
| --- | --- | --- |
| `issueId` | `ID!` | Required. |
| `teamIds` | `[ID!]!` | Opaque Team ids; empty list clears manual assignments. |

#### `setIssueTrashed`

```graphql
setIssueTrashed(issueId: ID!, trashed: Boolean!): IssueMutationResult
```

| Argument | Type | Description |
| --- | --- | --- |
| `issueId` | `ID!` | Required. |
| `trashed` | `Boolean!` | true to move to trash, false to restore. |

#### `unfollowIssue`

```graphql
unfollowIssue(issueId: ID!, profileId: ID): IssueMutationResult
```

Remove a follower from an issue (defaults to the caller for human sessions).

| Argument | Type | Description |
| --- | --- | --- |
| `issueId` | `ID!` | Required. |
| `profileId` | `ID` | Opaque Profile id of the member to remove (defaults to the caller for human sessions). |
