2. Define a Collection
Define a Collection
To store data in SecretVault, you'll need to define a Collection with a JSON Schema, which creates a structured container for your records (individual pieces of data). This has two main effects:
Creates a Collection in SecretVault for your data
Links the Collection to your Organization and validates all records before storage, ensuring they adhere to the JSON Schema
1. Plan Your Collection's Data Structure
Sketch out your data structure to plan the fields and types that will define your collection's JSON schema.
2. Create the JSON Schema
Convert your data structure into a JSON Schema following these requirements:
Use JSON Schema draft-07, type "array"
Each record needs a unique _id (UUID format, coerce: true)
Use "date-time" format for dates (coerce: true)
Remember to take into account the type for fields that you want to encrypt using %allot/%share
Mark required fields (_id is always required)
Set additionalProperties to false
Avoid "$" prefix in field names to prevent query conflicts
Note: System adds _created and _updated fields automatically
Use a JSON Schema validator tool to make sure your collection's schema is valid.
3. Use the Create Schema API to Create your Schema and Collection
Decide on a collection name and generate a UUID4 for the Collection ID (use identical UUID across all Cluster nodes).
Select which fields should act as primary keys / unique identifiers (_id
should always be included).
Then use the Create Schema endpoint to upload your JSON schema to each node in your organization using valid API tokens for each node.
Schema collections are immutable. If you need to make changes to your schema, use the DELETE /schema
API endpoint to delete your current schema, then redo this step to re-create your updated schema.
Last updated