Skip to main content

Cancelling a session

You can cancel a verification session at any time before it is complete.

DELETE/api/v1/verifications/{id}Complete session cancellation contract: the 204 response and error codes.Full contract in the API Reference

Endpoint

DELETE /api/v1/verifications/{id}

After the call, the session status is set to expired. On success, the endpoint returns 204 No Content.

Example

curl -X DELETE https://hub.dpay.pl/api/v1/verifications/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H "Authorization: Bearer deid_live_xxx"

Response: HTTP/1.1 204 No Content with an empty body.

Terminal states

warning

A session in a terminal state (completed, failed, expired) cannot be cancelled. An attempt returns 409 Conflict with the SESSION_ALREADY_TERMINAL code.

Error example

{
"error": {
"code": "SESSION_ALREADY_TERMINAL",
"message": "Cannot cancel a verification session that is already completed, failed, or expired."
}
}

When should I cancel a session?

Common use cases for DELETE /verifications/{id} include:

  • The customer abandoned the process - they closed the window before completing verification
  • Order cancellation - the customer cancelled an order or application in your system
  • Fraud detection - you need to stop verification immediately
  • Cleanup - removing test sessions after E2E tests

Webhook after cancellation

Cancelling a session generates a verification.expired webhook for the configured endpoints. See Webhooks - Events.

Alternative - wait for the TTL

If you do not need to close the session immediately, you can wait for it to expire automatically after its TTL: 30 minutes for identity_verification or 60 minutes for account_data. See Lifecycle - Session TTL.