Skip to main content

In short

  • Patient-scoped calls without a live ABHA Gateway session return HTTP 491.
  • Check the session with Status, and renew it with Init and Verify on a mobile OTP.
  • Once the session is live, retry the call that returned 491.

When to use this

Registering or creating an ABHA opens a session for the patient with the ABHA Gateway. Whether logging in also opens one is not yet confirmed. The session expires after a period. Patient-scoped calls made without a live session return HTTP 491. Run this workflow before a patient-scoped call such as fetching the profile, and whenever a call returns 491. This workflow renews a session for a patient whose ABHA you already hold. To find or create the ABHA in the first place, use Log in to an existing ABHA or one of the create workflows.

Before you start

  • A client access token, sent as a Bearer token on every call. See Client login.
  • The patient’s oid and abha_address, stored when the ABHA was created or the patient logged in. Session Status needs the oid in the X-Pt-Id header.
  • Access to the patient’s phone for the mobile OTP.

Sequence

Steps

1

Check the session

Call Status with the patient’s oid in the X-Pt-Id header. The response carries logged_in, kyc_verified and hpr_id.
  • logged_in is true: the session is live. Continue with the patient-scoped call you were about to make.
  • logged_in is false: renew the session with the next two steps.
2

Send the mobile OTP

Send the patient’s abha_address to Init, with the oid in the X-Pt-Id header or the oid query parameter. An OTP goes to the patient’s mobile. The response carries txn_id.
3

Verify the OTP

Send txn_id and otp to Verify, with the same oid. The response carries token, the user’s access token, and refresh_token. The session is live again. Retry the call that returned 491.

State you must persist

When it fails

Which of these codes each call returns is not yet confirmed. The codes come from the errors page, matched by meaning. Log the code you actually receive.
Error responses carry code, error and source_error. source_error.code holds codes such as MIS-1013. See Error codes.

Test it

The testing page has the sandbox base URL, credentials and the happy path for every journey. Run against the sandbox base URL https://api.dev.eka.care, with an ABHA you created on sandbox.
  • Straight after creating an ABHA, Session Status returns logged_in: true.
  • After the session expires, Session Status returns logged_in: false. Session Init and Session Verify return a token; Session Status returns logged_in: true again.
  • A patient-scoped call such as Profile Details returns 491 on an expired session and succeeds after renewal.
  • Wrong OTP on Session Verify: MIS-1013. Record the code you receive; the expected code is not confirmed.