🎉 Unlimited Free KYC - Forever!!

Identity Verification
API Reference
Delete Session

Deleting a Verification Session

To delete a verification session, you can call the /v1/session/{sessionId}/delete/ endpoint.

  • Base URL: https://verification.didit.me
  • Endpoint: /v1/session/{sessionId}/delete/
  • Method: DELETE
  • Authentication: Client Token (Bearer Token)
⚠ī¸

The authentication endpoint uses a different base URL than the verification session endpoints. Ensure you use the correct URLs to avoid connectivity issues.

Request

Follow these steps to delete a verification session programmatically:

Step 1: Authenticate

Obtain a valid access_token by following the Authentication documentation. This token is required in the Authorization header of your request.

ℹī¸

The access_token is valid for 24 hours. You only need to re-authenticate once it expires.

Step 2: Prepare Request Parameters

ParameterTypeRequired?DescriptionExample Value
session_idstringYesThe unique identifier of the session to delete."11111111-2222-3333-4444-555555555555"

Step 3: Send the Request

Make a DELETE request to /v1/session/{session_id}/delete/ with the session ID in the URL path.

Example Request

DELETE /v1/session/11111111-2222-3333-4444-555555555555/delete/ HTTP/1.1
Host: verification.didit.me
Content-Type: application/json
Authorization: Bearer {access_token}

Response

A successful deletion returns a 204 No Content status code with no response body, indicating that the session was successfully deleted.

Error Handling

Status CodeErrorDescription
204SuccessSession successfully deleted. No content is returned.
401UnauthorizedInvalid or missing access_token.
403ForbiddenNot authorized to delete this session.
404Not FoundSession ID not found or invalid.

Example Error Response

{
  "detail": "You do not have permission to perform this action."
}

Session Deletion Use Cases

This endpoint is useful for:

  • Data Correction: Removing sessions created with incorrect data
  • Privacy Compliance: Facilitating data deletion requests from users
  • Test Cleanup: Removing test sessions from your development environment
  • Error Remediation: Resolving duplicate or corrupted sessions
⚠ī¸

Session deletion is permanent and cannot be undone. All associated verification data will be permanently removed.

Code Examples

const deleteSession = async (sessionId) => {
  const endpoint = `https://verification.didit.me/v1/session/${sessionId}/delete/`;
  const token = await getClientToken();
 
  if (!token) {
    console.error('Error fetching client token');
    throw new Error('Authentication failed');
  }
 
  const headers = {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${token.access_token}`
  };
 
  try {
    const response = await fetch(endpoint, {
      method: 'DELETE',
      headers
    });
 
    if (response.status === 204) {
      return true; // Successfully deleted
    }
 
    if (!response.ok) {
      const errorData = await response.json();
      console.error('Error deleting session:', errorData.detail || errorData.message);
      throw new Error(errorData.detail || 'Failed to delete session');
    }
  } catch (err) {
    console.error('Error:', err);
    throw err;
  }
};
import requests
 
def delete_session(session_id):
    """
    Delete a verification session.
 
    Args:
        session_id (str): The ID of the verification session to delete.
 
    Returns:
        bool: True if deletion was successful, False otherwise.
    """
    url = f"https://verification.didit.me/v1/session/{session_id}/delete/"
    token = get_client_token()  # Implement this function based on auth documentation
 
    if not token:
        print("Error: Failed to authenticate")
        return False
 
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {token['access_token']}"
    }
 
    try:
        response = requests.delete(url, headers=headers)
 
        if response.status_code == 204:
            return True
 
        response.raise_for_status()
 
    except requests.RequestException as e:
        print(f"Error deleting session: {e}")
        try:
            error_detail = e.response.json().get('detail', str(e))
            print(f"Server returned: {error_detail}")
        except:
            pass
        return False