Sessions

Cancel a session

Cancels a session that hasn't ended.

POST /api/v1/sessions/{session_id}/cancel

Cancels a session that hasn't ended. Its link stops working at once and its status becomes cancelled. Use it when a customer closes their account, or you no longer need them to verify.

link Authorization

Authorization string header required

Your secret key, as Bearer kyc_live_.... The key needs the sessions:cancel scope.

link Path

session_id string path required

The session's id.

link Response

Returns 200 OK with the cancelled session object.

link Errors

StatusCodeWhen
401AUTHENTICATION_ERRORMissing, invalid or revoked key
403AUTHORIZATION_ERRORThe key doesn't have the sessions:cancel scope
404NOT_FOUNDNo such session on your account
410SESSION_ENDEDThe session has already ended: decided, expired or cancelled
cURL
curl -X POST https://www.kaywhysee.com/api/v1/sessions/$SESSION_ID/cancel \
  -H "Authorization: Bearer $KAYWHYSEE_API_KEY"
Node.js
const response = await fetch(
  `https://www.kaywhysee.com/api/v1/sessions/${sessionId}/cancel`,
  {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.KAYWHYSEE_API_KEY}` },
  },
);
const session = await response.json();
Python
session = requests.post(
    f"https://www.kaywhysee.com/api/v1/sessions/{session_id}/cancel",
    headers={"Authorization": f"Bearer {os.environ['KAYWHYSEE_API_KEY']}"},
    timeout=10,
).json()
200
{
  "id": "a841ce23-0c9d-42a4-ba95-3e7e17a1407b",
  "reference": "user_1042",
  "status": "cancelled",
  "outcome": null,
  "reasons": [],
  "reviewed": false,
  "review": null,
  "retry_session_id": null,
  "retry_of": null,
  "checks": {},
  "document_type": null,
  "document_country": null,
  "captures": {},
  "created_at": "2026-10-15T12:10:11Z",
  "expires_at": "2026-10-16T12:10:11Z",
  "submitted_at": null,
  "decided_at": null
}
410
{
  "success": false,
  "data": null,
  "error": {
    "code": "SESSION_ENDED",
    "message": "This session is already cancelled."
  }
}
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.