Skip to main content
Deprecation Notice: The structured_output parameter on /extract is deprecated. Use the /schema endpoint after extraction instead. The schema format and design principles on this page still apply — just pass your schema to /schema via schema_config instead of to /extract via structured_output.

Overview

This guide covers best practices for designing JSON schemas used with the /schema endpoint (recommended) or the legacy structured_output parameter on /extract.

Schema Format

The structured_output.schema field uses the JSON Schema specification (OpenAPI 3.1 compatible). This is the same schema format used by OpenAI’s structured outputs and other LLM providers.

Key JSON Schema Properties

Don’t write schemas by hand! Use the Schema Editor in the Pulse Platform to generate and refine schemas interactively.
The Schema Editor provides two powerful ways to create schemas:

1. Generate from Prompt

Describe what you want to extract in natural language, and the editor will generate a properly formatted JSON Schema for you.
“Extract the account holder name, account number, statement period, opening and closing balances, and all transactions with date, description, and amount.”

2. Interactive Editor

  • Visually add, remove, and reorder fields
  • Set field types and descriptions
  • Mark fields as required
  • Preview the generated schema in real-time
  • Test against sample documents
Once you’re happy with your schema, copy it directly into your API requests. The recommended approach is a two-step flow:
  1. Extract the document via /extract to get an extraction_id
  2. Apply a schema via /schema using the extraction_id
The schema_config object contains:

Bank Statement Example

Here’s an example extracting key fields from a bank statement: Step 1: Extract
Step 2: Apply Schema
Response (schema_output):

SDK Examples

Schema Format

Schemas follow the JSON Schema specification. Each field is defined with:

Data Types

Schema Design Principles

1. Start Simple

Begin with basic fields and gradually add complexity:
Then expand with nested objects and arrays:

2. Use Descriptions

Add description fields to guide extraction:

3. Use schema_prompt for Context

The schema_prompt field provides natural language guidance to help the model understand nuances:

Common Schema Patterns

Invoice / Financial Documents

Medical Records

Advanced Techniques

Conditional Extraction

Use schema_prompt to guide conditional extraction:

Hierarchical Data

For documents with deeply nested structures:

Performance Tips

Keep Schemas Focused

Extract only what you need. Avoid extracting entire documents as single fields.

Use Descriptions

Add description fields to guide the model on ambiguous fields or specific formats.

Leverage schema_prompt

Use schema_prompt to provide context that can’t be expressed in the schema structure alone.

Migration from Legacy Parameters

Both the schema / schema_prompt top-level parameters and the structured_output parameter on /extract are deprecated. Use the /schema endpoint after extraction instead.

Before (Deprecated — top-level schema on /extract)

Before (Deprecated — structured_output on /extract)

The API supports structured_output on /extract for backward compatibility, but all new integrations should use the /schema endpoint.

Error Handling

Common Schema Errors

Debugging Tips

  1. Start with a minimal schema and add fields incrementally
  2. Use schema_prompt to provide context and clarify ambiguous fields
  3. Check extracted markdown without schema first to see available content
  4. Verify field names match document terminology

Best Practices Summary

  • Use the /schema endpoint for all new integrations
  • Provide descriptive schema_prompt instructions
  • Use descriptive field names matching document terminology
  • Start simple and iterate
  • Test with real documents
  • Use appropriate data types (number for numeric values)
  • Use structured_output on /extract (deprecated — use /schema instead)
  • Use deprecated schema top-level parameter
  • Create overly complex nested structures
  • Use generic field names
  • Extract entire documents as single fields
  • Assume all fields will always exist

Next Steps

Quickstart Guide

See more examples

Schema Endpoint

Apply schemas to extracted documents