You'll need to authenticate your requests to access any of the endpoints in the SentryPeer API. In this guide, we'll look at how authentication works. SentryPeer offers two ways to authenticate your API requests: Basic authentication and OAuth2 with a token — OAuth2 is the recommended way.

OAuth2 client credentials request

The only way to authenticate with the SentryPeer API is by using OAuth2. When establishing a connection using OAuth2, you will first need your client credentials, then you can request your access token — you will find your client credentials in the SentryPeer Settings section after creating a client. Here's how to request a token using cURL:

Example request to retrieve your bearer token

curl --request POST --url \
  --header 'content-type: application/json' \
  --data '{
            "client_id": "your_client_id",
            "client_secret": "your_client_secret",
            "audience": "",
            "grant_type": "client_credentials"

Always keep your client credentials safe and reset your client secret if you suspect it has been compromised. Better yet, create a new client and delete the old one.

Querying a Resource

Once you have requested your token (tokens are valid for 24 hours), you can start making requests to the SentryPeer API.

Example request with bearer token

curl{phone-number} \
  --header "Authorization: Bearer {your_token_from_previous_step}"