REST API

<aside> ⚠️ Your Loops API key should never be used client side or exposed to your end users.

</aside>

Authentication

To get started, you’ll need an API key. Visit the Loops settings page and click “Generate new key”:

Screen Shot 2022-02-09 at 10.50.03 PM.png

This creates an API key. You can assign it a human-readable name:

Screen Shot 2022-02-09 at 10.51.33 PM.png

We suggest using a different API key for different purposes. You can revoke an API key at any time with the trash icon.

When making an API call, add an Authorization header and set the API key as a Bearer token:

Screen Shot 2022-02-09 at 10.54.32 PM.png

You can test your API key by making a GET request to https://app.loops.so/api/v1/api-key. If successful, you will receive { "success": true }

As a Curl request (replace d2d561f5ff80136f69b4b5a31b9fb3c9 with your own API key):

curl <https://app.loops.so/api/v1/api-key> -H "Accept: application/json" -H "Authorization: Bearer d2d561f5ff80136f69b4b5a31b9fb3c9"

Contacts

Add

You can add contacts to your Loops audience by making a POST to the https://app.loops.so/api/v1/contacts/create endpoint. You can submit the following object for the body:

{
    "email": "[email protected]",
    "firstName": "Adam",
    "lastName": "Kaczmarek",
    "favoriteColor": "blue",
    "userGroup": "Founders",
    "source":"Signup form Service"
}

The only required field is “email”. If there is already a contact with this email, the request will fail. You can add additional fields as you need for the contact (favoriteColor is not a standard field).

Update

You can update contacts to your Loops audience by making a PUT to the https://app.loops.so/api/v1/contacts/update endpoint. You can submit the following object for the body: