Testing
Testing your k-ID integration is essential to ensure it works correctly before going live. This guide covers testing strategies and tools available in the k-ID platform.
Test mode and live mode
k-ID provides two environments for testing and production:
Test mode
Test mode allows developers to test integrations without affecting real data or production systems. When using a Test Mode API key, requests are sent to the test environment at https://game-api.test.k-id.com. This environment is designed to simulate the live system but operates with mock data.
Live mode
Live mode is used for production. When using a Live Mode API key, requests are sent to the production environment at https://game-api.k-id.com. This environment processes real data and interacts with live systems.
Note: Always verify that you are using the correct API key and endpoint for the intended mode to avoid unintended impacts on production data.
Testing with the interactive API reference
Before writing code to call the k-ID API, you can test endpoints directly using the interactive API reference built into the documentation. Get your test API key from the Compliance Studio by going to the Developer Settings page of your product.
Set up API testing
-
Navigate to any endpoint page in the API Reference, for example the
/age-gate/checkendpoint. -
Select the Base URL: Hover over the Base URL field in the request interface to reveal an Edit button. Click the Edit button and select the Test environment (
https://game-api.test.k-id.com/api/v1/). -
Authenticate your request: Paste your test API key into the "Bearer Token" field.
-
Configure the request body: Modify the request body values as needed. For testing, use:
{
"jurisdiction": "US-CA",
"dateOfBirth": "2005-04-15"
} -
Send the request: Click "Send API Request" to complete the API call.
-
View the response: The response is displayed below the request interface, showing the API's response to your request.
You've now made a successful call to k-ID! For more detailed information about using the interactive reference, see the Interactive reference guide.
Testing trusted adult consent
To see the parent experience in Family Connect, you need to create a Consent Challenge. To do that, make another call to /age-gate/check using the interactive reference, this time with the age of a child below the age of digital consent in the US jurisdiction.
Use:
{
"jurisdiction": "US-CA",
"dateOfBirth": "2015-04-15"
}
This results in a response that looks like this:
{
"challenge": {
"challengeId": "<guid>",
"childLiteAccessEnabled": false,
"oneTimePassword": "<one time password>",
"type": "CHALLENGE_PARENTAL_CONSENT",
"url": "https://family.k-id.com/authorize?otp=<one time password>"
},
"status": "CHALLENGE"
}
You can then navigate to the URL in the url field in a browser. You are asked for an email address, and then receive an email with a link to Family Connect where you can grant consent to play the game. Once you finish the consent flow in the browser, you can call the challenge/get-status API with the challengeId field previously provided. The response is:
{
"approverEmail": "email@example.com",
"sessionId": "<guid>",
"status": "PASS"
}
You have now successfully created a k-ID Session! You can see it by supplying the sessionId field as a parameter to /session/get.
{
"ageStatus": "DIGITAL_MINOR",
"dateOfBirth": "2015-04-15",
"etag": "<guid>",
"jurisdiction": "US",
"permissions": [],
"sessionId": "<guid>",
"kuid": "<guid>",
"status": "ACTIVE"
}