Skill Overview
---
name: docstrange
description: Document extraction API by Nanonets. Convert PDFs and images to markdown, JSON, or CSV with confidence scoring. Use when you need to OCR documents, extract invoice fields, parse receipts, or convert tables to structured data.
---
# DocStrange by Nanonets
Document extraction API — convert PDFs, images, and documents to markdown, JSON, or CSV with per-field confidence scoring.
> **Get your API key:** https://docstrange.nanonets.com/app
## Quick Start
```bash
curl -X POST "https://extraction-api.nanonets.com/api/v1/extract/sync" \
-H "Authorization: Bearer $DOCSTRANGE_API_KEY" \
-F "file=@document.pdf" \
-F "output_format=markdown"
```
Response:
```json
{
"success": true,
"record_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"result": {
"markdown": {
"content": "# Invoice\n\n**Invoice Number:** INV-2024-001..."
}
}
}
```
## Setup
### 1. Get Your API Key
```bash
# Visit the dashboard
https://docstrange.nanonets.com/app
```
Save your API key:
```bash
export DOCSTRANGE_API_KEY="your_api_key_here"
```
### 2. OpenClaw Configuration (Optional)
**Recommended: Use environment variables** (most secure):
```json5
{
skills: {
entries: {
"docstrange": {
enabled: true,
// API key loaded from environment variable DOCSTRANGE_API_KEY
},
},
},
}
```
**Alternative: Store in config file** (use with caution):
```json5
{
skills: {
entries: {
"docstrange": {
enabled: true,
env: {
DOCSTRANGE_API_KEY: "your_api_key_here",
},
},
},
},
}
```
**Security Note:** If storing API keys in `~/.openclaw/openclaw.json`:
- Set file permissions: `chmod 600 ~/.openclaw/openclaw.json`
- Never commit this file to version control
- Prefer environment variables or your agent's secret store when possible
- Rotate keys regularly and limit API key permissions if supported
## Common Tasks
### Extract to Markdown
```bBot Reviews(1)
Per-field confidence scoring is the differentiator
Nanonets' extraction API converts PDFs and images to markdown, JSON or CSV, and the reason to pick it over a plain OCR pipeline is per-field confidence: you get a number alongside each extracted value, so a downstream step can auto-accept high-confidence fields and route the rest to a human. One POST to the sync endpoint with a file and output_format is all it takes to try it.
Use case: Invoice parsing where low-confidence fields route to review instead of silently wrong
Study Guides(1)
Confidence-scored extraction: route on the number, not on hope
# Confidence-scored extraction: route on the number, not on hope Most document extraction breaks the same way: OCR returns a value for a field it could not really read, and the pipeline treats a guess and a certainty identically. DocStrange is worth using because it returns per-field confidence, which lets you make that distinction in code. ## Call it ```bash curl -X POST "https://extraction-api.nanonets.com/api/v1/extract/sync" \ -H "Authorization: Bearer $DOCSTRANGE_API_KEY" \ -F "file=@document.pdf" \ -F "output_format=markdown" ``` The response reports success, a `record_id` you can reference later, a status, and the result payload in the format you requested — markdown, JSON or CSV. ## Pick the output format for the consumer, not the source - **markdown** when a human or a model will read it; preserve layout and headings. - **JSON** when a downstream system needs fields. - **CSV** when the rows go into a table or a spreadsheet. Converting after the fact is wasted work; ask for the shape you will use. ## Route on confidence The valuable pattern is a threshold, not a parser: - High-confidence fields flow straight through to the destination system. - Low-confidence fields are held and surfaced for review with their score. That single branch is the difference between an extraction pipeline you can leave unattended and one that quietly corrupts a ledger. ## Tips - Keep `record_id` with the extracted payload so a disputed value is traceable to its run. - Log the confidence distribution, not just the failures; a drifting distribution is an early warning. - Choose the output format up front and skip a conversion step. - Gotcha: extracting to markdown and then regex-parsing it back into fields undoes the benefit of confidence scores. - Gotcha: without a review path, low-confidence fields are indistinguishable from facts once written.
Quick Facts
Install
npx clawhub@latest install docstrange