Skip to content

Datastore API

DRAFT — Internal Developer Use Only

This API reference is for internal development teams.

Overview

What it is: The Datastore API provides direct access to Hydden's entity and edge storage layer. It supports retrieving collection metadata, querying entities with filtering and history, creating/updating/deleting entities and edges, and managing the datastore module configuration. For backup/restore operations, see the Backup & Restore API.

Source: src/datastore/rest/rest.go

Base Path

/internal/v1/datastore

Authentication

All endpoints require JWT cookie or API token authentication.

Endpoints

MethodPathDescription
GET/internal/v1/datastore/infoGet collection store information
GET/internal/v1/datastore/shard/infoGet shard replication information
POST/internal/v1/datastore/fetchFetch entities with filtering and transformation
GET/internal/v1/datastore/entity/:target/:idGet a single entity
PUT/internal/v1/datastore/entity/:target/:idCreate or update an entity
DELETE/internal/v1/datastore/entity/:target/:idDelete an entity
PUT/internal/v1/datastore/edge/:target/:from/:toCreate or update an edge (relationship)
GET/internal/v1/datastore/module/configGet datastore module configuration
POST/internal/v1/datastore/module/configUpdate datastore module configuration

GET /internal/v1/datastore/info

Get information about collection data stores, including view times, entity counts, and replication node details.

Request:

http
GET /internal/v1/datastore/info
Authorization: Bearer <token>

Response (200):

json
{
  "viewTime": 1707700800000,
  "maxTime": 1707700800000,
  "stores": [
    {
      "id": "ds-uuid",
      "viewTime": 1707700800000,
      "count": 4521,
      "nodes": [
        { "id": "node-1", "name": "Primary", "cloud": false, "online": true, "count": 4521 }
      ],
      "tombstoned": false,
      "name": "Corporate AD",
      "platform": "Active Directory",
      "version": 42
    }
  ],
  "historical": false,
  "node": "node-1",
  "cached": false,
  "version": 42
}

Response fields (CollectionInfo):

FieldTypeDescription
viewTimeint64Current view timestamp (ms)
maxTimeint64Maximum available timestamp
storesarrayCollection store entries
stores[].idstringData source ID
stores[].countint64Number of entities in this store
stores[].namestringData source display name
stores[].platformstringPlatform type (Active Directory, Azure AD, etc.)
stores[].nodesarrayReplication nodes holding this store
stores[].tombstonedboolWhether the store is soft-deleted
historicalboolWhether viewing historical data
nodestringResponding node ID
cachedboolWhether the response is from cache

GET /internal/v1/datastore/shard/info

Get shard distribution and replication information across all nodes.

Request:

http
GET /internal/v1/datastore/shard/info
Authorization: Bearer <token>

Response (200):

json
{
  "replicas": 2,
  "stores": 12,
  "total": 45230,
  "nodes": [
    {
      "id": "node-1",
      "name": "Primary",
      "cloud": false,
      "online": true,
      "count": 45230,
      "stores": [],
      "version": 42
    }
  ],
  "node": "node-1",
  "cached": false
}

Response fields (ReplicationInfo):

FieldTypeDescription
replicasint64Configured replication factor
storesint64Total number of collection stores
totalint64Total entity count across all stores
nodesarrayReplication nodes with status and entity counts
nodes[].onlineboolWhether the node is currently reachable
nodes[].cloudboolWhether this is a cloud node

POST /internal/v1/datastore/fetch

Fetch entities from a collection store with optional filtering and transformation. Results are streamed as a JSON array.

Request:

http
POST /internal/v1/datastore/fetch
Content-Type: application/json
Authorization: Bearer <token>
json
{
  "dataSourceId": "ds-uuid",
  "entity": {
    "entityType": "identity.user",
    "time": 1707700800000
  }
}

Query parameters:

ParameterTypeDescription
limitintMaximum entities to return
filterstringFilter expression applied to entities
transformstringTransform function applied to results

Response (200): Streaming JSON array of entities (chunked transfer encoding).

json
[
  {
    "uniqueId": "acct-uuid-1",
    "entityType": "identity.user",
    "displayName": "John Doe",
    "email": "john.doe@company.com"
  }
]

GET /internal/v1/datastore/entity/:target/:id

Get a single entity by data source ID and entity ID, with optional history.

