REST API (0.0)

📘

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 the 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.

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.

Once this secret has been generated, you can use it to create JWTs on your own. The JWT secret that Usersnap creates is a shared secret between Usersnap and you, which is used to sign the JSON Web Tokens (JWTs) generated by you. This secret is used to verify the authenticity and integrity of the JWTs sent by you when making API requests to Usersnap.

For more information on JWTs, please check out the auth0 guide.

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