Get Started

One function. Any input. Structured output.

1 — GET YOUR KEY

Sign up at everythingstructured.com/account

# .env
STRUCTURE_API_KEY=sk-xxx
2 — INSTALL
npm install everythingstructured
3 — USE
import structure from 'everythingstructured'
const result = 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" }

That's it. Pass any input, define the output shape, get structured data back.

Input

Pass anything. The type is detected automatically.

TextStrings, emails, logs
URLPages, APIs, file links
PDFInvoices, reports, forms
ImageScreenshots, receipts, photos
AudioMP3, WAV, OGG, FLAC
VideoMP4, WebM
SpreadsheetXLSX, XLS
DocumentDOCX, PPTX
JSONObjects, arrays
CSVComma-separated data
XML / YAMLParsed automatically
Base64Encoded images, data URIs

Output

Define what comes back. Text, structured data, or a file.

Pass a format string to convert your input:

'text'Plain text
'markdown'Headings, lists, tables
'json'Valid JSON
'csv'With header row
'yaml'Valid YAML
'xml'Well-formed XML
'html'Semantic HTML
'table'Markdown pipe table
'list'Bulleted list
'summary'Concise summary
'pdf'PDF document
'docx'Word document
'xlsx'Excel spreadsheet
'pptx'PowerPoint presentation
await structure.run({ input: 'https://example.com', output: 'markdown' })
await structure.run({ input: 'https://example.com/report.pdf', output: 'xlsx' })

File outputs

When the output is pdf, docx, xlsx, or pptx, the response contains a file instead of text:

const result = await structure.run({
input: 'name,age\nAlice,30\nBob,25',
output: 'xlsx'
})
// result.file.data → base64-encoded file
// result.file.filename → "output.xlsx"
// result.file.mime → "application/vnd...spreadsheetml.sheet"
// result.file.size → 5847
// Save it:
import fs from 'fs'
fs.writeFileSync(result.file.filename, Buffer.from(result.file.data, 'base64'))

doc generates DOCX. xls generates XLSX. ppt generates PPTX. Same function, same API.

Or pass a schema object to define the exact shape:

await structure.run({
input: 'Sarah Chen, Senior PM at Acme. sarah@acme.com',
output: { name: 'string', title: 'string', email: 'string' }
})
// → { name: "Sarah Chen", title: "Senior PM", email: "sarah@acme.com" }
NESTED
output: {
company: {
name: 'string',
address: {
city: 'string',
state: 'string'
}
}
}
ARRAYS
// Extracts all matches
output: {
people: [{
name: 'string',
role: 'string'
}]]
}

Missing fields return null. Empty arrays return []. Data is never invented.

Supported types:

'string'Text
'number'Float
'integer'Integer
'boolean'true / false
'date'ISO 8601 date
'datetime'ISO 8601 datetime
'email'Email address
'url'URL
'phone'Phone number
'object'Freeform JSON object
'string[]'Array of strings
[{ ... }]Array of typed objects

You can also pass instructions and example

Both are optional. Use them when the schema alone isn't enough. Works with all output types — text, schemas, and files.

instructions — plain english rules for how to process the data:

await structure.run({
input: 'Call me at 5551234567',
output: { phone: 'string' },
instructions: 'Format phone as (XXX) XXX-XXXX'
})
// → { phone: "(555) 123-4567" }
await structure.run({
input: 'The AI market will reach 190 billion by 2025...',
output: 'summary',
instructions: 'Exactly 3 bullet points'
})
await structure.run({
input: 'Q1: $2.1B revenue, 34% growth, 3 product launches...',
output: 'pptx',
instructions: 'Create a 4-slide executive summary presentation'
})

example — one correct output to show the exact structure you expect:

await structure.run({
input: 'Find urgent emails from humans',
output: { filter: { must: [{ key: 'string', match: 'object' }]] } },
example: {
filter: {
must: [
{ key: 'classification.sender.is_human', match: { value: true } },
{ key: 'classification.action.leaf', match: { value: 'reply.urgent' } }
]
}
}
})
await structure.run({
input: 'Menu: Burger $12.99, Salad $8.50, Soup $6.00',
output: { items: [{ name: 'string', price: 'string' }]] },
example: { items: [{ name: 'Burger', price: '$12.99' }]] }
})
// One example item → the API extracts all of them

