Actions14
- Document Actions
- Block Actions
- Collection Actions
- Search Actions
Collection → Get Schema
AI-generatedSummary
Retrieve the schema definition for a specified collection in Craft Documents, optionally formatted as JSON Schema for validation or as a structural schema listing the collection's properties.
Inputs
- Collection Name or ID (required) — Select a collection by name or ID to retrieve its schema. You can choose from the list loaded dynamically via getCollections or specify the ID using an expression.
- Schema Format — Choose the format of the returned schema: either 'JSON Schema (for Validation)' which provides a JSON Schema suitable for validating collection items, or 'Schema Structure' which returns the collection schema structure (property names, types, etc.). Defaults to JSON Schema.
Output shape
a JSON object representing the collection's schema, formatted either as a JSON Schema for item validation or a schema structure listing name, properties, and types.
The returned schema corresponds to the collection identified by Collection Name or ID. This operation performs an HTTP GET request to the endpoint /collections/{collectionId}/schema with an optional query parameter 'format' to specify the schema format. No pagination or additional envelopes are involved.
Examples
Example 1: Fetch JSON Schema for validation from a specific collection
Provide the collection ID and select 'JSON Schema (for Validation)' as the format to receive a JSON Schema object for validating collection items.