API Reference

Authenticates

The authenticates endpoint let's you access bearer tokens. You need this token to make API calls to all other endpoints. Sandbox tokens expire in 24 hours, and production tokens expire in one hour.

πŸ“˜

Json web tokens

NexHealth bearer tokens are JSON web tokens. You can read more about JSON Web Tokens here, and find libraries for working with them here.

To get a bearer token make a request like the one below.

curl --request POST \
     --url https://nexhealth.info/authenticates \
     --header 'Accept: application/vnd.Nexhealth+json;version=2' \
     --header 'Authorization: YOUR_API_KEY'

Successful authentication will yield a response containing a bearer token.

{
    "code": true,
    "data": {
        "token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwic2NwIjoiYXBpX3VzZXIiLCJpYXQiOjE2Mjg3NDMyNzksImV4cCI6MTYyODc0Njg3OSwianRpIjoiNjYxNjY4YWYtMTZkYS00OWFhLTljM2ItNmI0MDNiOTQxZWExIn0.hzbAv-Bx8vhEMXM1sGmAa9tO3WzUyvgBN8aw4tdOrG0"
    },
    "description": "Authenticated",
    "error": []
}

πŸ“˜

Using bearer tokens

Once you've received your bearer token, ensure sure you add the string "Bearer" followed by your token to all your authentication headers, as shown below.

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwic2NwIjoiYXBpX3VzZXIiLCJpYXQiOjE2Mjg3NDMyNzksImV4cCI6MTYyODc0Njg3OSwianRpIjoiNjYxNjY4YWYtMTZkYS00OWFhLTljM2ItNmI0MDNiOTQxZWExIn0.hzbAv-Bx8vhEMXM1sGmAa9tO3WzUyvgBN8aw4tdOrG0'