Перейти к содержимому

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.

The archive has these files.

  • user.json with the account, its connections without credentials and its thread memberships
  • channels/{channel_id}/messages.json for each channel with a collected message, with the oldest first
  • payments/payment_history.json
  • integrations/oauth.json with the applications the account owns
  • account/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.

ValueDescription
pendingProcessing has not started
processingAn attempt is running
completedThe archive is ready for download
failedThe 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.

FieldTypeDescription
harvest_idsnowflakeThe ID of the created export
statusstringThe export status, always pending
created_atISO8601 timestampWhen the export was requested
FieldTypeDescription
harvest_idsnowflakeThe ID of the export
statusstringThe export status
created_atISO8601 timestampWhen the export was requested
started_at?ISO8601 timestampWhen the current attempt began
completed_at?ISO8601 timestampWhen the archive was written
failed_at?ISO8601 timestampWhen the latest attempt failed
file_size?stringThe archive size in bytes as a decimal string
progress_percentnumberProgress from 0 through 100
progress_step?stringThe export progress step
error_message?stringThe latest failure description, for logs only
download_url_expires_at?ISO8601 timestampWhen the archive stops being downloadable
expires_at?ISO8601 timestampSame as download_url_expires_at
ValueDescription
QueuedThe export was created
Starting harvestAn attempt began, with progress 0
Harvesting messagesMessage collection started, with progress 5
Harvested N messagesN messages were collected. This step is skipped when there are none
Collecting user metadataAccount data is being collected, with progress 60
Downloading attachments and creating archiveThe ZIP archive is being written, with progress 65
CompletedThe archive is ready, with progress 100
FailedThe last attempt failed and Squad stopped retrying
FieldTypeDescription
download_urlstringThe temporary archive download URL (1-2048 characters)
expires_atISO8601 timestampSeven days after the URL was issued

The filter chooses which messages an export includes, and the rest of the archive is always included.

FieldTypeDescription
scope?stringselected (the default) or inaccessible_only
include_dms?booleanWhether to include open one-to-one DMs (default true)
include_dms_closed?1booleanWhether to include closed one-to-one DMs (default true)
include_group_dms?booleanWhether to include group direct messages you are still in (default true)
include_guilds?booleanWhether to include guilds you are still in (default true)
guild_filter_mode?stringEither 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 timestampInclusive lower bound on message time
end_date?2?ISO8601 timestampExclusive 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.

POST /v1/users/@me/harvest

Creates an unfiltered export from a request with no body, and returns an export creation object.

StatusBodyCondition
200export creation objectThe export was requested

The rate limit is 5 requests per 30 minutes, on the user:data:harvest bucket, shared with Request filtered data export.

POST /v1/users/@me/harvest/filtered

Creates 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.

A export message filter object.

StatusBodyCondition
200export creation objectThe export was requested
400error responseA 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 /v1/users/@me/harvest/latest

Returns the newest export status object, or null when the account has no export.

StatusBodyCondition
200export status object | nullThe latest export was returned

The rate limit is 40 requests per 10 seconds, on the user:harvest:latest bucket.

GET /v1/users/@me/harvest/{harvest_id}

Returns one export status object owned by the current account.

StatusBodyCondition
200export status objectThe export was returned
404error responseUNKNOWN_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 /v1/users/@me/harvest/{harvest_id}/download

Issues 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.

StatusBodyCondition
200export download objectA URL was issued
400error responseHARVEST_NOT_READY, HARVEST_FAILED or HARVEST_EXPIRED
404error responseUNKNOWN_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.

GET /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.

FieldTypeDescription
tokenstringThe signed download token (1-2048 characters)
FieldTypeDescription
Range?stringA byte range, returned with 206 and Content-Range
StatusBodyCondition
200archive bytesThe archive was streamed as application/zip called fluxer-data-{harvest_id}.zip
206archive bytesThe requested byte range was streamed
404Not FoundThe token is invalid or expired, or the export is not downloadable
416Range Not SatisfiableThe requested byte range is outside the archive

The rate limit is 60 requests per minute, on the user:harvest:download_file bucket.