Skip to main content

Export Account and User Fields

Zuora

Export Account and User Fields

You can use the Export API to export fields for Insights accounts or users. Exported data is available for download in CSV format. See Check Export Status for more information.

Insights does not export archived attributes or metrics.

You can restrict the export to the accounts or users in particular segments.

Prerequisites

Before you can export fields, you must have obtained the export token for your Insights stream.

Submit a request at Zuora Global Support if you do not know the export token for your Insights stream, or if you would like Zuora to generate a new export token for your Insights stream. Zuora Global Support will send the export token to a confirmed Insights administrator. See Global Support Scope for Insights for more information.

If you request a new export token, the previous export token will no longer be honored.

The export token for your Insights stream is different from the stream token that enables you to embed Insights account profiles in your application.

Request

POST https://nw1.api.insights.zuora.com/api/export/type/{type}

Request URL Fields

Specify the following fields in the request URL.

type required

The type of fields to export. One of the following values:

  • ACCOUNT

  • USER

Request Header Fields

Specify the following fields in the request header.

Authorization required

HTTP Basic Authorization header. The Basic Authorization username is the export token for your Insights stream. The Basic Authorization password is the empty string.

Request Body Fields

fields optional

Array of fields to export.

You can use List Attributes and List Metrics to obtain the field names of the attributes and metrics that are available for export.

Insights does not export archived attributes or metrics. Attempting to export an archived attribute or metric causes an error when you use Check Export Status to obtain the URL of the exported CSV file.

Insights always includes the External_id field when exporting account fields. The value of External_id identifies the account. Insights always includes the User_id field when exporting user fields. The value of User_id identifies the user.

If you do not specify any fields, Insights exports all available attributes and metrics.

Type: serialized JSON array

segments optional

Array of unique IDs of account segments, or array of unique IDs of user segments. Use List Segments to obtain unique IDs of segments.

Insights exports fields for the accounts or users in the specified segments only. Do not specify more than 50 segments.

If you do not specify any segments, Insights exports fields for all accounts or users.

Type: serialized JSON array

Response

The response body contains a JSON object with the following fields:

status

The status of the request. The value SUCCESS does not necessarily mean that the export will complete successfully. See Check Export Status for more information

message

The request failure message, if applicable.

uuid

The unique ID of the export.

Use the unique ID with Check Export Status to obtain the URL of the exported CSV file.

Examples

Example Request (cURL)

curl -X POST --user kSMGjTOJFqnLdNFqPLLmvwFHjKjarLN: \
https://nw1.api.insights.zuora.com/api/export/type/ACCOUNT \
-H 'Content-Type: application/json' \
-d '{"fields":["account_balance","total_reports_viewed_per_user_week","avg_payments_last_12_months","avg_refunds_last_12_months","avg_payments_last_36_months"], "segments":["2ebfe8cc-6ea3-42b9-8db8-38ef2cd2c8f8","8ba9e914-7cb3-4494-bf93-be366faf7806"]}'

Example Success Response (JSON)

{
  "status":"SUCCESS",
  "message":null,
  "uuid":"6a5ba27c-0ff4-4c6c-aa40-cc4cb5a79d50"
}

After receiving a successful response, you must use Check Export Status to obtain the URL of the exported CSV file. The request URL contains the value of uuid. For example:

curl -X GET --user kSMGjTOJFqnLdNFqPLLmvwFHjKjarLN: \
https://nw1.api.insights.zuora.com/api/export/status/6a5ba27c-0ff4-4c6c-aa40-cc4cb5a79d50

The signedUrl field in the response contains the URL of the exported CSV file. For example:

{
  "uuid":"6a5ba27c-0ff4-4c6c-aa40-cc4cb5a79d50",
  "status":"COMPLETE",
  "signedUrl":"https:\/\/zinsights-zin-prod-bulk-export.s3-us-west-2.amazonaws.com\/6a5ba27c-0ff4-4c6c-aa40-cc4cb5a79d50.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20161208T203541Z&X-Amz-SignedHeaders=host&X-Amz-Expires=432000&X-Amz-Credential=AKIAITWQQQSCPFAFTO2Q%2F20161208%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=18c76fa2cdac4ad11a9dd7b378d34f86e02gg5b523df993c28be4f9b6db64ec1",
  "expiration":"1481661341003"
}

 The URL of the exported CSV file expires 120 hours after the time of file generation.