How Can I Cancel or Manage Veriff Sessions Using the API?
Managing sessions effectively is crucial for maintaining a clean and efficient system when using the Veriff platform. Canceling unnecessary sessions helps prevent duplicates and ensures only active sessions are in use. Here, we explain the primary methods available for session cancellation using the Veriff API and outline alternative approaches.
Canceling Sessions with the Veriff API
Veriff provides a dedicated Cancel Session endpoint that allows you to programmatically terminate any active or pending session. This tool ensures:
Removal of expired, abandoned, or unsuitable sessions
A clean and efficient set of active sessions
Prevention of accidental duplicate verifications
To use this feature, all you need is the unique session ID of the session you wish to cancel. Once the cancellation request is made, that session is no longer usable.
Why Should You Cancel Sessions?
Canceling unnecessary sessions helps avoid clutter in your session management system and maintains operational efficiency. Typical use cases include:
Sessions that have expired
Sessions that were abandoned
Sessions created in error or deemed unsuitable for further use
This ensures your list of active sessions includes only those currently needed.
Manual Options for Session Management
While the API cancellation endpoint is the recommended and scalable approach, there is a manual method for managing sessions under specific circumstances. For example, you can force a session into a resubmission_requested state to create a new attempt. However, this method:
Is not as scalable as programmatic solutions
Should primarily be reserved for exceptional scenarios
Generally, it’s advisable to create a new session only after ensuring the previous one is either canceled or has expired to avoid potential session misuse.
Summary
By leveraging the Cancel Session endpoint in the Veriff API, managing session lifecycles becomes seamless and efficient. While manual methods offer some flexibility, they are less scalable and should only be used for unique cases. For long-term scalability and ease of use, always rely on the built-in API functionalities for session management.