Delete Users

DELETE /api/v1/profile/delete-user/:userId

Common errors include:

  • "Bad Request" if body parameters are not passed
  • "DNS_CONFIGURATION_ERROR" if custom domain DNS is misconfigured.

The createQrCodeHandler creates a qr code for the input body and returns the reponse to users

Request

Method : DELETE
Content-Type : Application/json

URL Parameters Schema

userId number Required
Default: N/A
User ID to delete (passed as URL parameter)
LANGUAGE
REQUEST
 curl -X DELETE 
   "https://divsly-backend.vercel.app/api/v1/profile/delete-user/123" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

API REQUEST
 const deleteUser = (userId) => {
  return fetch(`https://divsly-backend.vercel.app/api/v1/profile/delete-user/${userId}`, {
	method: 'DELETE',
	headers: {
  	'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
	}
  })
  .then(response => response.json())
  .catch(error => {
	console.error('Error:', error);
	throw error; // Ensure errors propagate to the caller
  });
};

API REQUEST
 const axios = require('axios');

const deleteUser = (userId) => {
  return axios.delete(`https://divsly-backend.vercel.app/api/v1/profile/delete-user/${userId}`, {
	headers: {
  	'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
	}
  })
  .then(response => response.data)
  .catch(error => {
	console.error('Error:', error.response?.data || error.message);
	throw error; // Ensure errors propagate to the caller
  });
};
API REQUEST
 $$userId = 123;
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "https://divsly-backend.vercel.app/api/v1/profile/delete-user/" . $userId);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Authorization: Bearer YOUR_ACCESS_TOKEN'
    ));

API REQUEST
 # Python Requests
import requests

def delete_user(user_id, access_token):
	url = f"https://divsly-backend.vercel.app/api/v1/profile/delete-user/{user_id}"
	headers = {
    	"Authorization": f"Bearer {access_token}"
	}
    
	response = requests.delete(url, headers=headers)
	return response.json()

RESPONSE
  {
	"error": false,
	"data": {
    	// Deleted user data from deleteProfileQuery
    	"id": 123,
    	"email": "user@example.com",
    	// ... other user fields returned by Prisma
	}
}
   
  {
  "data": {
	"message": "Unauthorized",
  }
}


 {
  "data": {
	"message": "Forbidden Access!",
  }
}


    
  {
  "error": true,
  "message": “Error deleting user”
}