DecoToolkit API Docs

Technical reference for using DecoToolkit tools programmatically.

Need an API token? Create one in your account.

Create API token
Learn more about DecoToolkit API plans

Overview

The DecoToolkit API allows you to integrate our tools into automations, workflows, and applications. Start with the QR Code Generator, Text Cleaner and JSON Formatter APIs, with more tools coming soon.

Early Access

The DecoToolkit API is currently in early access. Available endpoints are listed below. Endpoint availability and credit costs may vary as we expand the platform.

Base URL

https://api.decotoolkit.com

Authentication

Protected endpoints require a Bearer token in the Authorization header.

Authorization: Bearer YOUR_API_TOKEN

Create and manage your API tokens from your account. Each plan defines how many active tokens you can hold and how many monthly credits you can spend.

Available Endpoints

POST/v1/tools/qr-code

Generate a QR Code from a URL or text input.

Request Body

{
  "data": "https://decotoolkit.com",
  "size": 512,
  "format": "svg"
}

Parameters

ParameterTypeRequiredDescription
datastringRequiredThe content to encode. 1 to 2000 characters.
sizenumberOptionalOutput size in pixels. Min 128, max 2048. Default: 512.
formatstringOptionalOutput format. Currently only "svg" is supported.

Response Example

{
  "success": true,
  "tool": "qr-code",
  "result": {
    "format": "svg",
    "content": "<svg>...</svg>"
  },
  "links": {
    "open_tool": "https://decotoolkit.com/qr-code-generator?utm_source=api&utm_medium=automation&utm_campaign=qr_code",
    "documentation": "https://decotoolkit.com/api/docs"
  },
  "usage": {
    "credits_used": 1
  }
}

cURL Example

curl -X POST https://api.decotoolkit.com/v1/tools/qr-code \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "https://decotoolkit.com",
    "size": 512,
    "format": "svg"
  }'
POST/v1/tools/text-cleaner

Clean and normalize text for automation workflows.

Request Body

{
  "text": "  Hello   world!\n\nThis is   DecoToolkit.  ",
  "options": {
    "trim": true,
    "removeExtraSpaces": true,
    "removeLineBreaks": false,
    "removeDuplicateLines": false,
    "removeEmptyLines": false
  }
}

Parameters

ParameterTypeRequiredDescription
textstringRequiredThe text content to clean.
optionsobjectOptionalCleaning options. All options default to false except trim and removeExtraSpaces.
options.trimbooleanOptionalTrims the final output and each preserved line. Default: true.
options.removeExtraSpacesbooleanOptionalReplaces multiple spaces and tabs with a single space. Default: true.
options.removeLineBreaksbooleanOptionalReplaces line breaks with spaces. Default: false.
options.removeDuplicateLinesbooleanOptionalRemoves duplicate lines while preserving the first occurrence. Default: false.
options.removeEmptyLinesbooleanOptionalRemoves blank lines. Default: false.

Response Example

{
  "success": true,
  "tool": "text-cleaner",
  "result": {
    "text": "Hello world!\n\nThis is DecoToolkit.",
    "original_length": 41,
    "cleaned_length": 35,
    "changed": true
  },
  "links": {
    "open_tool": "https://decotoolkit.com/text-cleaner?utm_source=api&utm_medium=automation&utm_campaign=text_cleaner",
    "documentation": "https://decotoolkit.com/api/docs"
  },
  "usage": {
    "credits_used": 1
  }
}

cURL Example

curl -X POST "https://api.decotoolkit.com/v1/tools/text-cleaner" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "  Hello   world!\n\nThis is   DecoToolkit.  ",
    "options": {
      "trim": true,
      "removeExtraSpaces": true,
      "removeLineBreaks": false,
      "removeDuplicateLines": false,
      "removeEmptyLines": false
    }
  }'

For n8n: Users can import the cURL command into an HTTP Request node and replace the text value with a dynamic expression like {{$json.text}}.

POST/v1/tools/json-formatter

Validate, format, minify and sort JSON inside automation workflows, scripts, n8n, Zapier, Make and future AI agents.

Request Body

{
  "json": "{\"name\":\"DecoToolkit\",\"type\":\"API\"}",
  "options": {
    "mode": "format",
    "indent": 2,
    "sortKeys": false
  }
}

Parameters

ParameterTypeRequiredDescription
jsonstringRequiredThe JSON content to process. 1 to 100,000 characters.
optionsobjectOptionalProcessing options. All options have defaults.
options.modeenumOptionalProcessing mode: "format" | "minify" | "validate". Default: "format".
options.indentnumberOptionalIndentation level (0–8). Accepts numbers and numeric strings for n8n/Zapier/Make compatibility. Default: 2.
options.sortKeysbooleanOptionalRecursively sort object keys alphabetically (preserves array order). Default: false.

Response Example

