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.

link Path

session_id string path required

The sandbox session's id.

link Body

outcome string required

clear, consider, rejected or error.

link Response

Returns 200 OK with the ended session object, "sandbox": true.

link Errors

StatusCodeWhen
400VALIDATION_ERRORoutcome is missing or not one of the four
401AUTHENTICATION_ERRORMissing, invalid or revoked key
403AUTHORIZATION_ERRORA live key, or one without sessions:create
404NOT_FOUNDNo such sandbox session on your account
410SESSION_ENDEDThe 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?

Authorization

Your secret key stays in this tab: it is sent with this request only and never stored.

Body application/json

Response

Send the request to see the response.