Skip to main content

Create a Session

Here is a simple flow needed to get the redirect URL for the check-in:

Getting the Okaya Request URL

Endpoints

POST /session/create

Parameters

  • groupID: This is the group ID of the group that the user is associated with. Note that you have to create a group before the first check-in.
  • groupKey: The group key is associated with the group that you created.
  • userIdentifier: For the first session, you need to provide the user email. For subsequent sessions, you will have to provide the user ID. The user ID will be provided in the response of a session creation and through a webhook.
  • returnURL: This is the URL that the user will be redirected to when their check-in is completed. Please make sure the redirect URL is an HTTPS endpoint as we will not redirect to HTTP or localhost.

Example Call

await fetch("https://api.okaya.me/session/create", {
method: "POST",
headers: {
"x-api-key": "YOUR API KEY",
},
body: JSON.stringify({
groupID: 123456,
groupKey: "YOUR GROUP KEY",
userIdentifier: "THE PARTICIPANT EXTERNAL ID OR THE PARTICIPANT EMAIL",
returnURL: "https://www.mysiteredirect.com",
}),
});

Example Response

200

{
"success": true,
"message": "Redirect URL generated successfully.",
"userIdentifier": "ok_123dsf",
"redirectUrl": "https://mindcheck.okaya.me/integrationUser/embedded-mhci-checki...",
"sessionID": "abcd1234"
}

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

401: Unauthorized