Request:

http
GET /internal/v1/datastore/entity/:target/:id
Authorization: Bearer <token>

Path parameters:

ParameterDescription
targetData source ID
idEntity ID (base64 encoded)

Query parameters:

ParameterTypeDescription
historyboolInclude entity change history (default: false)
layerint[]Specific data layers to fetch (repeatable)

Response (200):

json
{
  "id": "acct-uuid",
  "dataSourceId": "ds-uuid",
  "type": "identity.user",
  "entity": {
    "displayName": "John Doe",
    "email": "john.doe@company.com",
    "upn": "jdoe@corp.local"
  },
  "time": 1707700800000,
  "tombstoned": false,
  "version": 5,
  "storeVersion": 42,
  "layers": [1, 2],
  "history": [
    {
      "time": 1707614400000,
      "tombstoned": false,
      "entity": {},
      "layers": [1]
    }
  ]
}

Response fields (TargetEntity):

FieldTypeDescription
idstringEntity unique ID
dataSourceIdstringData source ID
typestringEntity type identifier
entityobjectDeserialized entity data
timeint64Last modification timestamp (ms)
tombstonedboolWhether the entity is soft-deleted
versionuint64Entity version number
storeVersionuint64Collection store version
layersint64[]Data layers present for this entity
historyarrayHistorical versions (when ?history=true)

PUT /internal/v1/datastore/entity/:target/:id

Create or update an entity in the datastore.

Request:

http
PUT /internal/v1/datastore/entity/:target/:id?type=identity.user
Content-Type: application/json
Authorization: Bearer <token>

Path parameters:

ParameterDescription
targetData source ID
idEntity ID

Query parameters:

ParameterTypeRequiredDescription
typestringYesEntity type (e.g., identity.user, identity.group)

Request body: JSON entity matching the protobuf schema for the specified type.

json
{
  "displayName": "John Doe",
  "email": "john.doe@company.com"
}

Response (200): JSON echo of the stored entity.


DELETE /internal/v1/datastore/entity/:target/:id

Delete an entity from the datastore (creates a tombstone marker).

Request:

http
DELETE /internal/v1/datastore/entity/:target/:id
Authorization: Bearer <token>

Response (200): Empty response on success.


PUT /internal/v1/datastore/edge/:target/:from/:to

Create or update a relationship edge between two entities.

Request:

http
PUT /internal/v1/datastore/edge/:target/:from/:to?type=edge.identity.manager
Content-Type: application/json
Authorization: Bearer <token>

Path parameters:

ParameterDescription
targetData source ID
fromSource entity ID
toTarget entity ID

Query parameters:

ParameterTypeRequiredDescription
typestringYesEdge type (must start with edge., e.g., edge.identity.manager, edge.identity.account)

Request body: JSON edge properties.

Response (200): JSON edge with computed unique ID.


GET /internal/v1/datastore/module/config

Get the datastore module configuration, including replication settings and node assignments.

Request:

http
GET /internal/v1/datastore/module/config
Authorization: Bearer <token>

Response (200):

json
{
  "id": "datastore-module",
  "name": "Datastore",
  "replicas": 2,
  "weights": {
    "node-1": 100,
    "node-2": 100
  },
  "nodes": [
    { "id": "node-1", "name": "Primary", "tenant": "tenant-uuid" },
    { "id": "node-2", "name": "Secondary", "tenant": "tenant-uuid" }
  ],
  "version": 5,
  "site": "us-east-1",
  "refresh": false
}

Response fields (ModuleConfig):

FieldTypeDescription
idstringModule configuration ID
namestringModule display name
replicasint64Replication factor
weightsmapNode-to-weight mapping for data distribution
nodesarrayAssigned nodes
versionuint64Configuration version
sitestringDeployment site identifier
refreshboolWhether a refresh is pending

POST /internal/v1/datastore/module/config

Update the datastore module configuration.

Request:

http
POST /internal/v1/datastore/module/config
Content-Type: application/json
Authorization: Bearer <token>

Request body uses the same ModuleConfig structure. The id field is required.

Response (200): Updated ModuleConfig.


Error Responses

StatusDescription
400Invalid request body, missing type parameter, or invalid entity ID encoding
403Authentication failed or insufficient permissions
404Entity or data source not found
500Internal server error

Hydden Documentation and Training Hub