{
  "success": true,
  "tool": "json-formatter",
  "result": {
    "json": "{\n  \"name\": \"DecoToolkit\",\n  \"type\": \"API\"\n}",
    "valid": true,
    "mode": "format",
    "type": "object",
    "original_length": 39,
    "output_length": 49,
    "changed": true
  },
  "links": {
    "open_tool": "https://decotoolkit.com/json-formatter?utm_source=api&utm_medium=automation&utm_campaign=json_formatter",
    "documentation": "https://decotoolkit.com/api/docs"
  },
  "usage": {
    "credits_used": 1
  }
}

cURL Example

curl -X POST "https://api.decotoolkit.com/v1/tools/json-formatter" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"json":"{\"name\":\"DecoToolkit\",\"type\":\"API\"}"}'

For n8n: Users can import any cURL example into an HTTP Request node. After importing, replace YOUR_API_TOKEN with their API token and optionally replace the json value with a dynamic expression such as {{$json.payload}}.

POST/v1/pdf/extract

Extract clean text, page-level content, metadata and Markdown from PDF files. Designed for AI workflows, RAG pipelines, n8n automations and data processing scripts. Note: some PDFs generated from HTML (Chrome/Skia) or scanned/image-based documents have non-standard text layers and may require advanced cleanup or OCR for best results.

Request Body

{
  "fileUrl": "https://example.com/document.pdf",
  "mode": "text",
  "includeMetadata": true,
  "includePageText": false,
  "cleanText": true,
  "pageRange": { "from": 1, "to": 5 }
}

Parameters

ParameterTypeRequiredDescription
fileUrlstringOptionalPublic URL of the PDF to download and process. Exactly one of fileUrl or fileBase64 is required.
fileBase64stringOptionalBase64-encoded PDF content. Exactly one of fileBase64 or fileUrl is required.
modeenumRequired"text" — full text as a single string. "pages" — text split by page. "metadata" — metadata and page count only (1 credit). "markdown" — basic Markdown output.
includeMetadatabooleanOptionalInclude document metadata (title, author, dates) in the response. Default: true.
cleanTextbooleanOptionalNormalize whitespace, remove excess blank lines and trim each line. Default: true.
repairSpacingbooleanOptionalApply heuristic repair for character-spaced text (a common artifact in PDFs generated from HTML/Chrome/Skia). Defaults to the cleanText value — set to false to opt out.
pageRangeobjectOptionalProcess only a subset of pages. { from: number, to: number } — both 1-based. Reduces credits used.

Response Example

{
  "success": true,
  "mode": "text",
  "document": {
    "pageCount": 4,
    "title": "Example Document",
    "author": "Author Name",
    "subject": null,
    "creator": null,
    "producer": null,
    "createdAt": "2024-01-15T14:30:00.000Z",
    "modifiedAt": null
  },
  "text": "Full extracted text from all pages...",
  "pages": null,
  "markdown": null,
  "links": {
    "open_tool": "https://decotoolkit.com/pdf-tools?utm_source=api",
    "documentation": "https://decotoolkit.com/api/docs#pdf-extract-api"
  },
  "usage": {
    "credits": 4,
    "pagesProcessed": 4
  }
}

cURL Example

# Extract text via URL
curl -X POST "https://api.decotoolkit.com/v1/pdf/extract" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fileUrl": "https://example.com/document.pdf",
    "mode": "text",
    "cleanText": true
  }'

# Extract Markdown, pages 1-3 only
curl -X POST "https://api.decotoolkit.com/v1/pdf/extract" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fileUrl": "https://example.com/document.pdf",
    "mode": "markdown",
    "pageRange": { "from": 1, "to": 3 }
  }'

# Metadata only (1 credit regardless of page count)
curl -X POST "https://api.decotoolkit.com/v1/pdf/extract" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fileUrl": "https://example.com/document.pdf",
    "mode": "metadata"
  }'

For n8n: In n8n, use an HTTP Request node with method POST and import the cURL example. For fileUrl, connect a previous node's output: replace the static URL with an expression like {{$json.pdfUrl}}. Credits consumed: 1 per processed page for text/pages/markdown modes, 1 credit for metadata mode.

POST/v1/pdf/ocr

Extract text from scanned or image-based PDFs using OCR. Use this endpoint when /v1/pdf/extract returns no text — for example, when a document was created by scanning physical pages. OCR processes each page as an image, so it is slower and more expensive than regular text extraction. Accuracy depends on scan quality, resolution and language. Does not extract structured tables or invoice data.

Request Body

{
  "fileUrl": "https://example.com/scanned-document.pdf",
  "mode": "text",
  "language": "eng",
  "cleanText": true,
  "pageRange": { "from": 1, "to": 3 }
}

Parameters

ParameterTypeRequiredDescription
fileUrlstringOptionalPublic URL of the PDF to download and process. Exactly one of fileUrl or fileBase64 is required.
fileBase64stringOptionalBase64-encoded PDF content. Exactly one of fileBase64 or fileUrl is required.
modeenumOptional"text" — full OCR text as a single string (default). "pages" — OCR text split by page. "markdown" — basic Markdown output with page headings.
languageenumOptionalOCR language hint. Supported values: "eng" (English, default), "por" (Portuguese), "spa" (Spanish), "fra" (French), "deu" (German). Use the language that matches the document for best accuracy.
cleanTextbooleanOptionalNormalize whitespace, remove excess blank lines and trim each line. Default: true.
pageRangeobjectOptionalProcess only a subset of pages. { from: number, to: number } — both 1-based. Reduces credits used. OCR processes pages serially so smaller ranges complete faster.

