> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# supportTicketExportStart

> Write the store's tickets to a CSV in the background, as the help desk's Export CSV does, and return the export while it is RUNNING; poll `supportTicketExport` for the file. It takes the filters `supportTickets` takes and exports the tickets it lists for them, in no set order. With `ticketIds` it exports just those tickets instead. No email is sent. The store runs one API export at a time, apart from the help desk's own: starting one while another runs fails with CONFLICT. Throws IDEMPOTENCY_KEY_REUSED as idempotencyKey describes, and TRY_AGAIN (503) when the export couldn't start.

**Required scopes:** [`support_tickets_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-support_tickets_read)

## Arguments

**assigneeIds** `[ID!]`

Tickets assigned to any of these team members, at most 100. `assigneeIds`, `assigneeTypes` and `includeUnassigned` match as one OR.

**assigneeTypes** `[\[SupportTicketAssigneeType!\]](/docs/api-reference/v3/reference/support/support-ticket-assignee-type)`

Tickets with any of these kinds of assignee. Matches with `assigneeIds` and `includeUnassigned` as one OR.

**channels** `[\[MessageChannel!\]](/docs/api-reference/v3/reference/support/message-channel)`

On any of these channels.

**closedAfter** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets closed after this instant.

**closedBefore** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets closed before this instant.

**columns** `[\[SupportTicketExportColumn!\]](/docs/api-reference/v3/reference/support/support-ticket-export-column)`

The column groups to include, in this order. Omitted: every column, in the help desk table's order. The always-included columns keep their places.

**createdAfter** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets created after this instant.

**createdBefore** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets created before this instant.

**customerId** `ID`

The customer's id or legacy id. Requires customers\_read. A customer the store doesn't have matches no tickets; a malformed id fails with BAD\_USER\_INPUT.

**Requires:** [`customers_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-customers_read)

**excludedTagIds** `[ID!]`

Has none of these tags, at most 100.

**excludedTicketIds** `[ID!]`

Tickets to leave out of a filtered export, at most 1000, as the help desk does for "all matching except these". Ignored with `ticketIds`.

**idempotencyKey** `String`

A key you choose, up to 100 characters, that makes a retry safe. For 24 hours, while no other export of the store has started since, repeating the start with the same key returns the export it started instead of starting another. The same key with different arguments throws IDEMPOTENCY\_KEY\_REUSED (422).

**inboxEmails** `[String!]`

Tickets that came in on any of these store inbox addresses, at most 100. Matched without case.

**includeUnassigned** `Boolean`

Also match tickets with no assignee. Matches with `assigneeIds` and `assigneeTypes` as one OR.

**lastCustomerMessageAfter** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets whose last customer message is after this instant.

**lastCustomerMessageBefore** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets whose last customer message is before this instant.

**lastMerchantMessageAfter** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets whose last message from the team, the AI agent or an automation is after this instant.

**lastMerchantMessageBefore** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets whose last message from the team, the AI agent or an automation is before this instant.

**lastResponseAfter** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets whose last message, from the customer or the team, is after this instant.

**lastResponseBefore** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

Only tickets whose last message, from the customer or the team, is before this instant.

**mentionedIds** `[ID!]`

Tickets with an internal note that @mentions any of these team members, at most 100.

**participantCustomerId** `ID`

Tickets this customer takes part in on any thread, the match the help desk's customer ticket list makes; `customerId` matches only the ticket's main customer. That list also leaves out spam and the AI agent's tickets, which this filter doesn't. The customer's id or legacy id. Requires customers\_read.

