List Parsers
Read the introduction to parsers to understand Parsers.
This guide explains how to list parsers in your account.
#
List parsers in your account#
API EndpointGET https://api.documentpro.ai/v1/templates
#
Query Parameterspagination_key
(optional): Thetemplate_id
returned aspagination_key
from a previous call. Used for paginating through results.
#
Example implementation using Pythonimport requests
# Your API keyapi_key = 'YOUR_API_KEY'
url = "https://api.documentpro.ai/v1/templates"
headers = { 'x-api-key': api_key}
# Optional parametersparams = { 'pagination_key': 'previous_pagination_key', # Optional: Include if paginating}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200: print('Parsers retrieved successfully') print(response.json())else: print('Failed to retrieve parsers') print(response.text)
#
Successful response bodyExample response with status code 200
:
{ "success": true, "items": [ { "template_id": "710a20fc-e280-43eb-9a9f-5436e600c710", "template_title": "Custom Invoice Parser", "template_type": "Invoice", "template_category": "other", "template_schema": { "fields": [ { "name": "buyer_name", "type": "text", "description": "name of the buyer" }, { "name": "total_amount", "type": "number" }, { "name": "line_items", "type": "table", "description": "invoice line items", "subFields": [ { "name": "description", "type": "text", "description": "description of item" }, { "name": "subtotal", "type": "number" } ] } ] }, "email_id": "test_parser_22_fbb499@inbox.documentpro-ai.com", "webhook_url": null, "parser_config": { "parse_email_attachments": true, "parse_email_body": false, "date_format": null, "outbound_integration": null, "ocr_config": { "engine": "aws_textract", "detect_layout": true, "detect_tables": false, "remove_headers": true, "remove_footers": true, "remove_tables": false }, "query_config": { "query_model": "gpt-4o-mini", "set_max_output_tokens": false, "include_example": false, "minimize_tokens": true, "selected_language": null } }, "created_at": "2023-11-15T12:13:12.056281" }, // ... more parser objects ... ], "pagination_key": "420a20fc-e280-43eb-9a9f-5436e600c853"}
#
PaginationThe API returns up to 50 results per call by default. To retrieve more results:
- In your initial request, you can specify a
limit
parameter to adjust the number of results per page (up to 50). - If there are more results available, the response will include a
pagination_key
. - To retrieve the next page of results, make another API call with the
pagination_key
included as a query parameter. - Repeat this process until no
pagination_key
is returned in the response, indicating that you've retrieved all results.
#
Error responseFor status codes 400
, 401
, 403
, and 500
, you will get the following response body:
{ "success": false, "error": "error code", "message": "descriptive error message"}