Response Example

{
  "success": true,
  "mode": "text",
  "document": {
    "pageCount": 3,
    "title": null
  },
  "text": "Full OCR text from all pages...",
  "pages": null,
  "markdown": null,
  "ocr": {
    "provider": "local-tesseract",
    "language": "eng",
    "averageConfidence": null
  },
  "links": {
    "open_tool": "https://decotoolkit.com/pdf-tools?utm_source=api",
    "documentation": "https://decotoolkit.com/api/docs#pdf-ocr-api"
  },
  "usage": {
    "credits": 15,
    "pagesProcessed": 3
  }
}

cURL Example

# OCR a scanned PDF via URL
curl -X POST "https://api.decotoolkit.com/v1/pdf/ocr" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fileUrl": "https://example.com/scanned-document.pdf",
    "mode": "text",
    "language": "eng"
  }'

# OCR with Portuguese language, pages 1-2 only
curl -X POST "https://api.decotoolkit.com/v1/pdf/ocr" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fileUrl": "https://example.com/relatorio.pdf",
    "mode": "pages",
    "language": "por",
    "pageRange": { "from": 1, "to": 2 }
  }'

# OCR base64 PDF, Markdown output
curl -X POST "https://api.decotoolkit.com/v1/pdf/ocr" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fileBase64": "JVBERi0xLjQK...",
    "mode": "markdown",
    "language": "eng"
  }'

For n8n: In n8n, use an HTTP Request node with method POST and import the cURL example. Connect a previous node's PDF URL with an expression like {{$json.pdfUrl}}. Credits consumed: 5 per processed page by default. OCR is slower than regular text extraction — consider using pageRange to limit pages and reduce both cost and response time.

Use Cases

Connect DecoToolkit to the tools you already use.

n8n Workflows

Generate QR codes automatically inside n8n workflows using HTTP Request nodes.

Marketing & Events

Create QR codes for product pages, restaurant menus, events and marketing campaigns at scale.

Custom Scripts

Integrate DecoToolkit into Python, Node.js or any language that can make HTTP requests.

AI Agents

Prepare automated workflows for AI agents and MCP-compatible tools.

Use with n8n

The fastest way to connect DecoToolkit API to n8n is by importing a cURL command into an HTTP Request node.

Steps

  1. 1.Add an HTTP Request node.
  2. 2.Click "Import cURL".
  3. 3.Paste the command below.
  4. 4.Replace YOUR_API_TOKEN with your DecoToolkit API token.
  5. 5.Execute the node.

cURL Example

curl -X POST "https://api.decotoolkit.com/v1/tools/qr-code" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "https://decotoolkit.com",
    "size": 512,
    "format": "svg"
  }'

Dynamic input example

After importing the cURL command, the static data value can be replaced with a n8n expression:

{{$json.url}}

Example request body:

{
  "data": "{{$json.url}}",
  "size": 512,
  "format": "svg"
}

Errors, Limits & Usage

What to expect from authenticated requests.

Authentication

Every protected endpoint requires a valid Bearer token. Requests without a token, or with an invalid or revoked token, return 401 Unauthorized.

Plan limits

Each plan defines a monthly credit allowance and a maximum number of active tokens. Once your credits are exhausted, requests are rejected until the next cycle or a plan upgrade.

Validation errors

Invalid payloads return 400 Bad Request with a descriptive validation error explaining which field failed and why.

Usage & credits

Each successful tool call consumes credits. The number spent is returned in the usage.credits_used field of every response so you can track consumption.

Coming Soon

More endpoints are on the roadmap.

  • Unit Converter API
  • Image Tools API
  • MCP Server Support

Explore DecoToolkit

FAQ

What is the DecoToolkit API?

The DecoToolkit API allows developers and automation builders to use DecoToolkit tools programmatically, from scripts, workflows, and AI agents.

How do I authenticate requests?

All API requests require a Bearer token in the Authorization header. You can create and manage tokens from your account.

What tools are available now?

Available endpoints include QR Code Generator (POST /v1/tools/qr-code), Text Cleaner (POST /v1/tools/text-cleaner), JSON Formatter (POST /v1/tools/json-formatter) and PDF Extractor (POST /v1/pdf/extract). More tools will be added gradually.

How are usage and credits counted?

Each successful tool call consumes credits from your monthly plan allowance. The amount used is returned in the usage.credits_used field of every response.

Will DecoToolkit support MCP?

MCP Server support is on our roadmap. Our goal is to make DecoToolkit tools available to AI agents through standard protocols.

Can I use it with n8n or Zapier?

Yes. Any tool that supports HTTP requests — including n8n, Zapier, Make and custom scripts — can integrate with the DecoToolkit API.