📘

Only for Enterprise plans

This REST API is currently only available for customers with Enterprise plans. If you are not sure where you can find the details on the REST API, please contact our customer success team.

Usersnap provides a way for you to use platform's capabilities via a REST API. To begin with, you need to make sure that you're part of a plan that allows you to do that. Once you're a part of such a plan, you'll see an option to configure Rest API under settings, as shown below.

SettingsSettings

Settings

Usersnap uses Bearer authentication to protect its API endpoints. To be able to make requests to the platform API, you'll first need to generate a JWT secret on Usersnap.

Rest API PageRest API Page

Rest API Page

Once this secret has been generated, you can use it to create JWTs on your own. The header of the JWT needs to contain a kid field whose value is the JWT ID generated on Usersnap. The JWT header would look like this:

{
    "alg": "HS256",
    "typ": "JWT",
    "kid": "<JWT ID>
}

🚧

Please, use HS256 as algorithm

Don't use HS512.

Finally, you must send this JWT as a bearer token in the Authorization header when making requests to Usersnap's API endpoints.

API documentation can be accessed here.

Example call for the REST API

This is an example request on how you can post data via a CURL call. Is this how you can use it in your application and send feedback without using the feedback widgets.

# submit a feedback
curl -H "Authorization: Bearer <JWT-token>" \
     -H "Content-Type: application/json" \ 
     -d '{"visitor":"[email protected]", "comment":"this is my comment", "custom": "{\"user_id\": 45612, \"user_hash\": \"cafeaffe-dead-4eef\"}"}' \
     https://platform.butterhaserl.com/v0.0/projects/<api-key>/feedbacks

Did this page help you?