Sessions
Simulate a session
Ends a sandbox session with the outcome you choose. Sandbox keys only.
POST
/api/v1/sessions/{session_id}/simulate
Ends a sandbox session with the outcome you choose, as if the person had finished on their phone. Its webhook is sent. Sandbox keys only. See Sandbox.
link
Authorization
Authorization
string
header
required
A sandbox key, as Bearer kyc_sandbox_..., with the sessions:create scope.
session_id
string
path
required
The sandbox session's id.
outcome
string
required
clear, consider, rejected or error.
link
Response
Returns 200 OK with the ended session object, "sandbox": true.
| Status | Code | When |
400 | VALIDATION_ERROR | outcome is missing or not one of the four |
401 | AUTHENTICATION_ERROR | Missing, invalid or revoked key |
403 | AUTHORIZATION_ERROR | A live key, or one without sessions:create |
404 | NOT_FOUND | No such sandbox session on your account |
410 | SESSION_ENDED | The session has already ended |
cURL
curl -X POST https://www.kaywhysee.com/api/v1/sessions/$SESSION_ID/simulate \
-H "Authorization: Bearer $KAYWHYSEE_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{"outcome": "consider"}'
Node.js
const response = await fetch(
`https://www.kaywhysee.com/api/v1/sessions/${sessionId}/simulate`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAYWHYSEE_TEST_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ outcome: "consider" }),
},
);
const session = await response.json();
Python
session = requests.post(
f"https://www.kaywhysee.com/api/v1/sessions/{session_id}/simulate",
headers={"Authorization": f"Bearer {os.environ['KAYWHYSEE_TEST_KEY']}"},
json={"outcome": "consider"},
timeout=10,
).json()
Was this page helpful?
Thanks for letting us know.