You can use both together:

await structure.run({
input: 'Create label suggestions for investor emails',
output: {
suggestions: [{
name: 'string',
filter: { must: [{ key: 'string', match: 'object' }]] },
color: 'string'
}]]
},
instructions: 'Generate 2-3 suggestions. Keys start with classification.',
example: {
suggestions: [{
name: 'VIP Investors',
filter: {
must: [{ key: 'classification.relationship.leaf', match: { any: ['external.investor_advisor'] } }]]
},
color: 'ember'
}]]
}
})

Examples

TEXT → STRUCTURED
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
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
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: [...] }
IMAGE → TEXT
await structure.run({
input: 'https://example.com/screenshot.png',
output: 'text'
})
// → "Settings > Privacy > Location Services..."
IMAGE → STRUCTURED
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
await structure.run({
input: 'https://example.com/meeting.mp3',
output: 'text'
})
// → "Welcome everyone to the Q1 planning meeting..."
SPREADSHEET → JSON
await structure.run({
input: 'https://example.com/report.xlsx',
output: 'json'
})
// → [{ quarter: "Q1", revenue: 1200000 }, ...]
TEXT → PDF
const result = await structure.run({
input: '# Meeting Notes\n\n- Ship mobile app\n- Hire 3 engineers',
output: 'pdf'
})
// → { file: { data: "base64...", filename: "output.pdf", size: 12400 } }
CSV → EXCEL
const result = await structure.run({
input: 'name,age\nAlice,30\nBob,25',
output: 'xlsx'
})
// → { file: { data: "base64...", filename: "output.xlsx", size: 5847 } }
JSON → WORD DOC
const result = await structure.run({
input: { title: 'Brief', client: 'BigCo', items: ['Auth', 'Dashboard'] },
output: 'docx'
})
// → { file: { data: "base64...", filename: "output.docx", size: 8200 } }
NESTED
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

Use any language.

EndpointPOST https://api.everythingstructured.com/v1/run
AuthAuthorization: Bearer sk-xxx
BodyJSON — input + output required, instructions + example optional
BASIC
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" }
}'
FILE OUTPUT
curl -X POST https://api.everythingstructured.com/v1/run \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxx" \
-d '{
"input": "name,age\nAlice,30\nBob,25",
"output": "xlsx"
}'
// → { "file": { "data": "base64...", "filename": "output.xlsx", ... } }
WITH ALL FIELDS
curl -X POST https://api.everythingstructured.com/v1/run \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxx" \
-d '{
"input": "Find urgent emails from humans",
"output": {
"filter": { "must": [{ "key": "string", "match": "object" }]] }
},
"instructions": "Keys must start with classification.",
"example": {
"filter": {
"must": [{ "key": "classification.sender.is_human", "match": { "value": true } }]]
}
}
}'

Errors

try {
const result = await structure.run({ input: '...', output: { title: 'string' } })
} catch (e) {
console.error(e.code, e.message)
}
CODEHTTPMEANING
INPUT_REQUIRED400Missing input field
OUTPUT_REQUIRED400Missing output field
AUTH_MISSING401No API key provided
AUTH_INVALID_KEY401Invalid API key
INSUFFICIENT_CREDITS402Not enough credits
RATE_LIMIT_EXCEEDED429Too many requests per minute
INPUT_TOO_LARGE413Input exceeds size limit
INPUT_UNREACHABLE422URL can't be fetched
INPUT_PARSE_FAILED422File couldn't be parsed
PROCESSING_FAILED502Processing failed — retry
TIMEOUT504Request took too long

Metadata

Available after every call.

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 ID
input_typeDetected input type
output_typeOutput format used
durationProcessing time
credits_usedCredits consumed
credits_remainingRemaining balance
chunkedInput was split
chunksNumber of chunks
truncatedContent was omitted
warningsProcessing warnings
file_conversionFile was generated

Config

# .env — the SDK reads this automatically
STRUCTURE_API_KEY=sk-xxx

Or pass it directly:

import { Structure } from 'everythingstructured'
const structure = new Structure({ apiKey: 'sk-xxx' })