Skip to main content

Delete Parser

Read the introduction to parsers to understand Parsers.

This guide explains how to delete a specific parser from your account.

API Endpoint#

DELETE https://api.documentpro.ai/v1/templates/{template_id}

Path Parameters#

  • template_id (required): The unique identifier of the parser you want to delete.

Example Implementation using Python#

import requests
# Your API keyapi_key = 'YOUR_API_KEY'
template_id = 'YOUR_TEMPLATE_ID'url = f"https://api.documentpro.ai/v1/templates/{template_id}"
headers = {  'x-api-key': api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 200:    print('Parser deleted successfully')    print(response.json())else:    print('Failed to delete parser')    print(response.text)

Response#

Successful Response (Status Code: 200)#

A successful deletion will return a 200 status code and the following response body:

{    "success": true}

Error Response (Status Codes: 400, 404, 500)#

For errors, you will receive a response with the following structure:

{    "success": false,    "error": "error_code",    "message": "descriptive error message"}

Possible error scenarios include:

  • 404 Not Found: If the specified parser doesn't exist.
  • 400 Bad Request: If the request is malformed.
  • 500 Internal Server Error: If there's a server-side issue.

Important Notes#

  1. Deleting a parser is irreversible. Make sure you want to permanently remove the parser before making this API call.
  2. All documents associated with the deleted parser will remain in your account, but they will no longer be linked to any parser.
  3. If you accidentally delete a parser, you'll need to create a new one with the same configuration.
  4. It's a good practice to confirm the deletion by attempting to retrieve the parser details after deletion. This should return a 404 Not Found error if the deletion was successful.

Next Steps#

After deleting a parser, you might want to:

  1. Create a new parser to replace the deleted one.
  2. List your existing parsers to confirm the deletion and review your remaining parsers.
  3. Update any applications or workflows that were using the deleted parser to prevent errors.