Link Search Menu Expand Document

Exporting users (bulk)

Overview

  • Call name: export
  • Endpoint URL: https://services-[API_ENVIRONMENT].spaaza.com/segments/export/users
  • Request methods: HTTP POST
  • Content-Type: application/json
  • Auth required: yes

You can use this API endpoint to search for users in Spaaza. The endpoint is accessed with a POST of simple JSON (see below for an example).

The API_ENVIRONMENT value for the endpoint URL varies according to whether the request is being made to Spaaza’s production or staging API:

Environment API_ENVIRONMENT value
Production prod
Staging test01

Headers

The following headers are required:

Header Description
X-Spaaza-Session-User-Id Spaaza ID of the user obtained from the login endpoint
X-Spaaza-Session-Key Session key obtained from the login endpoint
X-Spaaza-Session-Chain-Id the ID of the Spaaza chain or retailer

The following authentication methods are permitted:

Method Description
Admin A session generated by administrative user login.

JSON POST body (application/json)

The API accepts a payload of a simple piece of JSON containing information about the users requested in the export. An example is shown below:

{
    "entity":"people",
    "chain_id":1743,
    "join":"all",
    "rules":[]
}

The JSON in the POST should be exactly the same as the sample above, with the following exception:

Parameter Value/Description
chain_id (integer, required) The value should be the ID of the Spaaza chain or retailer for which users are being exported

Note that, in future, Spaaza expects to be able to expand the query syntax available in the endpoint, but at the current moment it is limited to downloading all users for a chain.

Response CSV file (text/csv)

Assuming a correct request, the endpoint streams a CSV file as a response. Note the following response headers:

Header Name Header Value
Content-Type text/csv
Content-Encoding gzip
Content-Disposition attachment;filename=spaaza-export.csv

The CSV file returned contains a header row with column names as follows:

ID,First name,Last name,email (username),Facebook email,Other email,Facebook ID,Gender,Birthday,Overall,Recency,Frequency,Monetary,Created date,Last login date,Last purchase date,Last loyalty activity date,Cashback Balance,Brands Purchased,Stores,Opted-in,Country,Sign-up store,Postal code,Town/City,Points Balance,Authentication Point ID,Mailing List Subscriber,Print Mailing List Subscriber,Loyalty Status Level,Average Spend Value,Days Since Last Purchase,Number of Purchases,Offline Shopper,Online Shopper,Region/State,House Number,House Number Extension,Address Line 2,Address Line 3,Phone Number,Street Name,Signup Channel,Spaaza Join Date,Spaaza User ID,Auxiliary Identifier,Opt in Secondary,Registered,Language,Points to Proceed to Next Status Level,Points to Remain at Current Status Level,Last Review Date of Loyalty Status,Next Review Date of Loyalty Status,Date Loyalty Status Level Reached,Subscribed to Push Notifications,Home Store Name,Home Store Owner Code,Referred,Referring User Id,Referring User Referral Code,User Referral Code,Employee,Last modified date,User channel identifier,User channel version,Push notification platform,Signup Store Code,Influencer

Please note that Spaaza appends adds new columns to the end of the export CSV file when they are introduced. If exporting programmatically your code should allow for increased numbers of columns and should recognise columns by their name rather than relying on them appearing in a fixed order.

Example Request & Response

Example request:

curl 'https://services-test01.spaaza.com/segments/export/users.csv' \
  -H 'X-Spaaza-Session-Chain-Id: 1783' \
  -H 'X-Spaaza-Session-Key: d7d91a80b5dd2cf040adc68bc2cb7974f0107dea35816bb3e14207444bf9e21a' \
  -H 'X-Spaaza-Session-User-Id: 1' \
  -H 'content-type: application/json' \
  --data-raw '{"entity":"people","chain_id":1743,"join":"all","rules":[]}' \
  --compressed

Example CSV file (first 3 rows):

ID,First name,Last name,email (username),Facebook email,Other email,Facebook ID,Gender,Birthday,Overall,Recency,Frequency,Monetary,Created date,Last login date,Last purchase date,Last loyalty activity date,Cashback Balance,Brands Purchased,Stores,Opted-in,Country,Sign-up store,Postal code,Town/City,Points Balance,Authentication Point ID,Mailing List Subscriber,Print Mailing List Subscriber,Loyalty Status Level,Average Spend Value,Days Since Last Purchase,Number of Purchases,Offline Shopper,Online Shopper,Region/State,House Number,House Number Extension,Address Line 2,Address Line 3,Phone Number,Street Name,Signup Channel,Spaaza Join Date,Spaaza User ID,Auxiliary Identifier,Opt in Secondary,Registered,Language,Points to Proceed to Next Status Level,Points to Remain at Current Status Level,Last Review Date of Loyalty Status,Next Review Date of Loyalty Status,Date Loyalty Status Level Reached,Subscribed to Push Notifications,Home Store Name,Home Store Owner Code,Referred,Referring User Id,Referring User Referral Code,User Referral Code,Employee,Last modified date,User channel identifier,User channel version,Push notification platform,Signup Store Code,Influencer
404097,tester,tester,tester8@spaaza.com,,,,male,1978-01-01,0,0,0,0,2018-09-04T00:47:41Z,2018-09-17T17:38:16Z,,2021-12-25T07:00:28Z,0,,,true,BE,,,,1200,,false,false,,0.00,,0,false,false,,,,,,,,mobile:ios,2018-09-04T00:47:41Z,1924688,,false,true,,,,,,,false,,,false,,,8ai1dr,false,2023-08-23T06:03:42Z,,,,,false
404098,Simon,Kroger,simon@example.com,,,,male,1979-01-01,0,0,0,0,2018-09-04T10:11:01Z,,,2021-12-25T07:00:28Z,0,,,true,NL,,,,1200,,false,false,,0.00,,0,false,false,,,,,,,,mobile:ios,2018-09-04T10:11:01Z,1924905,,false,true,,,,,,,false,,,false,,,p4q1ot,false,2023-08-23T06:03:42Z,,,,,false
404109,tester15,tester15,tester15@spaaza.com,,,,female,1990-02-01,0,0,0,0,2018-10-04T01:53:22Z,,,,0,,,false,,,,,0,,false,false,,0.00,,0,false,false,,,,,,123456789,,webshop,,1968163,,false,true,,,,,,,false,,,false,,,9tl3he,false,2023-08-23T06:04:19Z,,,,,false
404117,tester,tester,tester34@spaaza.com,,,,male,1990-02-15,0,0,0,0,2018-10-08T16:11:25Z,,,,0,,,false,BE,,,,0,,false,false,,0.00,,0,false,false,,,,,,123456,,webshop,,1974584,,false,true,,,,,,,false,,,false,,,o160uz,false,2023-08-23T06:03:42Z,,,,,false
404121,Britney,Spears,onemoretime@spaaza.com,,,,female,2003-04-04,0,0,0,0,2018-10-29T10:10:26Z,,,2022-03-28T07:00:28Z,0,,,true,NL,Amsterdam,1017CB,Amsterdam,1150,,true,true,,0.00,,0,false,false,Noord-Holland,504,,,,,Herengracht,unknown:spaaza-sales-associate-a,2018-10-29T10:10:26Z,2001121,,false,true,,,,,,,false,,,false,,,tf5qxd,false,2023-08-23T06:03:42Z,,,,10001,false