Create your NexHealth Developer Portal Account and generate your test API key. Then you can make a POST request to /authenticates
passing your key in the Authorization
header. The response will contain a bearer token which is valid for 1 hour. You must use this bearer token to access all other API routes. In other words, all calls except the authenticates and institutions calls requires a bearer token.
The bearer token is a JSON Web Token. You can read more about JSON Web Tokens here, and find libraries for working with them here.
All unauthenticated requests will return a 401
status code.
You can see an example request to /authenticates
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 result in 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 make sure you add the string "Bearer" to your authentication headers as shown below.
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwic2NwIjoiYXBpX3VzZXIiLCJpYXQiOjE2Mjg3NDMyNzksImV4cCI6MTYyODc0Njg3OSwianRpIjoiNjYxNjY4YWYtMTZkYS00OWFhLTljM2ItNmI0MDNiOTQxZWExIn0.hzbAv-Bx8vhEMXM1sGmAa9tO3WzUyvgBN8aw4tdOrG0'
Please note that if you are using these documentation pages to make calls, you must add "Bearer" to the Authentication header as a prefix before the bearer token as shown below for the request to be accepted.