**Requires:** [`customers_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-customers_read)

**query** `String`

The inbox search: message and subject words, the customer's name, email or phone, order numbers. At most 200 characters. Matches customer details with only support\_tickets\_read, as the inbox does.

**queryFields** `[\[SupportTicketSearchField!\]](/docs/api-reference/v3/reference/support/support-ticket-search-field)`

Where `query` looks. Omitted or empty: everywhere, including the AI summary.

**searchContains** `[String!]`

Tickets that contain every one of these keywords, at most 10 of 200 characters each. Searches what `query` does except order numbers, and matches customer details with only support\_tickets\_read.

**searchContainsFields** `[\[SupportTicketSearchField!\]](/docs/api-reference/v3/reference/support/support-ticket-search-field)`

Where `searchContains` looks. Omitted or empty: everywhere it can.

**sentMessagesMoreThan** `Int`

Tickets with more than this many messages from team members, counting the tickets merged into them, as the help desk's Sent view counts them. Internal notes count, so a ticket whose only team activity is a note has one; messages from the AI agent, auto-replies, chat flows and the system don't. The Sent view also leaves out spam, which this filter doesn't; `excludedTagIds` can. 0 or more.

**statuses** `[\[SupportTicketStatus!\]](/docs/api-reference/v3/reference/support/support-ticket-status)`

Any of these. Omitted or empty: every status but ARCHIVED, as the help desk lists tickets; name ARCHIVED to include archived tickets.

**tagIds** `[ID!]`

Has any of these tags, at most 100.

**ticketIds** `[ID!]`

Export exactly these tickets, at most 1000, and ignore the filters, as the help desk does for tickets picked by hand. An id the store doesn't have, or a ticket `supportTickets` never lists, is left out.

**unread** `Boolean`

True: tickets with a customer message the team has not read yet. False: the others, including tickets the customer never wrote on.

## Returns

**supportTicketExportStart** `[SupportTicketExport!](/docs/api-reference/v3/reference/support/support-ticket-export)` *required*

A CSV of the store's tickets, one row per ticket with its messages in a JSON column, written in the background. It holds the tickets `supportTickets` lists for the same filters. The file is deleted 8 days after the export starts; after that the export reads FAILED with RESULT\_EXPIRED.

**fields**

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the job was started.

**error** `[JobError](/docs/api-reference/v3/reference/common/job-error)`

Why the job failed. Null unless `status` is FAILED.

**fields**

**code** `String!` *required*

A stable code in SCREAMING\_SNAKE\_CASE. Branch on it, not on `message`.

**message** `String!` *required*

What went wrong, in words.

**file** `[File](/docs/api-reference/v3/reference/common/file)`

The CSV, once SUCCEEDED. Its link works for up to an hour; read the export again for a fresh one. Null otherwise.

**fields**

**contentType** `String!` *required*

The file's media type, such as text/csv.

**fileName** `String`

The name the file downloads as. Null when the file has none.

**height** `Int`

An image's height in pixels. Null for other files.

**sizeBytes** `Int`

The file's size in bytes. Null when it wasn't recorded.

**url** `String!` *required*

Where to download the file. Signed and short-lived for a private file (see `urlExpiresAt`); stable for a public one.

**urlExpiresAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When `url` stops working. Null for a public file, whose `url` doesn't expire.

**width** `Int`

An image's width in pixels. Null for other files.

**finishedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the job finished. Null while it is going.

**id** `ID!` *required*

Poll the job again with this id.

**rowCount** `Int`

How many tickets the file has. Null until SUCCEEDED.

**status** `[JobStatus!](/docs/api-reference/v3/reference/common/job-status)` *required*

Where the job stands.

## Errors

Besides the [errors any request can return](https://developers.redo.com/docs/api-reference/v3/errors.md), this operation fails with these codes in `extensions.code`.

| Code | HTTP status | Meaning | Retry |
| - | - | - | - |
| `API_TOKEN_REQUIRED` | `403` | The credential has no API token to attribute the change to, such as a first-party token. Nothing was sent. | Call with a store API token. |
| `BAD_USER_INPUT` | `400` | An argument is invalid, or names something the store doesn't have. The message says which. Nothing was written. | Fix the input the message names, then send it again. |
| `CONFLICT` | `409` | The change clashes with another record, such as a name already in use, and nothing was written. Or a request with the same idempotencyKey is still in progress or its outcome isn't known yet, and its write, such as an email to the customer, may already exist. | Change the clashing value, then send it again. When the message says a request with the same idempotencyKey is still in progress, wait a few seconds and send it again with the same key, which returns that request's result once it settles. Don't resend it with a new key or without one: it may write twice. |
| `IDEMPOTENCY_KEY_REUSED` | `422` | The idempotencyKey was already used for a different request. Nothing was written. | Send the new request with a new idempotencyKey, or resend the first request unchanged to get its result. |
| `TRY_AGAIN` | `503` | The change couldn't start for a passing reason, and nothing was written or sent. | Send the same request again after a short wait, with the same idempotencyKey if it has one. |
| `INTERNAL_SERVER_ERROR` | `500` | Something failed on Redo's side. The change may or may not have been made. | Read the record to see whether the change was made before sending it again. A send with an idempotencyKey is safe to retry with the same key. |

## Example

```graphql theme={null}
mutation {
  supportTicketExportStart(assigneeIds: "...", assigneeTypes: AI_AGENT, channels: ATTENTIVE, closedAfter: "...", closedBefore: "...", columns: ASSIGNEE, createdAfter: "...", createdBefore: "...", customerId: "...", excludedTagIds: "...", excludedTicketIds: "...", idempotencyKey: "...", inboxEmails: "...", includeUnassigned: true, lastCustomerMessageAfter: "...", lastCustomerMessageBefore: "...", lastMerchantMessageAfter: "...", lastMerchantMessageBefore: "...", lastResponseAfter: "...", lastResponseBefore: "...", mentionedIds: "...", participantCustomerId: "...", query: "...", queryFields: AI_SUMMARY, searchContains: "...", searchContainsFields: AI_SUMMARY, sentMessagesMoreThan: 10, statuses: ARCHIVED, tagIds: "...", ticketIds: "...", unread: true) {
    createdAt
    finishedAt
    id
    rowCount
    status
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.