Skip to main content

Overview

Use the merchant Task APIs when an export may contain more records than a normal list response. UniBee creates the export asynchronously, processes all result pages internally, and exposes the finished file through an authenticated download URL. The workflow uses these endpoints: All four requests must use the same merchant API key.

Authorization and hosts

Send the merchant API key as a Bearer token:
API-key export tasks are isolated from Admin Portal member tasks. An API key can list and download only API-created tasks for its merchant; it cannot access a member’s export tasks or another merchant’s data.

Complete export workflow

1. Get available columns (optional)

Call this endpoint when you want to let users choose columns or need the exact accepted values for exportColumns:
The response includes:
  • columns: values accepted by exportColumns.
  • columnHeaders: default display header for each column.
  • columnComments: additional column descriptions when available.
  • groupColumns: columns grouped by subject.
Omit exportColumns when creating a task to export every available column.

2. Create an export task

Do not put page or count in payload. The export service reads all pages internally.
new_export confirms that the task was accepted but does not return a task ID. Poll task/list and identify the newly created item by its taskName, payload, and createTime. If the same API key creates identical exports concurrently, serialize those requests or compare the task IDs returned before and after creation.

3. Poll task status

Each item in data.downloads contains the task details. Poll with a reasonable interval, such as 2–5 seconds, and stop when the task reaches status 2 or 3. Use exponential backoff for long-running exports.

4. Download the file

The downloadUrl is protected. Send the same API key in the download request:
Do not treat downloadUrl as a public or presigned URL. A request without the authorization header is denied.

How payload works

payload is a JSON object, not a JSON-encoded string. Its fields correspond to filters consumed by the selected export task. These export-only fields are available for all task types: Timestamp filters are Unix timestamps in seconds. By default, UniBee uses them exactly as supplied; timeZone changes exported timestamp display and does not change the filter range. Amount filters such as amountStart and amountEnd use the currency’s smallest unit, for example 1000 means USD 10.00. For filters using planTagFilter, pass:
mode can be any or all and defaults to any. When planIds and planTagFilter are both present, they are combined with union/OR semantics.

Available export tasks and filters

Only the fields listed for each task below are consumed by that export implementation. Unknown payload fields are ignored.

SubscriptionExport

Exports subscriptions. Its filters correspond to GET|POST /merchant/subscription/list. Example—active USD subscriptions:

InvoiceExport

Exports invoices. Its filters correspond to GET|POST /merchant/invoice/list. Example—paid invoices created during January 2026:

UserExport

Exports users. Its filters correspond to GET|POST /merchant/user/list.

TransactionExport

Exports payment and refund timeline records. Its filters correspond to GET|POST /merchant/payment/timeline/list.

DiscountExport

Exports discount codes. Its filters correspond to GET /merchant/discount/list.

UserDiscountExport

Exports usage records for one discount code. Its filters correspond to GET /merchant/discount/user_discount_list. Example:

PlanExport

Exports plans. Its filters correspond to GET|POST /merchant/plan/list.

MetricEventExport

Exports billable metric events. Its filters correspond to GET|POST /merchant/metric/event_list.

UserChurnExport

Exports churn episodes. Its filters correspond to GET|POST /merchant/user_churn/list.

Error handling

For JSON API errors, check both the HTTP status and the response envelope’s code and message. Log requestId when contacting UniBee support.