Skip to content

Create Event



POST /api/v1/events/create

Overview

Asynchronously writes a custom event with df_source=custom to the current workspace.

Before You Call and Usage Steps

Prepare a 13-digit Unix millisecond date, a non-empty title, and the required status. A successful creation with content=true only indicates that a write task has been submitted; it does not return an event ID or guarantee that the data has been stored. Later, you can confirm the write through a DQL query by df_source=custom, title, or custom fields. Abnormal statuses can also be viewed in the Unrecovered Events list. Subsequent events for the same business object can reuse customTags.monitor_checker_event_ref; each write still creates a new df_event_id, and this correlation value is not an idempotency key. To end the same custom event group, call this API again to write an event with the same correlation value and status=ok; manual recover applies to the monitor source. Before a timeout or retry, first query whether the event has already been written to avoid duplicate events. This API uses the workspace to which the current API Key belongs and does not declare cross-workspace or cross-site parameters. For other workspaces or sites, call the corresponding site Endpoint with the API Key of the corresponding workspace separately.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to obtain or fill: Obtain an OpenAPI Key with this operation permission from API Key management in the target workspace.

Body Request Parameters

Parameter Type Required Description
customTags.<key> string/number/boolean Any custom business field. Consecutive df_ prefixes at the beginning of the field name are stripped, e.g. df_df_service is written as service; avoid duplicate names after normalization.
Example: checkout-api
How to obtain or fill: Name it according to business meaning, for example service, env; keep a stable type for the same field.
customTags.monitor_checker_event_ref string Optional custom event correlation identifier. You can also pass df_monitor_checker_event_ref; after prefix normalization, the effect is the same. If omitted or empty, the server generates a new identifier each time.
Example: checkout-prod-latency
How to obtain or fill: Generate and save a stable identifier on the business side for the same trigger object; for example, service + environment + check item.
date integer Y Event generation time, Unix milliseconds; current validation requires 13 digits.
Nullable: False
Example: 1785430800000
How to obtain or fill: Use the actual time when the business event occurred, such as the result of JavaScript Date.getTime(), as a 13-digit positive integer in milliseconds.
status string Y Event status, required; do not omit or rely on a default value.
Nullable: False
Allowed values: ['fatal', 'critical', 'error', 'warning', 'ok', 'info', 'nodata']
Example: critical
How to obtain or fill: Select fatal, critical, error, warning, or nodata based on the business anomaly level; use ok for normal recovery and info for informational records.
title string Y Event title, required; an empty string will not be written by the backend.
Nullable: False
Example: checkout-api response time exceeds threshold
How to obtain or fill: Enter a concise, non-empty business title to facilitate search and identification.
message string Detailed description; if omitted, an empty string is used.
Nullable: False
Example: The average response time over the last 5 minutes exceeded 500 ms.
How to obtain or fill: Enter the business symptom, threshold, metric, and necessary context; do not include sensitive information such as secrets.
origin string Optional source tag, written to df_origin; does not change the fixed df_source=custom.
Nullable: False
Example: release
How to obtain or fill: Enter a custom source tag as required by the business, for example release; if omitted, the tag is not added.
customTags json Custom field JSON object; if omitted or {}, no ordinary business fields are added. It is recommended to use explicit types such as strings, numbers, and booleans.
Nullable: False
Example: {"service": "checkout-api", "env": "production", "monitor_checker_event_ref": "checkout-prod-latency"}
How to obtain or fill: Obtain field names and values from the business context; see Event field reference. The caller should generate and save custom correlation identifiers in a stable manner.

Additional Parameter Notes

Although the name customTags contains Tags, these ordinary custom fields are written to event fields; you cannot assume from the name that all of them are index tags. monitor_checker_event_ref is specifically used to generate df_monitor_checker_event_ref. For complex values, explicitly serialize them to JSON strings as required by the business to avoid inconsistent data types. After writing, when other queries provide __docid, you can use Event Details to retrieve details.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/events/create' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"date":1785430800000,"status":"critical","title":"checkout-api response time exceeds threshold","message":"The average response time over the last 5 minutes exceeded 500 ms.","customTags":{"service":"checkout-api","env":"production","monitor_checker_event_ref":"checkout-prod-latency"}}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content boolean true indicates that the asynchronous event write task has been submitted; there is no document ID, task ID, or storage confirmation field.
{
  "code": 200,
  "content": true,
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

A backend write failure does not retroactively modify the HTTP 200 that has already been returned, nor does it return a DataWay error in this response; confirm the result through a subsequent event query.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed Request field is missing, or the field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Request JSON syntax is invalid Request JSON format error Correct the JSON according to content.reason, line, and column.
400 ft.JsonFormatError JSON top level is not an object Partial JSON file format error Submit a single JSON object; do not pass an array or string.
406 ft.NotMillisecondTimestamp date is not a 13-digit millisecond timestamp that meets the current validation Not a valid millisecond-level timestamp Use a 13-digit Unix millisecond integer; do not submit 10-digit seconds or strings with units.
500 ft.InternalServerError Workspace query or task submission failed Internal error First query whether the same business event has already been written, then decide whether to retry; if the failure persists, provide traceId.

Feedback

Is this page helpful?