{"openapi":"3.0.3","info":{"title":"datafold","description":"A distributed data platform with schema-based storage and AI-powered ingestion","contact":{"name":"Tom Tang","email":"tom@datafold.ai"},"license":{"name":"MIT OR Apache-2.0"},"version":"0.1.0"},"paths":{"/api/ingestion/config":{"get":{"tags":["ingestion"],"summary":"Get Ingestion configuration","operationId":"get_ingestion_config","responses":{"200":{"description":"Ingestion config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/crate.ingestion.config.IngestionConfig"}}}}}},"post":{"tags":["ingestion"],"summary":"Save Ingestion configuration","operationId":"save_ingestion_config","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/crate.ingestion.config.SavedConfig"}}},"required":true},"responses":{"200":{"description":"Saved"},"500":{"description":"Failed"}}}},"/api/ingestion/health":{"get":{"tags":["ingestion"],"summary":"Health check endpoint for ingestion service","operationId":"health_check","responses":{"200":{"description":"Health OK","content":{"application/json":{"schema":{}}}},"503":{"description":"Health not OK","content":{"application/json":{"schema":{}}}}}}},"/api/ingestion/process":{"post":{"tags":["ingestion"],"summary":"Process JSON ingestion request","operationId":"process_json","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/crate.ingestion.core.IngestionRequest"}}},"required":true},"responses":{"200":{"description":"Ingestion response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/crate.ingestion.IngestionResponse"}}}}}}},"/api/ingestion/status":{"get":{"tags":["ingestion"],"summary":"Get ingestion status","operationId":"get_status","responses":{"200":{"description":"Ingestion status","content":{"application/json":{"schema":{}}}}}}},"/api/ingestion/validate":{"post":{"tags":["ingestion"],"summary":"Validate JSON data without processing","operationId":"validate_json","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"description":"Validation result","content":{"application/json":{"schema":{}}}},"400":{"description":"Invalid"}}}},"/api/logs":{"get":{"tags":["logs"],"summary":"List current logs (backward compatibility)","operationId":"list_logs","responses":{"200":{"description":"List logs","content":{"application/json":{"schema":{}}}}}}},"/api/logs/config":{"get":{"tags":["logs"],"summary":"Get current logging configuration","operationId":"get_config","responses":{"200":{"description":"Logging configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogConfigResponse"}}}}}}},"/api/logs/config/reload":{"post":{"tags":["logs"],"summary":"Reload logging configuration from file","operationId":"reload_config","responses":{"200":{"description":"Reloaded"},"400":{"description":"Bad request"}}}},"/api/logs/features":{"get":{"tags":["logs"],"summary":"Get available log features and their current levels","operationId":"get_features","responses":{"200":{"description":"Features","content":{"application/json":{"schema":{}}}}}}},"/api/logs/level":{"put":{"tags":["logs"],"summary":"Update feature-specific log level at runtime","operationId":"update_feature_level","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogLevelUpdate"}}},"required":true},"responses":{"200":{"description":"Updated"},"400":{"description":"Bad request"},"500":{"description":"Server error"}}}},"/api/logs/stream":{"get":{"tags":["logs"],"summary":"Stream logs via Server-Sent Events (backward compatibility)","operationId":"stream_logs","responses":{"200":{"description":"Stream logs"}}}},"/api/mutation":{"post":{"tags":["query"],"summary":"Execute a mutation.","operationId":"execute_mutation","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"description":"Mutation result","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request"},"500":{"description":"Server error"}}}},"/api/query":{"post":{"tags":["query"],"summary":"Execute a query.","operationId":"execute_query","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"description":"Query result","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request"},"500":{"description":"Server error"}}}},"/api/schema/{name}":{"get":{"tags":["schemas"],"summary":"Get a schema by name.","operationId":"get_schema","parameters":[{"name":"name","in":"path","description":"Schema name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/crate.schema.types.schema.Schema"}}}},"404":{"description":"Schema not found"},"500":{"description":"Server error"}}}},"/api/schema/{name}/approve":{"post":{"tags":["schemas"],"summary":"List schemas by specific state","description":"Approve a schema for queries and mutations","operationId":"approve_schema","parameters":[{"name":"name","in":"path","description":"Schema name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Approved"},"500":{"description":"Server error"}}}},"/api/schema/{name}/block":{"post":{"tags":["schemas"],"summary":"Block a schema from queries and mutations","operationId":"block_schema","parameters":[{"name":"name","in":"path","description":"Schema name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Blocked"},"500":{"description":"Server error"}}}},"/api/schemas":{"get":{"tags":["schemas"],"summary":"List all schemas.","operationId":"list_schemas","responses":{"200":{"description":"List of schemas"},"500":{"description":"Server error"}}}},"/api/security/system-key":{"get":{"tags":["security"],"operationId":"get_system_public_key","responses":{"200":{"description":"System key"},"404":{"description":"Not found"}}}},"/api/system/private-key":{"get":{"tags":["system"],"summary":"Get the node's private key","description":"This endpoint returns the node's private key for use by the UI.\nThe private key is generated automatically when the node is created.","operationId":"get_node_private_key","responses":{"200":{"description":"Node private key","content":{"application/json":{"schema":{}}}}}}},"/api/system/public-key":{"get":{"tags":["system"],"summary":"Get the node's public key","description":"This endpoint returns the node's public key for verification purposes.\nThe public key is generated automatically when the node is created.","operationId":"get_node_public_key","responses":{"200":{"description":"Node public key","content":{"application/json":{"schema":{}}}}}}},"/api/system/reset-database":{"post":{"tags":["system"],"summary":"Reset the database and restart the node","description":"This endpoint completely resets the database by:\n1. Stopping network services\n2. Closing the current database\n3. Recreating a new database instance\n4. Clearing all data and state\n\nThis is a destructive operation that cannot be undone.","operationId":"reset_database","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetDatabaseRequest"}}},"required":true},"responses":{"200":{"description":"Database reset result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetDatabaseResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetDatabaseResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetDatabaseResponse"}}}}}}},"/api/system/status":{"get":{"tags":["system"],"summary":"Get system status information","operationId":"get_system_status","responses":{"200":{"description":"System status","content":{"application/json":{"schema":{}}}}}}},"/api/transforms":{"get":{"tags":["query"],"operationId":"list_transforms","responses":{"200":{"description":"Transforms list","content":{"application/json":{"schema":{}}}},"500":{"description":"Server error"}}}},"/api/transforms/queue":{"get":{"tags":["query"],"operationId":"get_transform_queue","responses":{"200":{"description":"Queue info","content":{"application/json":{"schema":{}}}},"500":{"description":"Server error"}}}},"/api/transforms/queue/{id}":{"post":{"tags":["query"],"operationId":"add_to_transform_queue","parameters":[{"name":"id","in":"path","description":"Transform id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Queued"},"500":{"description":"Server error"}}}}},"components":{"schemas":{"KeyConfig":{"type":"object","properties":{"hash_field":{"type":"string","nullable":true},"range_field":{"type":"string","nullable":true}}},"Schema":{"type":"object","description":"Defines the structure, permissions, and payment requirements for a data collection.\n\nA Schema is the fundamental building block for data organization in the database.\nIt defines:\n- The collection's name and identity\n- Field definitions with their types and constraints\n- Field-level permission policies\n- Payment requirements for data access\n- Field mappings for schema transformation\n\nSchemas provide a contract for data storage and access, ensuring:\n- Consistent data structure\n- Proper access control\n- Payment validation\n- Data transformation rules","required":["name","fields"],"properties":{"fields":{"type":"object","description":"Collection of fields with their definitions and configurations","additionalProperties":{"$ref":"#/components/schemas/FieldVariant"}},"hash":{"type":"string","description":"SHA256 hash of the schema content for integrity verification","nullable":true},"key":{"allOf":[{"$ref":"#/components/schemas/KeyConfig"}],"nullable":true},"name":{"type":"string","description":"Unique name identifying this schema"},"schema_type":{"$ref":"#/components/schemas/SchemaType"}}},"SchemaType":{"oneOf":[{"type":"string","description":"Single schema without range semantics","enum":["Single"]},{"type":"object","required":["Range"],"properties":{"Range":{"type":"object","description":"Schema that stores data in a key range","required":["keyconfig"],"properties":{"keyconfig":{"$ref":"#/components/schemas/KeyConfig"}}}}},{"type":"object","required":["HashRange"],"properties":{"HashRange":{"type":"object","description":"Schema that uses hashed and ranged keys for partitioning","required":["keyconfig"],"properties":{"keyconfig":{"$ref":"#/components/schemas/KeyConfig"}}}}}],"description":"Represents the schema-level type information."}}},"tags":[{"name":"schemas","description":"Schema management endpoints"},{"name":"query","description":"Query and mutation endpoints"},{"name":"security","description":"Security and key management endpoints"},{"name":"system","description":"System management endpoints"},{"name":"logs","description":"Logging endpoints"},{"name":"ingestion","description":"Ingestion endpoints"}]}