Back to Changelog

Structured Outputs with JSON Schema

Structured Outputs with JSON Schema

Structured Outputs ensure AI-generated responses adhere to a JSON schema you define, eliminating the need to validate or retry incorrectly formatted responses.

When you provide a prompt to the /v2/scrape endpoint, you can now add a response_schema parameter to enforce strict JSON Schema validation. The API will return guaranteed structured data that matches your schema every time.

Perfect for:

  • Data Extraction: Extract product info, business details, or any structured data with type safety
  • Reliable Parsing: No more validating or handling malformed JSON responses
  • Complex Structures: Support for nested objects, arrays, enums, and optional fields
  • API Integration: Feed predictable data directly into your application or database

What's new?

  • JSON Schema Validation: Define exact structure using standard JSON Schema format
  • Type Safety: Guaranteed response format with string, number, boolean, object, array, and enum types
  • Nested Structures: Support for complex nested objects and arrays of objects
  • Enum Constraints: Restrict values to predefined options
  • Optional Fields: Use null union types for fields that may not always be present
  • Clear Error Handling: Validation errors returned immediately if schema is invalid

Pricing

Structured outputs cost the same as regular prompts: $0.002 per request (in addition to the base crawling cost).

See the Structured Outputs documentation for schema examples and complete usage guide.