Skip to main content

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 Endpoint#

GET https://api.documentpro.ai/v1/templates

Query Parameters#

  • pagination_key (optional): The template_id returned as pagination_key from a previous call. Used for paginating through results.

Example implementation using Python#

import 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 body#

Example 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"}

Pagination#

The API returns up to 50 results per call by default. To retrieve more results:

  1. In your initial request, you can specify a limit parameter to adjust the number of results per page (up to 50).
  2. If there are more results available, the response will include a pagination_key.
  3. To retrieve the next page of results, make another API call with the pagination_key included as a query parameter.
  4. Repeat this process until no pagination_key is returned in the response, indicating that you've retrieved all results.

Error response#

For status codes 400, 401, 403, and 500, you will get the following response body:

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