Lukas Lunow
Lukas Lunow

Reputation: 577

Add custom column names to Sendgrid list through API

I have tried using SnedGrid Marketing Email API for creating lists: https://sendgrid.com/docs/API_Reference/Marketing_Emails_API/lists.html#-add

It works fine when creating a list with default columns, but I simply cannot find the right format for sending additional column names (e.g. user_id) I have tried the "default" columnname=foo, and few other variations, but end up each time with only default columns, despite the reponse telling me about how succesful I am:

{"message": "success"}

Upvotes: 1

Views: 659

Answers (1)

Nick Q.
Nick Q.

Reputation: 3986

This seems to be a documentation issue on our end. First, let me deeply apologize for the inconvenience, this will be fixed shortly.

Custom column names do not show up upon list creation. Only once an email has been added with a new column will that show up. However, this means you may arbitrarily add columns as necessary.

To create an email with any additional columns you may want, you'll use the Add Email Endpoint, as such:

curl -X POST https://api.sendgrid.com/api/newsletter/lists/email/add.json \
     -d data={"email" : "[email protected]", "name" : "Nick", "favorite" : "Loon"}

This call will create a new column named favorite.

Upvotes: 2

Related Questions