Skip to main content
POST
Create datasource

Restrictions

Usage

  • type_ident must be one of: prometheus, loki, mysql, oracle, postgres, clickhouse, elasticsearch, sls, tencent_cls, victorialogs, redis_node, redis_sentinel, mongodb_mongod, mongodb_mongos, kafka.
  • edge_cluster_name specifies which Monitors edge cluster evaluates rules using this datasource.
  • For elasticsearch, set payload.elasticsearch.deployment to cloud or self-managed.
  • Every call is recorded in the account audit log. Use credential fields only for connection credentials.
See the request/response schemas for all supported types and credential handling. Diagnostic-only types cannot enable alerting. On create omitted enabled defaults to true; on update omission preserves the current value. Explicit null for enabled or alerting_enabled is invalid. Diagnostic passwords and Kafka private keys are omitted from responses unless they are environment references; omit these secrets on update to preserve them, or send an empty string to clear. Other datasource credentials may be returned and must be handled as sensitive.

Authorizations

app_key
string
query
required

App key issued from the Flashduty console under Account → APP Keys. Required on every public API call. Keep it secret — it grants the same access as the owning account.

Body

application/json

Request body for creating or updating a datasource. id is required only for update. address is required for all types except Elasticsearch with deployment=cloud.

type_ident
string
required

Datasource type identifier. Allowed: prometheus, loki, mysql, oracle, postgres, clickhouse, elasticsearch, sls, tencent_cls, victorialogs, redis_node, redis_sentinel, mongodb_mongod, mongodb_mongos, kafka

name
string
required

Datasource display name. This is the name referenced as ds_name in query APIs.

payload
object
required

Type-specific configuration block. Must include the key matching type_ident. For diagnostic types, password and Kafka tls_key are omitted from responses unless they are ${env:...} references. On update, omit those fields to preserve stored secrets; explicitly send an empty string to clear. Other configuration fields retain their existing behavior.

edge_cluster_name
string
required

Monitors edge cluster name responsible for evaluating rules using this datasource.

id
integer<uint64>

Datasource ID. Required for update; omit for create.

note
string

Optional description.

address
string

Connection address. Required for every type except elasticsearch with deployment: cloud. Prometheus/Loki/VictoriaLogs: HTTP URL; MySQL/Oracle/Postgres/ClickHouse: host:port; SLS: endpoint without the http(s):// prefix; tencent_cls: must be cls.tencentcloudapi.com or cls.internal.tencentcloudapi.com (requires Monitors edge >= v0.66.0). Redis/MongoDB diagnostic types: one host:port, bracket IPv6; no URI, userinfo or query. Kafka: 1–32 unique comma-separated host:port bootstrap addresses; payload has no broker list. At most 4096 characters after normalization.

Maximum string length: 4096
enabled
boolean

Whether business execution is enabled. Omitted on create: true; omitted on update: preserve the current value. Explicit false disables execution; null is invalid. Does not change alerting_enabled.

alerting_enabled
boolean

Whether this datasource may evaluate alerts. Omitted on create: true for alerting types, false for diagnostic-only types; omitted on update: preserve current value. null is invalid. redis_node, redis_sentinel, mongodb_mongod, mongodb_mongos and kafka reject true. Disabling is rejected with conflict when enabled rules reference the datasource.

Response

Success

Success response envelope. On every 2xx response, request_id identifies the call (also mirrored in the Flashcat-Request-Id header) and data holds the endpoint-specific payload. Failure responses use a different shape — see ErrorResponse.

request_id
string
required

Unique ID for this request. Mirrored in the Flashcat-Request-Id response header. Include it when reporting issues.

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object
required

A monitoring datasource.