Document Extractor
This API provides a multi-format parsing engine. It accepts a direct URL to a document or code file and returns the clean, raw text content. This is ideal for feeding individual documents into LLMs or search indexes.
Supported Formats
Section titled “Supported Formats”- PDF (
.pdf) - Word (
.docx) - Plain Text (
.txt) - Code (
.js,.ts,.py,.java,.html,.css,.json,.md, etc.)
Endpoint
Section titled “Endpoint” POST
/api/v1/doc-extract Request Parameters
Section titled “Request Parameters”The following parameters are accepted in the request body:
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Direct URL to the file. |
Request Examples
Section titled “Request Examples”curl -X POST https://heavstal.com.ng/api/v1/doc-extract \-H "Content-Type: application/json" \-H "x-api-key: <YOUR_API_KEY>" \-d '{"url": "https://example.com/contract.docx"}'const response = await fetch('https://heavstal.com.ng/api/v1/doc-extract', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': '<YOUR_API_KEY>' }, body: JSON.stringify({ url: 'https://example.com/contract.docx' })});
const res = await response.json();console.log(res.data.content);import { tools } from '@heavstal/api';
const doc = await tools.docExtract("https://example.com/contract.pdf");console.log(doc.data.content);import requests
url = "https://heavstal.com.ng/api/v1/doc-extract"headers = { "Content-Type": "application/json", "x-api-key": "<YOUR_API_KEY>"}payload = { "url": "https://example.com/contract.docx"}
response = requests.post(url, headers=headers, json=payload)print(response.json()["data"]["content"])Response Examples
Section titled “Response Examples”{ "status": "success", "creator": "HEAVSTAL TECH", "data": { "detected_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "extension": "docx", "content": "Contract Agreement\nThis agreement is made between..." }}{ "status": "error", "error": "Unsupported file type or unable to parse document."}