1. Home
  2. Extra
  3. Samba API
  4. Export Customer Subscription Status via API

Export Customer Subscription Status via API

Contents

This post is also available in: Czech

With this API, you can sync the customer subscription status to a newsletter in Samba with your system. You can retrieve the entire list or just the changes (only the customers who have changed the subscription level of the newsletter in the interval <from, now>). You can also choose whether you only require subscribed or unsubscribed customers. The data provided in the request response are updated with respect to the last data synchronization in Samba. All customers in Samba are included – from the customers feed, imported customers, and collected subscribers from popups.

Endpoint URL

Depending on your account, select the appropriate endpoint URL.

  • If you are logging in at app.samba.ai –> choose the URL api.samba.ai
  • If you are logging in at enterprise.samba.ai –> choose the URL api.yottly.com

Your account ID can be found in the Settings section as part of your unique tracking script.

GET

https://api.samba.ai/shop/sambaId/subscriptions?from=YYYY-MM-DD&state=subscription_state
header: X-Api-Key: your-api-key
  • sambaId – Samba ID of your e-shop
  • your-api-key – Samba API key for your e-shop
  • from – [optional] the date in YYYY-MM-DD format (time is set to 00:00). If this parameter is omitted, the entire history will be exported.
  • state – [optional] select from “subscribed” or “unsubscribed”. If you omit this parameter, all login states will be exported.

RESPONSE

JSON format – stream, one json object per line (application/json-seq):

{"customerId":"XYZ123", //ID of Customer
  "email":"xyz123@samba.ai", // Customer's email address
  "newsletterFrequency":"every day", //Customer's current subscription preferences: "every day"/"special occasions" = subscribed, "never" = unsubscribed
  "since":1526481188957 //time (in milliseconds) since subscribing
}

EXAMPLE

curl -H 'X-Api-Key: key' 'https://api.samba.ai/shop/4541245641234564/subscriptions?from=2018-04-19'
{"customerId":"XYZ123","email":"xyz123@samba.ai","newsletterFrequency":"every day","since":1526481188957}
{"customerId":"ABC123","email":"abc123@samba.ai","newsletterFrequency":"never","since":1526481188957}
{"customerId":"XAZ1R3","email":"xaz1r3@samba.ai","newsletterFrequency":"every day","since":1526481188957}
curl -H 'X-Api-Key: key' 'https://api.samba.ai/shop/4541245641234564/subscriptions?from=2018-04-19&state=subscribed'
{"customerId":"XYZ123","email":"xyz123@samba.ai","newsletterFrequency":"every day","since":1526481188957}
{"customerId":"XAZ1R3","email":"xaz1r3@samba.ai","newsletterFrequency":"every day","since":1526481188957}

This post is also available in: Czech

Updated on January 20, 2022

Was this article helpful?

Related Articles