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.
Step 1: Generate Your API Key
API keys are generated from within the Koncile web application.
If you do not have a Koncile account, create one !
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:
The Authorization header uses the format Bearer YOUR_API_KEY
Your 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.
If you have struggle grasping the different extraction concepts that are Folder, Template, Field and Instruction, please read this quick explanation of those concepts here Understanding Koncile's Structure
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 desc field 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_id and template_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