The most common use case for the Sohar API is to determine the eligibility status and healthcare benefits for a patient. In this tutorial we will create a verification request to Aetna in the sandbox environment.

1

Get Access Token

Create a client ID and client secret for the sandbox environment in the Sohar dashboard and use them to get an access token.

const response = await axios.post(
	'https://api.soharhealth.com/oauth/token',
	{
		client_id: process.env.SOHAR_CLIENT_ID,
		client_secret: process.env.SOHAR_CLIENT_SECRET
	}
);

const accessToken = response.data.access_token;
2

Create Verification

Call the Create Verification API using your access token.

const response = await axios.post(
	'https://api.soharhealth.com/v2/verifications',
	{
		patient: {
			firstName: 'John',
			lastName: 'Doe',
			dateOfBirth: '09/20/2006',
			state: 'CA',
			memberId: '00000000'
		},
		payerId: '60054',
		placeOfServiceCode: '10',
		specialtyCode: 'PSY'
	},
	{
		headers: {
			'Authorization': `Bearer ${accessToken}`
		}
	}
);

const verificationId = response.data.verificationId;
3

Get Verification

Call the Get Verification API with the verificationId to get the response. Note that it can take some time to deliver the response - you can either poll the endpoint or subscribe to webhook events.

const response = await axios.get(
	`https://api.soharhealth.com/v2/verifications/${verificationId}`,
	{
		headers: {
			'Authorization': `Bearer ${accessToken}`
		}
	}
);