Events API (preview)

Events API Reference

DataTrails provides two mechanisms for persisting provenance metadata:

  1. Asset based Events: where a series of Events are grounded to a specific Asset.
  2. Asset-free Events (preview) : where events can be correlated across pre-defined Trails.

The Asset-free Events implementation is the future focus of the DataTrails platform providing the capabilities of Asset based events, with broader flexibility, performance and scalability. Asset-free Events are currently in preview, inviting early developer feedback.

The transition to Asset-free Events involves removing the dependency to anchoring Events in an Asset and shifting from mutable Asset Attributes to immutable Event Attributes. To minimize the impact, prior to switching to Asset-free Events, it is recommended to use Event Attributes, rather than Asset Attributes.

Note: For more information on Assets and Asset creation, visit Core Concepts and the Creating an Asset guide.

Events API Examples

Note: If you are looking for a simple way to test DataTrails APIs you might prefer the Postman collection, the YAML runner or the Developers section of the web UI.

Additional YAML examples can be found in the articles in the Overview section.

Event Creation

  • Create the bearer_token and store in a file in a secure local directory with 0600 permissions.

  • Define the Event parameters and store in /tmp/event.json:

    cat > /tmp/event.json <<EOF
    {
      "trails": ["Safety Conformance", "Clouseau"],
      "attributes": {
        "arc_display_type": "Safety Conformance",
        "Safety Rating": "90",
        "inspector": "Clouseau"
      }
    }
    EOF
    
  • Add the request to the Asset record by POSTing it to the resource:

    curl -X POST \
        -H "@$HOME/.datatrails/bearer-token.txt" \
        -H "Content-type: application/json" \
        -d "@/tmp/event.json" \
        https://app.datatrails.ai/archivist/v1/events \
        | jq
    
  • The response:

    {
      "identity": "events/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "attributes": {
        "inspector": "Clouseau",
        "arc_display_type": "Safety Conformance",
        "Safety Rating": "90"
      },
      "trails": [
        "Safety Conformance",
        "Clouseau"
      ],
      "origin_tenant": "tenant/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "created_by": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "created_at": 1736421833577,
      "confirmation_status": "STORED",
      "merklelog_commit": {
        "index": "0",
        "idtimestamp": ""
      }
    }
    

Event Record Retrieval

Event records in DataTrails are assigned UUIDs at creation time and referred to in all future API calls by a their unique identity in the format: events/<event-id>

Note: The current preview limits fetching Events to the Event identity. Querying across event attributes and trails are coming in a future preview.

Fetch Events by Identity

  • Replace the <event-id> below, using the event-id from the created event above: "identity": "events/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx":

    EVENT_ID=<event-id>
    
  • Query the /events API to retrieve the recorded event:

    curl -X GET \
        -H "@$HOME/.datatrails/bearer-token.txt" \
        "https://app.datatrails.ai/archivist/v1/events/$EVENT_ID" | jq
    

Events OpenAPI Docs

post  /archivist/v1/events

Create an event.

Description: Create an event within the datatrails system. The maximum size of the request can be 64kb.

{
  "attributes": {
    "fab": "baz",
    "foo": "bar"
  },
  "trails": [
    "bar",
    "boo"
  ]
}
ParameterTypeDescription
attributesobjectattributes of the event.
trailsarrayspecific trails that the event is part of.

{
  "attributes": {
    "fab": "baz",
    "foo": "bar"
  },
  "confirmation_status": "STORED",
  "created_at": 1730283341,
  "created_by": "members/77d373d6-c646-4ccc-b932-53b5d4d0ffda",
  "identity": "events/08838336-c357-460d-902a-3aba9528dd22",
  "origin_tenant": "tenant/47369fd0-c9da-4ea9-8f0a-d8a56787441b",
  "trails": [
    "bar",
    "boo"
  ]
}
Response ParameterTypeDescription
attributesobjectattributes of the event.
confirmation_statusstringconfirmation status of the event one of STORED|COMMITTED|CONFIRMED.
created_atintegerUnix Epoch timestamp, the number of milliseconds since midnight 1 Jan 1970 UTC, leap seconds excluded of when the event is stored. NOTE: this is NOT the timestamp of when the event was committed to the immutable log.
created_bystringthe member of the log tenant that created the event.
identitystringresource identity of the event.
merklelog_commitobjectmerkle log commit data
origin_tenantstringthe tenant that originally created the event.
trailsarrayspecific trails that the event is part of.
ResponsesDescription
200Returned when an event has successfully been created.
400Returned when the user doesn’t provide a valid create event request.
401Returned when the user is not authenticated to the system.
402Returned when a user exhausts their allowance of events.
403Returned when the user is not authorized to create events.

get  /archivist/v1/events/{uuid}

Get an event based on its unique resource identity.

Description: Get an event based on its unique resource identity.

{
  "attributes": {
    "fab": "baz",
    "foo": "bar"
  },
  "confirmation_status": "STORED",
  "created_at": 1730283341,
  "created_by": "members/77d373d6-c646-4ccc-b932-53b5d4d0ffda",
  "identity": "events/08838336-c357-460d-902a-3aba9528dd22",
  "origin_tenant": "tenant/47369fd0-c9da-4ea9-8f0a-d8a56787441b",
  "trails": [
    "bar",
    "boo"
  ]
}
Response ParameterTypeDescription
attributesobjectattributes of the event.
confirmation_statusstringconfirmation status of the event one of STORED|COMMITTED|CONFIRMED.
created_atintegerUnix Epoch timestamp, the number of milliseconds since midnight 1 Jan 1970 UTC, leap seconds excluded of when the event is stored. NOTE: this is NOT the timestamp of when the event was committed to the immutable log.
created_bystringthe member of the log tenant that created the event.
identitystringresource identity of the event.
merklelog_commitobjectmerkle log commit data
origin_tenantstringthe tenant that originally created the event.
trailsarrayspecific trails that the event is part of.
ResponsesDescription
200Returned when an event has successfully been retrieved.
401Returned when the user is not authenticated to the system.
403Returned when the user is not authorized to retrieve the event.
404Returned when the specified event does not exist for the requesting log tenant.
429Returned when a user exceeds their subscription’s rate limit for requests.

Integrity Protecting Content

Integrity protected content can be hashed within an Event using the Attachments API.