Add to a list
Add one or more values to a list. Values must match the kind of list: a user list takes the user IDs your application uses, an IP list takes IP addresses, an email list takes email addresses, and so on. A value that is already in the list is updated rather than duplicated. The change applies to the next evaluation.
Parameters
id string REQUIRED
The ID of the list, from its URL in the dashboard. The list must belong to the same environment as your project secret.
value string
A single value to add. Pass either value or values.
values array of strings
Up to 500 values to add in one call. Pass either value or values.
comment string
A note stored on every value added in this call, shown in the dashboard.
ttl integer
Remove these values automatically after this many seconds. Leave it out to use the list's default expiry. If the list has no default, the values stay until you remove them.
Returns
Returns how many values were added, how many already existed and were updated, and the list's total number of active values. Returns
404 when the list doesn't exist in the environment your project secret belongs to.
const result = await rupt.addToList({
list: "LIST_ID",
values: ["USER_ID", "ANOTHER_USER_ID"],
comment: "Chargeback on order 4821",
ttl: 2592000,
});
{
"added": 2,
"updated": 0,
"total": 14
}