Data exports
A data export is a ZIP archive with a copy of the current account’s data. Squad builds it in the background while you poll its status, then you download it.
Every route except Download data export archive needs a user token. Bot and OAuth2 tokens get 403.
You can download a completed archive until download_url_expires_at, seven days after it is written. After that, Get data export download URL returns 400 HARVEST_EXPIRED and the status stays completed.
Archive contents
Заголовок раздела «Archive contents»The archive has these files.
user.jsonwith the account, its connections without credentials and its thread membershipschannels/{channel_id}/messages.jsonfor each channel with a collected message, with the oldest firstpayments/payment_history.jsonintegrations/oauth.jsonwith the applications the account ownsaccount/security.json- the avatar and banner under
assets/user/
Each message lists its attachments with a data package URL, and the archive doesn’t include the files. When the export is ready, Squad emails a download link if the account has an email address and the instance sends email.
Export status values
Заголовок раздела «Export status values»| Value | Description |
|---|---|
| pending | Processing has not started |
| processing | An attempt is running |
| completed | The archive is ready for download |
| failed | The latest attempt failed |
When an attempt fails, Squad retries it a limited number of times. The retry clears failed_at and error_message, resets progress to 0 and reports processing. After the last attempt fails, progress_step becomes Failed and the status stays failed.
Export creation object
Заголовок раздела «Export creation object»Structure
Заголовок раздела «Structure»| Field | Type | Description |
|---|---|---|
| harvest_id | snowflake | The ID of the created export |
| status | string | The export status, always pending |
| created_at | ISO8601 timestamp | When the export was requested |
Export status object
Заголовок раздела «Export status object»Structure
Заголовок раздела «Structure»| Field | Type | Description |
|---|---|---|
| harvest_id | snowflake | The ID of the export |
| status | string | The export status |
| created_at | ISO8601 timestamp | When the export was requested |
| started_at | ?ISO8601 timestamp | When the current attempt began |
| completed_at | ?ISO8601 timestamp | When the archive was written |
| failed_at | ?ISO8601 timestamp | When the latest attempt failed |
| file_size | ?string | The archive size in bytes as a decimal string |
| progress_percent | number | Progress from 0 through 100 |
| progress_step | ?string | The export progress step |
| error_message | ?string | The latest failure description, for logs only |
| download_url_expires_at | ?ISO8601 timestamp | When the archive stops being downloadable |
| expires_at | ?ISO8601 timestamp | Same as download_url_expires_at |
Export progress steps
Заголовок раздела «Export progress steps»| Value | Description |
|---|---|
| Queued | The export was created |
| Starting harvest | An attempt began, with progress 0 |
| Harvesting messages | Message collection started, with progress 5 |
| Harvested N messages | N messages were collected. This step is skipped when there are none |
| Collecting user metadata | Account data is being collected, with progress 60 |
| Downloading attachments and creating archive | The ZIP archive is being written, with progress 65 |
| Completed | The archive is ready, with progress 100 |
| Failed | The last attempt failed and Squad stopped retrying |
Export download object
Заголовок раздела «Export download object»Structure
Заголовок раздела «Structure»| Field | Type | Description |
|---|---|---|
| download_url | string | The temporary archive download URL (1-2048 characters) |
| expires_at | ISO8601 timestamp | Seven days after the URL was issued |
Export message filter object
Заголовок раздела «Export message filter object»The filter chooses which messages an export includes, and the rest of the archive is always included.
Structure
Заголовок раздела «Structure»| Field | Type | Description |
|---|---|---|
| scope? | string | selected (the default) or inaccessible_only |
| include_dms? | boolean | Whether to include open one-to-one DMs (default true) |
| include_dms_closed?1 | boolean | Whether to include closed one-to-one DMs (default true) |
| include_group_dms? | boolean | Whether to include group direct messages you are still in (default true) |
| include_guilds? | boolean | Whether to include guilds you are still in (default true) |
| guild_filter_mode? | string | Either exclude or include_only (default exclude) |
| excluded_guild_ids? | array[snowflake] | The guilds to leave out in exclude mode (max 500) |
| included_guild_ids? | array[snowflake] | The only guilds to include in include_only mode (max 500) |
| start_date?2 | ?ISO8601 timestamp | Inclusive lower bound on message time |
| end_date?2 | ?ISO8601 timestamp | Exclusive upper bound on message time |
1 Independent of include_dms
2 Compared with the message ID’s snowflake timestamp. When both are set, start_date must be earlier than end_date.
The selected scope needs at least one include_* field set to true. The inaccessible_only scope selects messages in guilds you left or were removed from and in group direct messages you left. It ignores the include_* fields, guild_filter_mode and both guild lists, and start_date and end_date still apply. Both scopes skip your personal notes channel.
Request data export
Заголовок раздела «Request data export»/v1/users/@me/harvestCreates an unfiltered export from a request with no body, and returns an export creation object.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | export creation object | The export was requested |
The rate limit is 5 requests per 30 minutes, on the user:data:harvest bucket, shared with Request filtered data export.
Request filtered data export
Заголовок раздела «Request filtered data export»/v1/users/@me/harvest/filteredCreates an export that includes only the messages the filter selects and returns an export creation object. With every field at its default, it includes the same messages as Request data export except those in guilds and group direct messages you have left.
JSON body
Заголовок раздела «JSON body»A export message filter object.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | export creation object | The export was requested |
| 400 | error response | A field is invalid, selected has no include_* field set to true or start_date is not before end_date |
The user:data:harvest bucket allows 5 requests per 30 minutes, and Request data export shares it.
Get latest data export
Заголовок раздела «Get latest data export»/v1/users/@me/harvest/latestReturns the newest export status object, or null when the account has no export.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | export status object | null | The latest export was returned |
The rate limit is 40 requests per 10 seconds, on the user:harvest:latest bucket.
Get data export status
Заголовок раздела «Get data export status»/v1/users/@me/harvest/{harvest_id}Returns one export status object owned by the current account.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | export status object | The export was returned |
| 404 | error response | UNKNOWN_HARVEST when the export doesn’t exist or isn’t yours |
The rate limit is 40 requests per 10 seconds, on the user:harvest:status bucket.
Get data export download URL
Заголовок раздела «Get data export download URL»/v1/users/@me/harvest/{harvest_id}/downloadIssues a temporary download URL for a completed export and returns an export download object. By default the URL is a presigned object storage URL. When FLUXER_API_PRESIGNED_HARVEST_DOWNLOADS_ENABLED is false, it links to Download data export archive.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | export download object | A URL was issued |
| 400 | error response | HARVEST_NOT_READY, HARVEST_FAILED or HARVEST_EXPIRED |
| 404 | error response | UNKNOWN_HARVEST when the export doesn’t exist or isn’t yours |
The rate limit is 10 requests per minute, on the user:harvest:download bucket.
Download data export archive
Заголовок раздела «Download data export archive»/v1/harvest-downloads/{harvest_id}Streams the archive of a completed export. Use the full URL from Get data export download URL, whose token authorises the request. When presigned downloads are on, this route returns 404.
Query parameters
Заголовок раздела «Query parameters»| Field | Type | Description |
|---|---|---|
| token | string | The signed download token (1-2048 characters) |
Request headers
Заголовок раздела «Request headers»| Field | Type | Description |
|---|---|---|
| Range? | string | A byte range, returned with 206 and Content-Range |
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | archive bytes | The archive was streamed as application/zip called fluxer-data-{harvest_id}.zip |
| 206 | archive bytes | The requested byte range was streamed |
| 404 | Not Found | The token is invalid or expired, or the export is not downloadable |
| 416 | Range Not Satisfiable | The requested byte range is outside the archive |
The rate limit is 60 requests per minute, on the user:harvest:download_file bucket.