Getting Started
Welcome to the Koncile API. This guide will walk you through the complete setup process, from generating your API key to extracting data from your first document.
Prerequisites
A Koncile account with API access
Admin access to generate API keys (if you're part of a multi-user company)
Understanding Koncile's Structure
Before diving into the API, it's important to understand how Koncile organizes document extraction.
The Hierarchy
Company
└── Folders
└── Templates
├── Fields
└── InstructionsFolder
Organizes templates by document category
"Supplier Invoices", "Purchase Orders", "Receipts"
Template
Defines extraction rules for a specific document type
"Acme Corp Invoice", "Standard PO Template"
Field
A specific piece of data to extract, can be General or Line
"Invoice Number", "Total Amount", "Supplier Name"
Instruction
Custom guidance for the AI extractor that is applied to General or Line fields
Always skip the first page of the document
How It Works
When you upload a document:
Koncile identifies which template to use (either specified by you or auto-detected)
The AI reads the document and extracts values for each field defined in the template
Results are returned with extracted values and confidence scores
Field & Instruction Types Explained
Koncile supports two types of fields:
General fields
Data that appears once per document
Invoice number, invoice date, supplier name, total amount
Line fields
Data that repeats for each line item
Product name, quantity, unit price, line total
For example, on an invoice:
The invoice number appears once → General field
Each product line has its own name, quantity, and price → Line fields
An instruction that has a type General field only concerns the General fields. Same logic for the Line fields
Field Formats
Each field has a format that helps the AI understand what type of data to extract:
text
Free-form text
Names, descriptions, addresses
number
Numeric values
Amounts, quantities, percentages
date
Date values
Invoice dates, due dates
boolean
True/false
Checkboxes, yes/no fields
multiple_choice
Selection from predefined options
Payment terms, document status
unit
Unit of measurement
kg, liters, pieces
empty
Placeholder
If you want the field to appear in your ouput data but don't need to extract values
Step 1: Generate Your API Key
API keys are generated from within the Koncile web application.
Log into your Koncile account at app.koncile.ai
Navigate to Settings > API
Click Generate API Key
Copy and securely store your API key
Important: The API key is only shown once. Store it securely (e.g., in environment variables or a secrets manager). If you lose it, you'll need to generate a new one.
Note: Only company administrators can generate API keys. If you don't see the API settings, contact your company admin.
Step 2: Verify Your API Key
Before proceeding, verify that your API key is working:
Expected response:
If you receive an error, double-check that:
Your API key is correct and complete
The
Authorizationheader uses the formatBearer YOUR_API_KEYYour API key hasn't been revoked
Step 3: Create Your Extraction Setup
Now let's create a complete extraction setup. We'll create a folder, template, fields, and instructions.
3.1 Create a Folder
Folders help you organize templates by document type or business purpose.
Response:
Save the id value - you'll need it to create templates.
3.2 Create a Template
Templates define what data to extract from documents. Each template belongs to a folder.
3.3 Create Fields
Fields define what data points to extract. Let's create both general fields and line fields.
General Fields (extracted once per document):
Line Fields (extracted for each line item):
Tip: The
descfield is important - it helps the AI understand exactly what to extract, especially for ambiguous fields.
3.4 Create Instructions (Optional)
Instructions or context are pieces of information you provide to the tool to help it extract data from your documents more accurately. They're especially useful for:
Excluding some information (specific pages of a document, total lines at the end of a table)
Giving additional context to the AI
Step 4: Upload a Document
Now that your extraction setup is complete, you can upload documents.
Response:
Note: The trailing slash in
/upload_file/is required.
Auto-classification: If you omit
folder_idandtemplate_id, Koncile will automatically classify the document and select the best matching template.
Step 5: Retrieve Extraction Results
Extraction happens asynchronously. Poll the task status until it completes:
Example response when complete:
Complete Example Script
Here's a complete Python script that performs all the steps above:
Next Steps
Now that you understand the basics, explore these topics:
File Uploading - Batch uploads, metadata, and file constraints
Task Retrieval - Detailed response format and polling strategies
Document Management - List, download, and delete documents
Folders, Templates, Fields & Instructions - Complete API reference
API Status Codes - Error handling and troubleshooting
SDK Libraries - Python and Node.js SDKs for easier integration
Last updated
Was this helpful?

