Get Started
One function. Any input. Structured output.
STEP 1
Get your API key
Sign up at everythingstructured.com/dashboard. Add it to your environment:
# .envSTRUCTURE_API_KEY=sk-xxx
STEP 2
Install
npm install everythingstructured
STEP 3
Use
import structure from 'everythingstructured'const contact = await structure.run({input: 'Sarah Chen, Senior PM at Acme. Email: sarah@acme.com',output: { name: 'string', title: 'string', email: 'string' }})// → { name: "Sarah Chen", title: "Senior PM", email: "sarah@acme.com" }
How It Works
Every call has two fields: what goes in, and what comes out.
input
Anything — text, URL, PDF, image, audio, JSON, spreadsheet. Auto-detected.
output
A format like
text markdown csv — or a schema that defines the exact shape you want.structure.run({ input: <anything>, output: <format or schema> })
Input
Pass anything. The type is detected automatically.
TextAny string — paragraphs, emails, notes, logs
URLWebpages, APIs, file links — fetched and parsed
PDFInvoices, reports, forms, research papers
ImageScreenshots, photos, receipts — extracts text or describes content
AudioMP3, WAV, OGG, FLAC — transcribed
VideoMP4, WebM — audio track transcribed
SpreadsheetXLSX, XLS — all sheets extracted
DocumentDOCX, PPTX — full text extraction
JSONObjects and arrays — passed directly
CSV / XML / YAMLParsed automatically
HTMLRaw HTML — cleaned and extracted
Base64Encoded images or data URIs
Output
Two ways to use it.
Pass a format string
Converts your input into that format. Returns a string.
'text'Clean plain text'markdown'Headings, lists, tables'json'Valid JSON'csv'Comma-separated with header row'yaml'Valid YAML'xml'Well-formed XML'html'Semantic HTML'table'Markdown pipe table'list'Bulleted list'summary'Concise summaryconst md = await structure.run({input: 'https://example.com',output: 'markdown'})
Pass a schema object
Describe the shape you want. Use any keys. The API reads the input and fills every field.
const contact = await structure.run({input: 'Sarah Chen, Senior PM at Acme. sarah@acme.com. Started March 2021.',output: {name: 'string',title: 'string',email: 'string',start_date: 'string',}})// → { name: "Sarah Chen", title: "Senior PM",// email: "sarah@acme.com", start_date: "2021-03-01" }
NESTED
output: {company: {name: 'string',address: { city: 'string', state: 'string' }}}
ARRAYS
// Wrap in an array to extract all matching itemsoutput: { people: [{ name: 'string', role: 'string' }] }
NUMBERS
// Use 'number' to get a parsed number instead of a stringoutput: { price: 'number', quantity: 'number' }// "$1,490.00" → 1490
If a field can't be found, it returns
null for values or [] for arrays. Data is never invented.Examples
TEXT → STRUCTURED
const contact = await structure.run({input: 'Sarah Chen, Senior PM at Acme. Email: sarah@acme.com',output: { name: 'string', title: 'string', email: 'string' }})// → { name: "Sarah Chen", title: "Senior PM", email: "sarah@acme.com" }
URL → STRUCTURED
const repo = await structure.run({input: 'https://api.github.com/repos/vercel/next.js',output: { name: 'string', stars: 'number', language: 'string' }})// → { name: "next.js", stars: 128000, language: "JavaScript" }
PDF → STRUCTURED
const doc = await structure.run({input: 'https://example.com/invoice.pdf',output: {vendor: 'string',total: 'number',items: [{ name: 'string', price: 'number' }]}})// → { vendor: "Acme Corp", total: 1490, items: [{ name: "Consulting", price: 1490 }] }
IMAGE → TEXT
const text = await structure.run({input: 'https://example.com/screenshot.png',output: 'text'})// → "Settings > Privacy > Location Services..."// If no text is found, you get a description of what's in the image.
IMAGE → STRUCTURED
const receipt = await structure.run({input: 'https://example.com/receipt.jpg',output: {vendor: 'string',total: 'string',items: [{ name: 'string', price: 'string' }]}})// → { vendor: "Whole Foods", total: "$47.23", items: [...] }
AUDIO → TEXT
const transcript = await structure.run({input: 'https://example.com/meeting.mp3',output: 'text'})// → "Welcome everyone to the Q1 planning meeting..."
SPREADSHEET → JSON
const data = await structure.run({input: 'https://example.com/report.xlsx',output: 'json'})// → [{ quarter: "Q1", revenue: 1200000 }, { quarter: "Q2", revenue: 1450000 }]
URL → SUMMARY
const summary = await structure.run({input: 'https://en.wikipedia.org/wiki/TypeScript',output: 'summary'})// → "TypeScript is a strongly typed programming language..."
JSON → CSV
const csv = await structure.run({input: [{ name: 'Alice', age: 30 }, { name: 'Bob', age: 25 }],output: 'csv'})// → "name,age\nAlice,30\nBob,25"
URL → MARKDOWN
const md = await structure.run({input: 'https://example.com',output: 'markdown'})// → "# Example Domain\n\nThis domain is for use in illustrative examples..."
ARRAY EXTRACTION
const team = await structure.run({input: 'Team: Alice (eng), Bob (design), Carol (pm)',output: { people: [{ name: 'string', role: 'string' }] }})// → { people: [{ name: "Alice", role: "eng" }, { name: "Bob", role: "design" }, ...] }
NESTED SCHEMA
const org = await structure.run({input: 'Acme Corp: Engineering (50 people, lead: Alice), Design (20, lead: Bob)',output: {company: {name: 'string',departments: [{ name: 'string', headcount: 'number', lead: 'string' }]}}})// → { company: { name: "Acme Corp", departments: [...] } }
REST API
Don't use JavaScript? Hit the API directly.
CURL
curl -X POST https://api.everythingstructured.com/v1/run \-H "Content-Type: application/json" \-H "Authorization: Bearer sk-xxx" \-d '{"input": "Sarah Chen, Senior PM at Acme. Email: sarah@acme.com","output": { "name": "string", "email": "string" }}'
EndpointPOST https://api.everythingstructured.com/v1/run
AuthAuthorization: Bearer sk-xxx
BodyJSON with input and output fields
Errors
try {const result = await structure.run({input: 'https://example.com/data.pdf',output: { title: 'string', pages: 'number' }})} catch (e) {console.error(e.code, e.message)}
CODEHTTPMEANING
INPUT_REQUIRED400Missing input fieldOUTPUT_REQUIRED400Missing output fieldAUTH_MISSING401No API keyAUTH_INVALID_KEY401Invalid API keyRATE_LIMIT_EXCEEDED429Too many requestsINPUT_TOO_LARGE413Input exceeds size limitINPUT_UNREACHABLE422URL can't be fetchedINPUT_PARSE_FAILED422File couldn't be parsedPROCESSING_FAILED502Processing failed — retryTIMEOUT504Request took too longMetadata
Optional. Access via structure.meta after any call.
const result = await structure.run({input: 'https://example.com',output: 'text'})console.log(structure.meta?.duration) // "1234ms"console.log(structure.meta?.request_id) // "e3b1f2b4-..."console.log(structure.meta?.input_type) // "html"
request_idUnique request IDinput_typeDetected type (html, json, pdf, image, etc.)output_typeOutput format useddurationProcessing timechunkedWhether input was split into chunkschunksNumber of chunkstruncatedWhether some input was omittedwarningsProcessing warningsConfig
ENVIRONMENT VARIABLE (RECOMMENDED)
# .envSTRUCTURE_API_KEY=sk-xxx
The SDK reads this automatically. No setup code needed.
DIRECT
import { Structure } from 'everythingstructured'const structure = new Structure({ apiKey: 'sk-xxx' })