Skip to main content

Schemas API

Manage Schema.org-style reusable metadata schemas for nodes. Schemas define the expected structure of metadata.properties for specific node types.

Overview

Schemas allow you to:

  • Define structured metadata templates for node types
  • Validate node metadata against schemas
  • Share schemas publicly or keep them private to your app
  • Version schemas with URI-based resolution

Endpoints

GET /schemas

GET List available schemas.

curl -X GET "https://api.ofself.ai/api/v1/schemas" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123"

Query Parameters:

ParameterTypeDescription
categorystringFilter by category
searchstringSearch schema names, descriptions, and URIs
scopestringpublic or private
ownerstringsystem or user — filter by ownership
recommendedbooleanFilter to schemas flagged as recommended by developer
idsstringComma-separated schema IDs to fetch specific schemas
used_by_mebooleanOnly return schemas used by the current user's nodes
include_json_schemabooleanInclude the full JSON Schema definition (default: false)
limitintegerMax results per page (default: 50, max: 100)
offsetintegerPagination offset (default: 0)

Visibility rules:

  • System schemas: Always visible to all users
  • Public schemas (scope='public'): Visible to all users
  • Private schemas (scope='private', private_to='user'): Only visible to the owner
  • App-private schemas (scope='private', private_to='app'): Only visible to the creating third-party app

GET /schemas/:schema_id

GET Get a specific schema by ID.

curl -X GET "https://api.ofself.ai/api/v1/schemas/schema-uuid" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123"

Query Parameters:

ParameterTypeDescription
resolvebooleanResolve parent schema if extends is set (default: false)
include_json_schemabooleanInclude the JSON Schema definition (default: true)

GET /schemas/uri/:schema_uri

GET Resolve a schema by URI (with optional version).

curl -X GET "https://api.ofself.ai/api/v1/schemas/uri/ofself.ai/meeting-notes?version=2" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123"

If no version is specified, returns the latest version.


POST /schemas

POST Create a new schema.

curl -X POST "https://api.ofself.ai/api/v1/schemas" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{
"name": "Meeting Notes",
"description": "Schema for meeting note nodes",
"category": "productivity",
"recommended_node_type": "meeting_notes",
"recommended_meaning_level": "CONTEXT",
"scope": "public",
"json_schema": {
"type": "object",
"properties": {
"attendees": { "type": "array", "items": { "type": "string" } },
"duration_minutes": { "type": "integer" },
"action_items": { "type": "array", "items": { "type": "string" } }
},
"required": ["attendees"]
}
}'

Request Body:

FieldTypeRequiredDescription
namestringYesSchema name
descriptionstringNoSchema description
categorystringNoCategory for grouping
recommended_node_typestringNoSuggested node_type when using this schema
recommended_meaning_levelstringNoSuggested meaning_level
scopestringNopublic (default) or private
private_tostringNouser or app (required when scope is private)
schema_uristringNoCustom URI identifier (auto-generated from name if omitted)
extendsstringNoParent schema ID to inherit properties from
recommended_by_developerbooleanNoFlag schema as recommended (default: false)
schema_metadataobjectNoArbitrary metadata to attach to the schema
json_schemaobjectYesJSON Schema definition for metadata.properties

Response: 201 Created


PUT /schemas/:schema_id

PUT Update a schema (creates a new version).

curl -X PUT "https://api.ofself.ai/api/v1/schemas/schema-uuid" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{
"description": "Updated schema",
"json_schema": { ... }
}'

DELETE /schemas/:schema_id

DELETE Soft-delete a schema.

curl -X DELETE "https://api.ofself.ai/api/v1/schemas/schema-uuid" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123"

POST /schemas/:schema_id/validate

POST Validate metadata against a schema.

curl -X POST "https://api.ofself.ai/api/v1/schemas/schema-uuid/validate" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{
"metadata": {
"attendees": ["Alice", "Bob"],
"duration_minutes": 30
}
}'

Response: 200 OK

{
"valid": true,
"errors": []
}

Or if invalid:

{
"valid": false,
"errors": ["'attendees' is a required property"]
}

GET /schemas/categories

GET List available schema categories.

curl -X GET "https://api.ofself.ai/api/v1/schemas/categories" \
-H "X-API-Key: your-api-key" \
-H "X-User-ID: user-123"

Using Schemas with Nodes

When creating nodes, you can reference a schema to ensure metadata conforms to the expected structure:

# Create a node with schema-validated metadata
response = requests.post(
"https://api.ofself.ai/api/v1/nodes",
headers={"X-API-Key": API_KEY, "X-User-ID": USER_ID},
json={
"title": "Weekly Team Standup",
"node_type": "meeting_notes",
"meaning_level": "DATA",
"graph_view": "identity",
"schema_id": "meeting-notes-schema-uuid",
"metadata": {
"properties": {
"attendees": ["Alice", "Bob", "Charlie"],
"duration_minutes": 15,
"action_items": ["Review PR #42", "Update docs"]
}
}
}
)