API reference
await fetch("https://app.loops.so/api/v1/contacts/create", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
email: "[email protected]",
firstName: "John",
lastName: "Doe",
}),
});
API reference
await fetch("https://app.loops.so/api/v1/contacts/create", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
email: "[email protected]",
firstName: "John",
lastName: "Doe",
mailingLists: {
"<mailing-list-id>" => true
},
}),
});
When updating a contact you must provide an email
or userId
value to identify the contact.
You can use the “update” endpoint to update or create contacts. If the provided email or user ID does not exist, a new contact will be created.
API reference
await fetch("https://app.loops.so/api/v1/contacts/update", {
method: "PUT",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "[email protected]",
planName: "Pro",
}),
});
For this the contact will need to already have a userId
value set.
API reference
await fetch("https://app.loops.so/api/v1/contacts/update", {
method: "PUT",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
userId: "12345",
email: "[email protected]",
}),
});
API reference
await fetch("https://app.loops.so/api/v1/contacts/update", {
method: "PUT",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "[email protected]",
mailingLists: {
"<mailing-list-id>" => true
},
}),
});
This removes a contact from a specific mailing list. See below to see how to fully unsubscribe a contact.
Use false
to unsubscribe a contact from a mailing list.
API reference
await fetch("https://app.loops.so/api/v1/contacts/update", {
method: "PUT",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "[email protected]",
mailingLists: {
"<mailing-list-id>" => false
},
}),
});
Set subscribed
to false
to unsubscribe a contact. The contact will no longer receive campaign or loop emails, but will remain listed in your audience.
API reference
await fetch("https://app.loops.so/api/v1/contacts/update", {
method: "PUT",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "[email protected]",
subscribed: false,
}),
});
You can delete contacts by email or user ID.
API reference
await fetch("https://app.loops.so/api/v1/contacts/delete", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "[email protected]",
}),
});