Data Sources & API

How to connect a data source to your own API

Last updated

With a connected API data source, Sendtric calls your API to get a subscriber's data when their email is opened. Nothing is copied into Sendtric, so images show whatever your API returns at that moment, like a live order status or today's account balance.

If you'd rather push data to Sendtric ahead of time, see how to send records with the Sendtric API.

What your API needs

  • An HTTPS URL that's reachable from the public internet.
  • A way to ask for one record by its identifier, in the path or a query parameter. For example https://api.example.com/customers/12345.
  • A JSON response with the record's fields, such as {"first_name": "Sarah", "points": 1250}.
  • A quick reply: Sendtric waits up to 5 seconds, and the response must be under 1 MB.

Set it up

  1. In the left sidebar, click Data sources, then New data source.
  2. Under API, choose API and click Continue.
  3. Choose Retrieve data from an API and click Continue.
  4. Fill in Data source name, Unique identifier field (for example customer_id) and, if you like, Description.
  5. Choose the Method: GET or POST.
  6. Enter your API URL and put {{uid}} where the identifier goes, for example https://api.example.com/customers/{{uid}}. Sendtric replaces {{uid}} with each subscriber's identifier.
  7. Add any Headers your API needs, like Authorization with your API token. Click + Add for each one.
  8. Add any Query parameters. If your API takes the identifier as a parameter, put {{uid}} in its value instead of the URL, for example id = {{uid}}.
  9. Enter a real identifier in Test unique identifier value and click Test API.
  10. Check the response, then click Save data source.
The Retrieve data from an API settings with a URL containing {{uid}}, an Authorization header, a test value and a successful test response

Save data source stays disabled until the test succeeds and the response contains at least one field. If you change the URL, method, headers or parameters, test again.

Use a test endpoint or a dedicated, read-only API token. Sendtric keeps header values secret after saving, so you'll need to re-enter one to change it.

How lookups work

  • Each lookup sends one request to your API for one subscriber.
  • Identifiers are sent exactly as the merge tag fills them in, so upper and lower case matter if your API cares about them.
  • Sendtric keeps a generated image for the Cache time you set in the image editor (2 to 60 minutes), so repeated opens don't call your API every time.
  • If your API is slow, returns an error or has no record for the identifier, the value is treated as empty. In a personalized image, that layer is hidden, so design the image to still look right without it.

Change the connection

In Data sources, click the data source to open its settings. You can change the URL, method, headers and parameters, then run Test API again before saving.

Next step

Was this article helpful?

Click the image to zoom in. Drag or scroll to look around.