Skip to main content

/o/app_users/download/\{id\}

Endpoint​

/o/app_users/download/\{id\}

Overview​

Download previously created app-user export data.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

  • Requires read-level app access.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)Dashboard API authentication key.
auth_tokenStringYes (or use api_key)Dashboard auth token.
idStringYesExport identifier path segment, or task ID that resolves to export identifier.
app_idStringYesTarget app ID used for read-access validation.

Examples​

Example 1: Download export archive​

/o/app_users/download/appUser_64b0ac10c2c3ce0012dd1001_1?api_key=YOUR_API_KEY&app_id=64b0ac10c2c3ce0012dd1001

Example 2: Download via task ID​

/o/app_users/download/03ccb0c8ac773298f62f8bdb5d0f8869cb78f788?api_key=YOUR_API_KEY&app_id=64b0ac10c2c3ce0012dd1001

Response​

Success Response​

HTTP 200 with streamed file content

Response Fields​

FieldTypeDescription
HTTP bodyBinary stream / streamed JSONExport archive (application/x-gzip) or JSON stream fallback when archive is unavailable.
Content-DispositionHeaderInline filename for downloaded content.

Error Responses​

Status Code: 400 Bad Request

{
"result": "Missing filename"
}

Status Code: 400 Bad Request

{
"result": "Export doesn't exist"
}

Status Code: 400 Bad Request

{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}

Status Code: 401 Unauthorized

{
"result": "No app_id provided"
}

Behavior​

Behavior Modes​

ModeTriggerProcessing PathResponse Shape
Archive streamExport archive exists in GridFSStreams appUser_...tar.gz content from GridFS bucket.HTTP stream response (non-JSON body)
Exports collection fallbackArchive size resolves to 0Streams rows from countly.exports as JSON documents.HTTP stream response (JSON stream)
Task-ID resolutionid is a task IDLooks up task result, maps to export filename, then runs archive/fallback flow.Same as stream modes above

Response Header Notes​

  • The fallback JSON stream branch still sends Content-Type: application/x-gzip in current implementation.
  • Consumers should treat fallback payload as JSON stream by body format, not only by content-type header.

Operational Considerations​

  • This endpoint returns streamed file/content output, not standard JSON success payloads.
  • Download behavior depends on export storage state (archive stream first, then JSON-stream fallback).
  • Long-running exports should be completed first; if a task ID is used, result mapping must exist.

Limitations​

  • Successful response is file/stream output, not a standard JSON payload.
  • Fallback JSON stream uses a legacy gzip content-type header.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuthentication and permission validationReads member identity and app-level read permissions.
countly.long_tasksTask ID to export name resolutionReads task result data when download id is a task ID.
countly.exportsFallback download sourceStreams export rows when archive file is unavailable.
countly_fsArchive storageReads export archive from GridFS appUsers bucket.