Create a contact

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",
  }),
});

Create a contact and add them to a mailing list

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
    },
  }),
});

Update a contact

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",
  }),
});

Update a contact’s email address

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]",
  }),
});

Subscribe a contact to 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>" => true
    },
  }),
});

Unsubscribe a contact from a mailing list

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
    },
  }),
});

Unsubscribe a contact

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,
  }),
});

Delete a contact

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]",
  }),
});