POST
/api/v1/alertsSocial_CreateAlertRule
- Authentication
- required-user
- Cache policy
- none
- Success and errors
- 201, 400, 401, 403, 404, 409, 429, 500, 503
- Stability
- v1 stable contract
OpenAPI operation
{
"operationId": "Social_CreateAlertRule",
"summary": "POST /api/v1/alerts",
"tags": [
"Social"
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"entityPublicId": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"workspaceId": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"triggerKind": {
"type": "string",
"enum": [
"SCHEDULED",
"DOMAIN_EVENT",
"METRIC_THRESHOLD"
]
},
"conditionAst": {
"$ref": "#/$defs/__schema0"
},
"scheduleCron": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"scheduleTimezone": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"cooldownSeconds": {
"default": 300,
"type": "integer",
"minimum": 0,
"maximum": 31536000
},
"dedupeWindowSeconds": {
"default": 300,
"type": "integer",
"minimum": 60,
"maximum": 31536000
},
"channelIds": {
"minItems": 1,
"maxItems": 10,
"type": "array",
"items": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
},
"activate": {
"default": true,
"type": "boolean"
}
},
"required": [
"name",
"triggerKind",
"conditionAst",
"channelIds"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"oneOf": [
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "and"
},
"conditions": {
"minItems": 1,
"maxItems": 20,
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
}
},
"required": [
"op",
"conditions"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "or"
},
"conditions": {
"minItems": 1,
"maxItems": 20,
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
}
},
"required": [
"op",
"conditions"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "not"
},
"condition": {
"$ref": "#/$defs/__schema0"
}
},
"required": [
"op",
"condition"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "comparison"
},
"metric": {
"type": "string",
"enum": [
"ranking.rank",
"ranking.score_ppm",
"trust.score_ppm",
"trust.confidence_ppm",
"service.uptime_ppm",
"service.latency_ms",
"service.failure_count",
"x402.failure_count",
"wallet.balance_units",
"github.freshness_ppm",
"runtime.failure_count",
"bounty.deadline_seconds"
]
},
"operator": {
"type": "string",
"enum": [
"EQ",
"NE",
"GT",
"GTE",
"LT",
"LTE"
]
},
"literal": {
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "number"
},
{
"type": "boolean"
}
]
}
},
"required": [
"op",
"metric",
"operator",
"literal"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "delta"
},
"metric": {
"type": "string",
"enum": [
"ranking.rank",
"ranking.score_ppm",
"trust.score_ppm",
"trust.confidence_ppm",
"service.uptime_ppm",
"service.latency_ms",
"service.failure_count",
"x402.failure_count",
"wallet.balance_units",
"github.freshness_ppm",
"runtime.failure_count",
"bounty.deadline_seconds"
]
},
"windowSeconds": {
"type": "integer",
"minimum": 60,
"maximum": 31536000
},
"operator": {
"type": "string",
"enum": [
"EQ",
"NE",
"GT",
"GTE",
"LT",
"LTE"
]
},
"literal": {
"type": "number"
}
},
"required": [
"op",
"metric",
"windowSeconds",
"operator",
"literal"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "stateChanged"
},
"subjectField": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"from": {
"type": "string",
"maxLength": 100
},
"to": {
"type": "string",
"maxLength": 100
}
},
"required": [
"op",
"subjectField"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "eventOccurred"
},
"eventType": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"filters": {
"default": {},
"type": "object",
"propertyNames": {
"type": "string",
"maxLength": 100
},
"additionalProperties": {
"anyOf": [
{
"type": "string",
"maxLength": 200
},
{
"type": "number"
},
{
"type": "boolean"
}
]
}
},
"windowSeconds": {
"type": "integer",
"minimum": 60,
"maximum": 31536000
}
},
"required": [
"op",
"eventType",
"windowSeconds"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "freshness"
},
"metric": {
"type": "string",
"enum": [
"ranking.rank",
"ranking.score_ppm",
"trust.score_ppm",
"trust.confidence_ppm",
"service.uptime_ppm",
"service.latency_ms",
"service.failure_count",
"x402.failure_count",
"wallet.balance_units",
"github.freshness_ppm",
"runtime.failure_count",
"bounty.deadline_seconds"
]
},
"maximumAgeSeconds": {
"type": "integer",
"minimum": 60,
"maximum": 31536000
}
},
"required": [
"op",
"metric",
"maximumAgeSeconds"
],
"additionalProperties": false
}
]
}
}
}
}
}
},
"security": [
{
"cookieAuth": []
}
],
"responses": {
"201": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"required": [
"data",
"meta"
],
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"entityPublicId": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
},
"workspaceId": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
},
"name": {
"type": "string"
},
"state": {
"type": "string",
"enum": [
"DRAFT",
"ACTIVE",
"PAUSED",
"ERROR",
"DELETED"
]
},
"triggerKind": {
"type": "string",
"enum": [
"SCHEDULED",
"DOMAIN_EVENT",
"METRIC_THRESHOLD"
]
},
"conditionAst": {},
"scheduleCron": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"scheduleTimezone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"cooldownSeconds": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"dedupeWindowSeconds": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"lastEvaluatedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
]
},
"nextEvaluationAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
]
},
"version": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"channels": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"type": {
"type": "string",
"enum": [
"IN_APP",
"EMAIL",
"WEBHOOK"
]
},
"state": {
"type": "string",
"enum": [
"PENDING_VERIFICATION",
"ACTIVE",
"PAUSED",
"FAILED",
"REVOKED"
]
}
},
"required": [
"id",
"type",
"state"
],
"additionalProperties": false
}
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
}
},
"required": [
"id",
"entityPublicId",
"workspaceId",
"name",
"state",
"triggerKind",
"conditionAst",
"scheduleCron",
"scheduleTimezone",
"cooldownSeconds",
"dedupeWindowSeconds",
"lastEvaluatedAt",
"nextEvaluationAt",
"version",
"channels",
"createdAt",
"updatedAt"
],
"additionalProperties": false
},
"meta": {
"type": "object",
"additionalProperties": true,
"required": [
"requestId",
"schemaVersion",
"buildVersion",
"generatedAt",
"freshness"
],
"properties": {
"requestId": {
"type": "string",
"format": "uuid"
},
"schemaVersion": {
"type": "string"
},
"buildVersion": {
"type": "string"
},
"generatedAt": {
"type": "string",
"format": "date-time"
},
"freshness": {
"type": "object",
"additionalProperties": false,
"required": [
"projectedAt",
"sourceWatermark"
],
"properties": {
"projectedAt": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"sourceWatermark": {
"type": [
"string",
"null"
]
}
}
}
}
}
}
}
}
}
},
"400": {
"description": "invalid request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
"description": "unauthenticated",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"403": {
"description": "forbidden",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"404": {
"description": "not found",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"409": {
"description": "conflict",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"429": {
"description": "rate limited",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"500": {
"description": "internal error",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"503": {
"description": "dependency unavailable",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
},
"x-auth-mode": "required-user",
"x-cache-policy": "none",
"x-required-scopes": [],
"x-rate-cost": 1,
"x-stability": "STABLE"
}