Delete a document

This endpoint allows you to delete a specific document attached to an application, identified by its unique application ID ({id}) and document ID ({documentID}). Once deleted, the document will no longer be associated with the application.






Request

Details


Required keys

ParameterDescription
{id}The unique application identifier returned during application creation or listing endpoints.
{documentID}The unique identifier of the document, returned during document upload.


Body

This API does not require body parameters.




Response

Field Definitions

Field NameTypeDescription
HTTP Status CodeIntegerReturns 200 for successful deletion.
statusStringStatus of the API request (SUCCESS, FAILED).
successBooleanIndicates if the document deletion was successful.
resultStringA confirmation message for the deletion (e.g., "Document deleted successfully.").
errorsArray of StringsAny errors encountered during the deletion process.


❗️

Notes

  • Deleted documents cannot be recovered. Use this endpoint with caution.
  • Ensure secure handling of document deletions, especially for sensitive or regulated data.




Payload Examples

Request

cURL Request Example

curl --request DELETE \
     --url https://api-sandbox.flexfactor.com/v1/onboarding/application/{application_id}/documents/{document_id} \
     --header 'Authorization: bearer {the token returned by /oauth2}' \
     --header 'accept: application/json'


Response

JSON Example for a Successful Deletion

{
   "status": "SUCCESS",
   "success": true,
   "result": "Document deleted successfully.",
   "errors": []
}

JSON Example for a Failed Deletion

{
   "status": "FAILED",
   "success": false,
   "result": null,
   "errors": [
       "Document not found.",
       "Document deletion not allowed for submitted applications."
   ]
}


Example for Handling Errors

  • If the document ID or application ID is invalid, the API will return an error.
  • If the bearer token is unauthorized, the API will respond with an Unauthorized error.
HTTP/1.1 404 Not Found
Content-Type: application/json

{
  "errors": [
    "Document not found."
  ]
}
HTTP/1.1 401 Unauthorized
Content-Type: application/json

{
  "errors": [
    "Authentication failed. Invalid bearer token."
  ]
}