# Issues

> Create issues from your systems, read the inbox, and manage status, priority, tags, and assignment.

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

---

Issues (tickets) are the core object. Create them from your own systems, read
the inbox, and manage status, priority, tags, assignment, and spam/trash state.

### Create an issue

```graphql
mutation Create($input: CreateIssueInput!) {
  createIssue(input: $input) {
    issue { id ticketNumber subject status }
    error { code message fields { path message } }
  }
}
```

`CreateIssueInput` fields:

| Field | Required | Description |
| --- | --- | --- |
| `subject` | Yes | Issue title. |
| `body` | Yes | First inbound message (plain text). |
| `priority` | No | `low` \| `normal` \| `high` \| `urgent`. |
| `requesterEmail` | No | Requester email; used to create/link a contact. |
| `requesterName` | No | Requester display name. |
| `contactId` | No | Link to an existing CRM contact (opaque id). |
| `accountId` | No | Link to an existing CRM account (opaque id). |
| `tags` | No | Tags to apply. |
| `externalId` | No | Your stable id; reusing it returns the original issue. |
| `idempotencyKey` | No | Dedupe key for safe retries. |

### List the inbox

```graphql
query Inbox($after: String) {
  issues(first: 25, after: $after, target: all, status: new, sortKey: createdAt) {
    edges { node { id ticketNumber subject status priority lastMessageAt } }
    pageInfo { hasNextPage endCursor }
  }
}
```

`issues` supports filters: `target` (`all` \| `my` \| `following` \| `spam` \|
`trash`), `status`, `tag`, `accountId`, `assigneeProfileId`, `search`, and
`sortKey` (`createdAt` \| `updatedAt`).

### Manage an issue

```graphql
mutation Triage($id: ID!) {
  setIssueStatus(issueId: $id, status: on_hold) { issue { id status } error { code message } }
  setIssuePriority(issueId: $id, priority: urgent) { issue { id priority } error { code message } }
  setIssueTags(issueId: $id, tags: ["billing", "escalated"]) { issue { id tags } error { code message } }
  assignIssue(issueId: $id, assigneeProfileId: "<profile-id>") { issue { id assignedTo } error { code message } }
}
```

Other issue mutations: `setIssueAccount`, `setIssueTeams`, `setIssueSpam`,
`setIssueTrashed`, `followIssue`, `unfollowIssue`.
