{ "components": { "parameters": { "txn": { "description": "Transaction id", "in": "header", "name": "x-defradb-tx", "schema": { "format": "int64", "type": "integer" } } }, "responses": { "error": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/error" } } }, "description": "error" }, "success": { "description": "ok" } }, "schemas": { "action_execution": { "properties": { "Action": { "maximum": 65535, "minimum": 0, "type": "integer" }, "CollectionID": { "type": "string" }, "Reason": { "type": "string" }, "Status": { "maximum": 65535, "minimum": 0, "type": "integer" }, "Subject": { "type": "string" } }, "type": "object" }, "add_acp_document_relationship_request": { "properties": { "CollectionName": { "type": "string" }, "DocID": { "type": "string" }, "Relation": { "type": "string" }, "TargetActor": { "type": "string" } }, "type": "object" }, "add_acp_node_relationship_request": { "properties": { "Relation": { "type": "string" }, "TargetActor": { "type": "string" } }, "type": "object" }, "add_acp_policy_result": { "properties": { "PolicyID": { "type": "string" } }, "type": "object" }, "add_acp_relationship_result": { "properties": { "ExistedAlready": { "type": "boolean" } }, "type": "object" }, "add_lens_request": { "properties": { "lens": { "properties": { "Lenses": { "items": { "properties": { "Arguments": { "additionalProperties": {}, "type": "object" }, "Inverse": { "type": "boolean" }, "Path": { "type": "string" } }, "type": "object" }, "type": "array" } }, "type": "object" } }, "type": "object" }, "add_lens_response": { "properties": { "lensId": { "type": "string" } }, "type": "object" }, "add_replicator_params": { "properties": { "Addresses": { "items": { "type": "string" }, "type": "array" }, "Collections": { "items": { "type": "string" }, "type": "array" } }, "type": "object" }, "add_view_request": { "properties": { "Query": { "type": "string" }, "SDL": { "type": "string" }, "TransformCID": {} }, "type": "object" }, "backup_config": { "properties": { "collections": { "items": { "type": "string" }, "type": "array" }, "filepath": { "type": "string" }, "format": { "type": "string" }, "pretty": { "type": "boolean" } }, "type": "object" }, "ccip_request": { "properties": { "data": { "type": "string" }, "sender": { "type": "string" } }, "type": "object" }, "ccip_response": { "properties": { "data": { "type": "string" } }, "type": "object" }, "collection": { "properties": { "CollectionID": { "type": "string" }, "CollectionSet": {}, "EncryptedIndexes": { "items": { "properties": { "FieldName": { "type": "string" }, "Type": { "type": "string" } }, "type": "object" }, "type": "array" }, "Fields": { "items": { "properties": { "DefaultValue": {}, "FieldID": { "type": "string" }, "IsPrimary": { "type": "boolean" }, "Kind": {}, "Name": { "type": "string" }, "RelationName": {}, "Size": { "type": "integer" }, "Typ": { "maximum": 255, "minimum": 0, "type": "integer" } }, "type": "object" }, "type": "array" }, "Indexes": { "items": { "properties": { "Fields": { "items": { "properties": { "Descending": { "type": "boolean" }, "Name": { "type": "string" } }, "type": "object" }, "type": "array" }, "ID": { "maximum": 4294967295, "minimum": 0, "type": "integer" }, "Name": { "type": "string" }, "Unique": { "type": "boolean" } }, "type": "object" }, "type": "array" }, "IsActive": { "type": "boolean" }, "IsBranchable": { "type": "boolean" }, "IsEmbeddedOnly": { "type": "boolean" }, "IsMaterialized": { "type": "boolean" }, "IsPlaceholder": { "type": "boolean" }, "Name": { "type": "string" }, "Policy": {}, "PreviousVersion": {}, "Query": {}, "VectorEmbeddings": { "items": { "properties": { "FieldName": { "type": "string" }, "Fields": { "items": { "type": "string" }, "type": "array" }, "Model": { "type": "string" }, "Provider": { "type": "string" }, "Template": { "type": "string" }, "URL": { "type": "string" } }, "type": "object" }, "type": "array" }, "VersionID": { "type": "string" } }, "type": "object" }, "create_tx": { "properties": { "id": { "maximum": 18446744073709552000, "minimum": 0, "type": "integer" } }, "type": "object" }, "delete_acp_document_relationship_request": { "properties": { "CollectionName": { "type": "string" }, "DocID": { "type": "string" }, "Relation": { "type": "string" }, "TargetActor": { "type": "string" } }, "type": "object" }, "delete_acp_node_relationship_request": { "properties": { "Relation": { "type": "string" }, "TargetActor": { "type": "string" } }, "type": "object" }, "delete_acp_relationship_result": { "properties": { "RecordFound": { "type": "boolean" } }, "type": "object" }, "delete_collection": { "properties": { "filter": {} }, "type": "object" }, "delete_replicator_params": { "properties": { "Collections": { "items": { "type": "string" }, "type": "array" }, "ID": { "type": "string" } }, "type": "object" }, "delete_result": { "properties": { "Count": { "format": "int64", "type": "integer" }, "DocIDs": { "items": { "type": "string" }, "type": "array" } }, "type": "object" }, "document": { "additionalProperties": true, "type": "object" }, "encrypted_index": { "properties": { "FieldName": { "type": "string" }, "Type": { "type": "string" } }, "type": "object" }, "error": { "properties": { "error": {} }, "type": "object" }, "get_acp_node_status_result": { "properties": { "Status": { "type": "string" } }, "type": "object" }, "get_peer_info": { "properties": { "Addresses": { "items": { "type": "string" }, "type": "array" }, "ID": { "type": "string" } }, "type": "object" }, "identity": { "properties": { "DID": { "type": "string" }, "PublicKey": { "type": "string" } }, "type": "object" }, "index": { "properties": { "Fields": { "items": { "properties": { "Descending": { "type": "boolean" }, "Name": { "type": "string" } }, "type": "object" }, "type": "array" }, "ID": { "maximum": 4294967295, "minimum": 0, "type": "integer" }, "Name": { "type": "string" }, "Unique": { "type": "boolean" } }, "type": "object" }, "lens_config": { "properties": { "DestinationCollectionVersionID": { "type": "string" }, "Lenses": { "items": { "properties": { "Arguments": { "additionalProperties": {}, "type": "object" }, "Inverse": { "type": "boolean" }, "Path": { "type": "string" } }, "type": "object" }, "type": "array" }, "SourceCollectionVersionID": { "type": "string" } }, "type": "object" }, "new_encrypted_index": { "properties": { "FieldName": { "type": "string" }, "Type": { "type": "string" } }, "type": "object" }, "new_index": { "properties": { "Fields": { "items": { "properties": { "Descending": { "type": "boolean" }, "Name": { "type": "string" } }, "type": "object" }, "type": "array" }, "Name": { "type": "string" }, "Unique": { "type": "boolean" } }, "type": "object" }, "patch_collection_request": { "properties": { "Migration": {}, "Patch": { "type": "string" } }, "type": "object" }, "replicator": { "properties": { "Addresses": { "items": { "type": "string" }, "type": "array" }, "CollectionIDs": { "items": { "type": "string" }, "type": "array" }, "ID": { "type": "string" }, "LastStatusChange": { "format": "date-time", "type": "string" }, "Status": { "maximum": 255, "minimum": 0, "type": "integer" } }, "type": "object" }, "request_graphql": { "properties": { "operationName": { "type": "string" }, "query": { "type": "string" }, "variables": { "additionalProperties": {}, "type": "object" } }, "type": "object" }, "set_migration": { "properties": { "lensId": { "type": "string" } }, "type": "object" }, "update_collection": { "properties": { "filter": {}, "updater": { "type": "string" } }, "type": "object" }, "update_result": { "properties": { "Count": { "format": "int64", "type": "integer" }, "DocIDs": { "items": { "type": "string" }, "type": "array" } }, "type": "object" } }, "securitySchemes": { "bearerToken": { "bearerFormat": "JWT", "description": "A JWT signed client-side with an identity's private key (`alg` is `EdDSA` for an `ed25519` key or `ES256K` for a `secp256k1` key).\n\nRequired payload claims:\n- `sub`: the identity's public key, in hex format.\n- `aud`: hostname(s) of the DefraDB HTTP API the token is valid for (string or list of strings).\n- `exp`: token expiration UNIX timestamp.\n- `nbf`: not-before UNIX timestamp.\n- `key_type`: must match the identity's key type (`secp256k1` or `ed25519`).\n\nFor SourceHub policies, also include `iss` (the identity's `did:key`), `iat`, and `authorized_account` (the SourceHub address).\n\nGenerate an identity with `defradb identity new`. Authentication is optional unless Document Access Control or Node Access Control is enabled, in which case requests on restricted resources must be authenticated; an invalid token yields `403 Forbidden`.\n\nSee https://docs.source.network/defradb/security/authentication for details.", "scheme": "bearer", "type": "http" } } }, "externalDocs": { "description": "Learn more about DefraDB", "url": "https://docs.source.network" }, "info": { "title": "DefraDB API", "version": "1" }, "openapi": "3.0.3", "paths": { "/acp/document/policy": { "post": { "description": "Add a policy using document acp system", "operationId": "dac policy add", "requestBody": { "content": { "text/plain": { "schema": { "type": "string" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_acp_policy_result" } } }, "description": "Add document acp policy result" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "document access control" ] } }, "/acp/document/relationship": { "delete": { "description": "Delete an actor relationship using document acp system", "operationId": "dac relationship delete", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/delete_acp_document_relationship_request" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/delete_acp_relationship_result" } } }, "description": "Delete document acp relationship result" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "document access control" ] }, "post": { "description": "Add an actor relationship using document acp system", "operationId": "dac relationship add", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_acp_document_relationship_request" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_acp_relationship_result" } } }, "description": "Add document acp relationship result" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "document access control" ] } }, "/acp/node/disable": { "post": { "description": "Disable nac", "operationId": "nac disable", "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "node access control" ] } }, "/acp/node/re-enable": { "post": { "description": "Re-enable nac", "operationId": "nac re-enable", "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "node access control" ] } }, "/acp/node/relationship": { "delete": { "description": "Delete an actor relationship using node acp system", "operationId": "nac relationship delete", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/delete_acp_node_relationship_request" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/delete_acp_relationship_result" } } }, "description": "Delete node acp relationship result" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "node access control" ] }, "post": { "description": "Add an actor relationship using node acp system", "operationId": "nac relationship add", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_acp_node_relationship_request" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_acp_relationship_result" } } }, "description": "Add node acp relationship result" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "node access control" ] } }, "/acp/node/status": { "get": { "description": "Check status of node acp system", "operationId": "nac status", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/get_acp_node_status_result" } } }, "description": "Node acp status result" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "node access control" ] } }, "/actions": { "get": { "description": "List information pertaining to long running actions", "operationId": "list_actions", "responses": { "200": { "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/action_execution" }, { "items": { "$ref": "#/components/schemas/action_execution" }, "type": "array" } ] } } }, "description": "Information on incomplete action executions" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "action" ] } }, "/backup/export": { "post": { "description": "Export a database backup to file", "operationId": "export_backup", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/backup_config" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "backup" ] } }, "/backup/import": { "post": { "description": "Import a database backup from file", "operationId": "import_backup", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/backup_config" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "backup" ] } }, "/block/verify-signature": { "get": { "description": "Verify block signature", "operationId": "verify_block", "parameters": [ { "description": "Content ID of the block to verify", "in": "query", "name": "cid", "required": true, "schema": { "type": "string" } }, { "description": "Public key of the block to verify", "in": "query", "name": "public-key", "required": true, "schema": { "type": "string" } }, { "description": "Type of the public key: secp256k1, ed25519", "in": "query", "name": "type", "schema": { "type": "string" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "block" ] } }, "/ccip": { "post": { "description": "CCIP POST endpoint", "operationId": "post_ccip", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ccip_request" } } } }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ccip_response" } } }, "description": "GraphQL response" }, "400": { "$ref": "#/components/responses/error" }, "500": { "$ref": "#/components/responses/error" } }, "tags": [ "ccip" ] } }, "/ccip/{sender}/{data}": { "get": { "description": "CCIP GET endpoint", "operationId": "get_ccip", "parameters": [ { "description": "Hex encoded request data", "in": "path", "name": "data", "required": true, "schema": { "type": "string" } }, { "description": "Hex encoded sender address", "in": "path", "name": "sender", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ccip_response" } } }, "description": "GraphQL response" }, "400": { "$ref": "#/components/responses/error" }, "500": { "$ref": "#/components/responses/error" } }, "tags": [ "ccip" ] } }, "/collections": { "delete": { "description": "Delete one or more collections. The 'name' query parameter accepts a comma-separated (CSV) list of collection names. By default every version of each named collection is deleted; set 'active-only=true' to delete only the active head version and keep earlier versions intact.", "operationId": "delete_collection", "parameters": [ { "in": "query", "name": "name", "required": true, "schema": { "type": "string" } }, { "in": "query", "name": "active-only", "schema": { "type": "boolean" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] }, "get": { "description": "Introspect collection(s) by name, collection id, or version id.", "operationId": "describe_collection", "parameters": [ { "description": "Collection name", "in": "query", "name": "name", "schema": { "type": "string" } }, { "description": "Collection ID", "in": "query", "name": "collection_id", "schema": { "type": "string" } }, { "description": "Collection version ID", "in": "query", "name": "version_id", "schema": { "type": "string" } }, { "description": "If true, inactive collections will be returned in addition to active ones", "in": "query", "name": "get_inactive", "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/collection" }, { "items": { "$ref": "#/components/schemas/collection" }, "type": "array" } ] } } }, "description": "Collection(s) with matching name, collection id, or version id." }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] }, "patch": { "description": "Update collection definitions", "operationId": "patch_collection", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/patch_collection_request" } } } }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] }, "post": { "description": "Add a new collection", "operationId": "add_collection", "requestBody": { "content": { "text/plain": { "schema": { "type": "string" } } } }, "responses": { "200": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/collection" }, "type": "array" } } }, "description": "Collection(s)" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] } }, "/collections/default": { "post": { "description": "Set the default version for a collection", "operationId": "set_default_collection_version", "requestBody": { "content": { "text/plain": { "schema": { "type": "string" } } } }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] } }, "/collections/indexes": { "get": { "description": "List all indexes for all collections", "operationId": "list_all_indexes", "responses": { "200": { "content": { "application/json": { "schema": { "additionalProperties": { "items": { "$ref": "#/components/schemas/index" }, "type": "array" }, "type": "object" } } }, "description": "Map of collection names to their indexes" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "index" ] } }, "/collections/migrations": { "post": { "description": "Set a lens migration between collection versions", "operationId": "set_collection_migration", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/lens_config" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/set_migration" } } }, "description": "Lens info" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] } }, "/collections/{name}": { "delete": { "description": "Delete document(s) from a collection", "operationId": "delete_collection_with_filter", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/delete_collection" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/delete_result" } } }, "description": "Delete results" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] }, "patch": { "description": "Update document(s) in a collection", "operationId": "update_collection_with_filter", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/update_collection" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/update_result" } } }, "description": "Update results" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "collection" ] }, "post": { "description": "Add document(s) to a collection", "operationId": "add_document", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/document" }, { "items": { "$ref": "#/components/schemas/document" }, "type": "array" } ] } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "description": "The IDs of the added documents" }, "400": { "$ref": "#/components/responses/error" }, "409": { "$ref": "#/components/responses/error" } }, "tags": [ "document" ] } }, "/collections/{name}/document/{docID}": { "delete": { "description": "Delete a document by docID", "operationId": "delete_document", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } }, { "in": "path", "name": "docID", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" }, "404": { "$ref": "#/components/responses/error" } }, "tags": [ "document" ] }, "get": { "description": "Get a document by docID", "operationId": "get_document", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } }, { "in": "path", "name": "docID", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/document" } } }, "description": "Document value" }, "400": { "$ref": "#/components/responses/error" }, "404": { "$ref": "#/components/responses/error" } }, "tags": [ "document" ] }, "patch": { "description": "Update a document by docID", "operationId": "update_document", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } }, { "in": "path", "name": "docID", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" }, "404": { "$ref": "#/components/responses/error" } }, "tags": [ "document" ] } }, "/collections/{name}/encrypted-indexes": { "get": { "description": "List encrypted indexes", "operationId": "list_encrypted_indexes", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/encrypted_index" }, "type": "array" } } }, "description": "List of encrypted indexes" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "encrypted_index" ] }, "post": { "description": "Make a new encrypted index", "operationId": "new_encrypted_index", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/new_encrypted_index" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/encrypted_index" } } }, "description": "Encrypted index description" }, "400": { "$ref": "#/components/responses/error" }, "409": { "$ref": "#/components/responses/error" } }, "tags": [ "encrypted_index" ] } }, "/collections/{name}/encrypted-indexes/{field}": { "delete": { "description": "Delete an encrypted index", "operationId": "delete_encrypted_index", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } }, { "description": "Field name of the encrypted index", "in": "path", "name": "field", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" }, "404": { "$ref": "#/components/responses/error" } }, "tags": [ "encrypted_index" ] } }, "/collections/{name}/indexes": { "get": { "description": "List secondary indexes", "operationId": "list_indexes", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/index" }, "type": "array" } } }, "description": "List of indexes" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "index" ] }, "post": { "description": "Make a new secondary index", "operationId": "new_index", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/new_index" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/index" } } }, "description": "Index description" }, "400": { "$ref": "#/components/responses/error" }, "409": { "$ref": "#/components/responses/error" } }, "tags": [ "index" ] } }, "/collections/{name}/indexes/{index}": { "delete": { "description": "Delete a secondary index", "operationId": "delete_index", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } }, { "in": "path", "name": "index", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" }, "404": { "$ref": "#/components/responses/error" } }, "tags": [ "index" ] } }, "/collections/{name}/truncate": { "delete": { "description": "Truncate a collection, removing all document data within it from the server. Does not propagate the deletion to other Defra nodes in the network.", "operationId": "truncate", "parameters": [ { "description": "Collection name", "in": "path", "name": "name", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "truncate" ] } }, "/debug/dump": { "get": { "description": "Dump database", "operationId": "dump_debug", "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "debug" ] } }, "/encrypted-indexes": { "get": { "description": "List all encrypted indexes for all collections", "operationId": "list_all_encrypted_indexes", "responses": { "200": { "content": { "application/json": { "schema": { "additionalProperties": { "items": { "$ref": "#/components/schemas/encrypted_index" }, "type": "array" }, "type": "object" } } }, "description": "Map of collection names to their encrypted indexes" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "encrypted_index" ] } }, "/graphql": { "get": { "description": "GraphQL GET endpoint", "operationId": "get_graphql", "parameters": [ { "in": "query", "name": "query", "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "properties": { "data": { "additionalProperties": true, "type": "object" }, "errors": { "items": { "properties": { "message": { "type": "string" } }, "type": "object" }, "type": "array" } }, "type": "object" } } }, "description": "GraphQL response" }, "400": { "content": { "application/json": { "schema": { "properties": { "data": { "additionalProperties": true, "type": "object" }, "errors": { "items": { "properties": { "message": { "type": "string" } }, "type": "object" }, "type": "array" } }, "type": "object" } } }, "description": "GraphQL error" } }, "tags": [ "graphql" ] }, "post": { "description": "GraphQL POST endpoint", "operationId": "post_graphql", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/request_graphql" } } } }, "responses": { "200": { "content": { "application/json": { "schema": { "properties": { "data": { "additionalProperties": true, "type": "object" }, "errors": { "items": { "properties": { "message": { "type": "string" } }, "type": "object" }, "type": "array" } }, "type": "object" } } }, "description": "GraphQL response" }, "400": { "content": { "application/json": { "schema": { "properties": { "data": { "additionalProperties": true, "type": "object" }, "errors": { "items": { "properties": { "message": { "type": "string" } }, "type": "object" }, "type": "array" } }, "type": "object" } } }, "description": "GraphQL error" } }, "tags": [ "graphql" ] } }, "/lens": { "get": { "description": "List all stored lenses", "operationId": "list_lenses", "responses": { "200": { "content": { "application/json": { "schema": { "properties": { "lenses": { "type": "object" } }, "type": "object" } } }, "description": "List of stored lenses" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "lens" ] }, "post": { "description": "Add a lens to the lens store", "operationId": "add_lens", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_lens_request" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_lens_response" } } }, "description": "Lens CID" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "lens" ] } }, "/node/identity": { "get": { "description": "Get node's public identity", "operationId": "get_node_identity", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/identity" } } }, "description": "Identity" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "node", "identity" ] } }, "/node/options": { "get": { "description": "Get node configuration options", "operationId": "get_node_options", "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" }, "500": { "$ref": "#/components/responses/error" } }, "tags": [ "node" ] } }, "/p2p/active-peers": { "get": { "operationId": "active_peers", "responses": { "200": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "description": "Connected peers" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/collections": { "delete": { "description": "Delete peer collections", "operationId": "delete_peer_collections", "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] }, "get": { "description": "List peer collections", "operationId": "list_peer_collections", "responses": { "200": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "description": "Peer collections" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] }, "post": { "description": "Add peer collections", "operationId": "add_peer_collections", "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/collections/sync-branchable": { "post": { "description": "Synchronize a branchable collection's DAG from the network", "operationId": "sync_peer_branchable_collection", "requestBody": { "content": { "application/json": { "schema": { "properties": { "collectionName": { "type": "string" }, "timeout": { "type": "string" } }, "type": "object" } } }, "required": true }, "responses": { "200": { "description": "Branchable collection sync completed successfully" }, "400": { "$ref": "#/components/responses/error" }, "500": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/collections/sync-versions": { "post": { "description": "Synchronize collection versions to the local node", "operationId": "sync_peer_collection_versions", "requestBody": { "content": { "application/json": { "schema": { "properties": { "timeout": { "type": "string" }, "versionIDs": { "items": { "type": "string" }, "type": "array" } }, "type": "object" } } }, "required": true }, "responses": { "200": { "description": "Collection synchronization completed successfully" }, "400": { "$ref": "#/components/responses/error" }, "500": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/connect": { "post": { "description": "Connect to peers", "operationId": "connect", "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/disconnect": { "post": { "description": "Disconnect from peers", "operationId": "disconnect", "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/documents": { "delete": { "description": "Delete peer documents", "operationId": "delete_peer_documents", "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] }, "get": { "description": "List peer documents", "operationId": "list_peer_documents", "responses": { "200": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "description": "Peer documents" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] }, "post": { "description": "Add peer documents", "operationId": "add_peer_documents", "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/documents/sync": { "post": { "description": "Synchronize documents from the network", "operationId": "sync_peer_documents", "requestBody": { "content": { "application/json": { "schema": { "properties": { "collectionName": { "type": "string" }, "docIDs": { "items": { "type": "string" }, "type": "array" }, "timeout": { "type": "string" } }, "type": "object" } } }, "required": true }, "responses": { "200": { "description": "Document sync completed successfully" }, "400": { "$ref": "#/components/responses/error" }, "500": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/info": { "get": { "operationId": "get_peer_info", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/get_peer_info" } } }, "description": "Peer network info" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/p2p/replicators": { "delete": { "description": "Delete peer replicators", "operationId": "delete_peer_replicator", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/delete_replicator_params" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] }, "get": { "description": "List peer replicators", "operationId": "list_peer_replicators", "responses": { "200": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/replicator" }, "type": "array" } } }, "description": "Replicators" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] }, "post": { "description": "Add peer replicators", "operationId": "add_peer_replicator", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_replicator_params" } } }, "required": true }, "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "p2p" ] } }, "/purge": { "post": { "description": "Purge all persisted data and restart", "operationId": "purge", "responses": { "200": { "$ref": "#/components/responses/success" }, "403": { "$ref": "#/components/responses/error" } } } }, "/tx": { "post": { "description": "Create a new transaction", "operationId": "new_transaction", "parameters": [ { "description": "Read only transaction", "in": "query", "name": "read_only", "schema": { "default": false, "type": "boolean" } }, { "description": "Transaction idle TTL as a Go duration string, or seconds if no unit is provided", "in": "query", "name": "ttl", "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/create_tx" } } }, "description": "Transaction info" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "transaction" ] } }, "/tx/{id}": { "delete": { "description": "Discard a transaction", "operationId": "discard_transaction", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "format": "int64", "type": "integer" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" }, "404": { "$ref": "#/components/responses/error" } }, "tags": [ "transaction" ] }, "post": { "description": "Commit a transaction", "operationId": "commit_transaction", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "format": "int64", "type": "integer" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" }, "404": { "$ref": "#/components/responses/error" }, "409": { "$ref": "#/components/responses/error" } }, "tags": [ "transaction" ] } }, "/view": { "post": { "description": "Manage database views.", "operationId": "view", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/add_view_request" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/collection" }, { "items": { "$ref": "#/components/schemas/collection" }, "type": "array" } ] } } }, "description": "The added collection and embedded schemas for the added view." }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "view" ] } }, "/view/refresh": { "post": { "description": "Refresh view(s) by name, collection id, or version id.", "operationId": "refresh_view", "parameters": [ { "description": "Collection name", "in": "query", "name": "name", "schema": { "type": "string" } }, { "description": "Collection ID", "in": "query", "name": "collection_id", "schema": { "type": "string" } }, { "description": "Collection version ID", "in": "query", "name": "version_id", "schema": { "type": "string" } }, { "description": "If true, inactive collections will be returned in addition to active ones", "in": "query", "name": "get_inactive", "schema": { "type": "string" } } ], "responses": { "200": { "$ref": "#/components/responses/success" }, "400": { "$ref": "#/components/responses/error" } }, "tags": [ "view" ] } } }, "security": [ {}, { "bearerToken": [] } ], "servers": [ { "description": "DefraDB latest version", "url": "/api" }, { "description": "DefraDB version 0", "url": "/api/v0" }, { "description": "DefraDB version 1", "url": "/api/v1" } ], "tags": [ { "description": "Add, describe, patch, and manage collections", "name": "collection" }, { "description": "Add, get, update, or delete documents", "name": "document" }, { "description": "Add views", "name": "view" }, { "description": "Make, update, or remove indexes", "name": "index" }, { "description": "Migrate documents to and from collection versions", "name": "lens" }, { "description": "Peer-to-peer network operations", "name": "p2p" }, { "description": "Access control system(s)", "name": "acp" }, { "description": "Database transaction operations", "name": "transaction" }, { "description": "Database backup operations", "name": "backup" }, { "description": "GraphQL query endpoints", "name": "graphql" }, { "externalDocs": { "description": "EIP-3668", "url": "https://eips.ethereum.org/EIPS/eip-3668" }, "name": "ccip" } ] }