Skip to main content

Update parser settings

Read the introduction to parsers to understand Parsers.

You can use the API to set a webhook URL or update the parser configs by using the PUT method with the following payloads.

Update webhook URL#

{    "webhook_url": "https://your-webhook-url.com"}

Update date format#

{    "parser_config": {        "date_format": "%d/%m/%y"    }}

Update a ocr config#

{    "parser_config": {        "ocr_config": {            "detect_tables": true,        }    }}

Update a query config#

{    "parser_config": {        "query_config": {            "query_model": "gpt-3.5-turbo-0125"        }    }}

Making an update request#

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

Example Implementation using Python#

import requestsimport json
url = "https://api.documentpro.ai/v1/templates/710a20fc-e280-43eb-9a9f-5436e600c710"
payload = json.dumps(data)
headers = {  'x-api-key': 'YOUR_API_KEY',  'Content-Type': 'application/json'}
response = requests.request("PUT", url, headers=headers, data=payload)
# If the request was successful, status_code will be 200if response.status_code == 200:    print('Parser updated successfully')else:    print('Failed to update parser')

If the request is successful it will return a 200 status code with the parser object in the response body.