What is structured data?
When you scrape with aprompt, the AI reads the page and returns whatever JSON it decides makes sense. The shape can vary between runs. A field might appear with a different name. A field might be missing if the AI was not confident. If you are saving results to a database or processing them in code, this inconsistency is a problem.
Structured output solves this. You add a schema to your request that describes the exact shape you want. The AI must return JSON that matches that shape exactly, with the field names, types, and nesting you defined. If the AI cannot find a value for a field, it writes null instead of skipping the field.
Without a schema, asking for job details might give you:

JSON Schema Generator
Build and preview your schema visually — no JSON knowledge required. Copy the output and paste it directly into your request.
Basic example
Add aschema field to your scrape request alongside your prompt. The schema is a standard JSON Schema object.
result.content will look like this when all the data is on the page:
null means the AI looked for it and could not find it. The field is always there.
Using Zod or Pydantic?
Skip writing JSON Schema by hand. Generate it directly from your existing Zod or Pydantic model.
The required rule
This is the most important thing to understand about how structured data works. Fields listed inrequired are always in the output. If the AI cannot find a value, it writes null. The field is never missing.
Fields not in required may be omitted. If the AI has no evidence for an optional field, it leaves it out of the response entirely rather than guessing.
A concrete example. Say your schema has these properties:
required is ["title", "company"], and the page has no salary or benefits info:
required is ["title", "company", "salary", "benefits"], and the page still has no salary or benefits info:
required when you need it to always be present in your output, even as null. Leave it out of required when you are fine with it being absent if there is nothing to extract.
Nullable fields
To make a field nullable, pass the type as an array that includes"null":
null.
This works for all types:
Enum fields
Useenum to restrict a field to a specific set of values. Include null in the enum list to allow null as a valid value.
null.
Be careful with required enum fields. If the field is in
required and the AI cannot find clear evidence for any of your enum values, it must still write something. It will either pick the closest match or write null if you included it in the enum. Always include null in your enum when the field might not always appear on the page.Nested objects
Your schema can include nested objects. Just defineproperties inside a properties value, the same way you would in any JSON Schema.
Arrays of objects
To extract a list of items where each item has a fixed shape, use an array with anitems definition.
null for price rather than being skipped.
Using prompt alongside schema
prompt and schema are designed to work together. The schema controls the output shape. The prompt guides how the AI interprets and normalizes the page content before filling in the schema.
Use prompt to give the AI instructions about normalization, what to look for, or what to ignore:
Generating schemas with Zod or Pydantic
Spidra accepts standard JSON Schema. You can write that JSON by hand, or you can use a schema validation library in your own code to generate it. Zod (JavaScript / TypeScript)The full response
When your scrape job completes, pollGET /scrape/{jobId} as usual. The structured data appears in result.content as a parsed JSON object, not a string.
schema, the job will fail rather than fall back to raw markdown when AI extraction cannot complete. This is intentional. When you pass a schema, you are expecting a specific shape, and returning unstructured markdown would be silently wrong.
Schema warnings
Some JSON Schema keywords are not supported by the AI model. If your schema includes them, Spidra strips them before processing and returns aschema_warnings list in the job status response so you know what was ignored.
type, properties, required, items, enum, nullable, description
Not supported: $ref, anyOf, oneOf, allOf, not, if, then, else, $defs, definitions, prefixItems
Schema validation errors
If your schema has a structural problem, the API returns a422 error before the job is queued. No credits are used.
Root schema must be type 'object' Your top-level schema must be { "type": "object", "properties": { ... } }. Passing an array or a plain string type at the root is not allowed.
Schema exceeds maximum nesting depth of 5 Your schema has more than 5 levels of nested objects. Flatten the structure or move deeply nested data into a string field that the AI formats itself.
Schema exceeds maximum size The schema JSON is over 10KB. Remove unused fields or descriptions to bring it under the limit.
Submit a Scrape Job
Full API reference for the POST /scrape endpoint
Browser Actions
Combine structured output with forEach to extract lists of items

