Create Incident¶
POST /api/v1/incidents/add
Overview¶
Manually create an incident in the current workspace and dispatch associated tasks asynchronously.
Before You Call and Usage Steps¶
Create a manual incident in the workspace that owns the API Key, optionally with a description, resource link, dimensions, tags, and uploaded attachments. After a successful call, save content.uuid; subsequent details, modifications, and comments use this UUID.
- Select a currently available level from
content[].uuidin the Incident Level List and enter it inlevel; do not substitute display names such as P1 for the UUID. - Prepare
nameandlevelto send a minimal request. If tags are needed, selectcontent.data[].namefrom the Tag List and confirm the scope includes monitor/all; if attachments are needed, first call Attachment Upload to obtaincontent.attachmentUuid. - Add optional fields according to the parameter table.
dimensionTagmust be an object, and dimension values should preferably be strings. The current create API does not saveextend; if you need to save extensions, use Modify Incident after the incident is created successfully. - After success, call Get Incident Details to verify the content. Creation triggers subsequent automation and notifications; an HTTP success does not mean the notification has been delivered.
This API has no idempotency key. On timeout, 500, or attachment/tag processing errors, first check records around this name and creation time through the Incident List, then decide whether to retry, so as to avoid duplicate creation and notifications.
Attachments and tags should be passed as string arrays, and dimension values should preferably be strings. The server does not validate every array item and dimension sub-value individually; passing validation does not guarantee these values are usable; unsuitable sub-values may still fail during processing.
When attachmentUUIDs is submitted (including an empty array), the incident may already be saved even if subsequent tag handling returns 400, 404, or 406. Check the current state first, then correct the associated data or supplement it through the modify API, to avoid creating again.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential of the workspace. Example: <DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with this operation permission from the API Key management of the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| tags[*] | string | A tag name with monitor/all scope. Example: productionHow to obtain or fill in: Select a name whose scope includes monitor/all from the Tag List, or provide a new tag name. |
|
| attachmentUUIDs[*] | string | A verified attachment UUID string. Example: att_exampleHow to obtain or fill in: First use Attachment Upload to obtain content.attachmentUuid, and confirm the file is an attachment allowed for this operation. |
|
| dimensionTag.Custom Key | string | Custom dimension value, preferably a string; the caller provides the verified dimension. Example: paymentHow to obtain or fill in: The dimension key and value from the source event/resource. |
|
| extend.linkList | array | This link array is not saved on creation; if business links are needed, use resourceURL first, and save extended links through the modify API after creation. Example: [{"name": "排查手册", "link": "https://example.com/runbook"}]How to obtain or fill in: Omit on creation; see Modify Incident. |
|
| extend.linkList[*].name | string | Link display name; extend is not saved on creation. Example: 排查手册How to obtain or fill in: Omit on creation; see Modify Incident. |
|
| extend.linkList[*].link | string | Link URL; extend is not saved on creation. Example: https://example.com/runbookHow to obtain or fill in: Omit on creation; see Modify Incident. |
|
| name | string | Y | Required incident title. Use an identifiable name of 1 to 128 characters; the input validation declares a maximum of 256, but for compatibility with deployed versions fill in the recommended length to avoid save failures. Null allowed: False Maximum length: 256 Example: 支付服务异常How to obtain or fill in: The caller provides the title of this incident. |
| description | string | Optional incident description; when omitted it is an empty string, and an empty string or null may also be passed. Null allowed: True Example: 部分请求失败How to obtain or fill in: Fill in the customer-understandable symptoms, impact scope, and troubleshooting clues. |
|
| level | string | Y | Required incident level UUID. Use a currently enabled level record, not a display name such as P0/P1; a successful save does not mean the server has verified that the level is still available. Null allowed: False Example: system_level_1How to obtain or fill in: Obtain from content[].uuid in the Incident Level List and confirm it is available; if a global level is used, ask the administrator to confirm the effective item. |
| resourceURL | string | Optional source page or troubleshooting runbook URL; the server does not access this link automatically. The corresponding field in the response is resourceUrl. Null allowed: False Example: https://example.com/runbookHow to obtain or fill in: Provide a source page accessible to the caller, for example https://example.com/runbook. |
|
| tags | array | Optional array of tag names, case-sensitive, each name up to 128 characters; omitted means no tags. Select existing tags with monitor/all scope, or provide names that can be created. Null allowed: False Example: ["production"]How to obtain or fill in: Obtain from content.data[].name in the Tag List, and verify the scope of that record. |
|
| dimensionTag | json | Optional JSON object, {} when omitted. Common keys include host, service, resource, pod_name, app_name, app_id, env, and url, and custom keys are also allowed; values should preferably be strings. Null allowed: False Example: {"service": "payment"}How to obtain or fill in: Fill in the dimension information of the event, preferably reading the same field values from the source service/resource data. |
|
| attachmentUUIDs | array | Optional array of attachment UUIDs; when omitted, no attachments are bound. Use only attachments verified as usable for this incident, and do not pass download URLs or file names. Null allowed: False Example: ["att_example"]How to obtain or fill in: Obtain from content.attachmentUuid in the Attachment Upload response; each item in the array is a UUID string. |
|
| extend | json | The current create API accepts a JSON object but does not save its content, so it is recommended to omit it; if you need to save extensions, use the modify incident API. Null allowed: False Example: {"linkList": [{"name": "排查手册", "link": "https://example.com/runbook"}]}How to obtain or fill in: Omit on creation; see Modify Incident. |
Additional Parameter Notes¶
The level UUID should be obtained from the incident level list and confirmed as enabled; creation does not accept assignees or status. The current extend is not persisted; business links can be saved as a whole through the modify API after the incident is created successfully.
Request Examples¶
Minimal request: replace with a currently available incident level UUID.
curl --request POST 'https://openapi.guance.com/api/v1/incidents/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"支付服务异常","level":"system_level_1"}'
With optional information: attachment UUIDs must be obtained by uploading first, and tags must meet the scope requirements. Creation does not save extend, so it is omitted here.
curl --request POST 'https://openapi.guance.com/api/v1/incidents/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"支付服务异常","level":"system_level_1","description":"部分请求失败","resourceURL":"https://example.com/runbook","dimensionTag":{"service":"payment","env":"production"},"tags":["production"],"attachmentUUIDs":["att_example"]}'
Response¶
HTTP 200, application/json. The main example below corresponds to the request with optional information; optional fields not provided in the minimal request take default values. Use content.uuid as the business identifier; some system fields may be empty in the create response, so verify them later through the details.
| Field | Type | Description |
|---|---|---|
| content.id | integer or null | System numeric identifier, may be null in the create response; subsequent APIs use uuid. |
| content.uuid | string | UUID of the newly created incident, which must be saved for operations such as details, modification, and comments. |
| content.status | integer | Resource record status, 0 on creation; different from the incident handling status in incidentsStatus. |
| content.creator | string | Creation principal; for API Keys this is generally wsak_resource UUID. |
| content.updator | string | Empty string in the create response. |
| content.createAt | integer | Creation time in Unix seconds. |
| content.updateAt | integer | Usually -1 in the create response, indicating no updates yet. |
| content.deleteAt | integer | Deletion time in Unix seconds; -1 if not deleted. |
| content.workspaceUUID | string | Workspace the incident belongs to. |
| content.name | string | Incident name. |
| content.level | string | Incident level UUID, such as system_level_0 or legacy identifiers issl_/isslm_; not equal to the level display name. |
| content.description | string or null | Incident description. |
| content.source | string | This manual creation entry currently returns external; this is the incident source value and does not indicate External API authentication is used. |
| content.resourceCategory | string | Usually an empty string for this public manual creation entry. |
| content.resourceType | string | Usually an empty string for this public manual creation entry. |
| content.resourceUUID | string | Source resource UUID, usually empty for manual creation. |
| content.resourceUrl | string | Saved source URL; the response field starts with a lowercase l, differing from the request resourceURL. |
| content.resourceContent | object or JSON | Source content of this manual creation, usually {}; the request does not expose this field. |
| content.eventRelations | array<object> |
Empty array [] for this manual creation. |
| content.resourceIdentity | string | Usually an empty string for this public manual creation entry. |
| content.assigner | array<string> |
This public entry does not accept assignee parameters, so it is an empty array [] on creation. |
| content.incidentsStatus | string | Handling status of the newly created incident; this public entry does not accept assignee/status parameters, so it is usually open. |
| content.statusTime | object | Contains the Unix-second timestamp of open on creation. |
| content.statusTime.open | integer | Opening time of the current cycle. |
| content.statusChangeTime | integer | Time triggered by this creation, in Unix seconds. |
| content.cumulativeTime | integer | 0 for this creation. |
| content.eventCount | integer | 0 for this manual creation. |
| content.eventUpdateAt | integer | 0 for this manual creation. |
| content.dimensionTag | object | JSON mapping of dimension names to values. |
| content.dimensionTag.Custom Key | JSON | Dimension value submitted and saved by the caller; strings are recommended. |
| content.extend | object or JSON | {} on creation; this API does not save extend from the request. |
| content.dtHost | string or null | Dimension value from dimensionTag.host; usually an empty string when not provided. |
| content.dtService | string or null | Dimension value from dimensionTag.service; usually an empty string when not provided. |
| content.dtResource | string or null | Dimension value from dimensionTag.resource; usually an empty string when not provided. |
| content.dtPodName | string or null | Dimension value from dimensionTag.pod_name; usually an empty string when not provided. |
| content.dtAppName | string or null | Dimension value from dimensionTag.app_name; usually an empty string when not provided. |
| content.dtAppId | string or null | Dimension value from dimensionTag.app_id; usually an empty string when not provided. |
| content.dtEnv | string or null | Dimension value from dimensionTag.env; usually an empty string when not provided. |
| content.dtUrl | string or null | Dimension value from dimensionTag.url; usually an empty string when not provided. |
| content.tagInfo | array<object> |
Array of resolved tag summaries for this call; empty when there are no tags. |
| content.tagInfo[].id | string | Compatible tag ID, identical to uuid. |
| content.tagInfo[].uuid | string | Tag UUID; used for the tags filter in lists, while name is used when writing. |
| content.tagInfo[].name | string | Tag name. |
| content.tagInfo[].scope | array<string> |
Effective scope; currently monitor for new tags, all for legacy global tags. |
| content.tagInfo[].scope[] | string | One of all/scene/monitor/dialing/security/infrastructure/catalog. |
| content.declaration | object or null | Workspace common declaration; may be null or an empty object when not configured. |
{
"code": 200,
"content": {
"id": null,
"uuid": "incident_example",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"workspaceUUID": "wksp_example",
"name": "支付服务异常",
"level": "system_level_1",
"description": "部分请求失败",
"source": "external",
"resourceCategory": "",
"resourceType": "",
"resourceUUID": "",
"resourceUrl": "https://example.com/runbook",
"resourceContent": {},
"eventRelations": [],
"resourceIdentity": "",
"assigner": [],
"incidentsStatus": "open",
"statusTime": {
"open": 1785427200
},
"statusChangeTime": 1785427200,
"cumulativeTime": 0,
"eventCount": 0,
"eventUpdateAt": 0,
"dimensionTag": {
"service": "payment",
"env": "production"
},
"extend": {},
"dtHost": "",
"dtResource": "",
"dtPodName": "",
"dtAppName": "",
"dtAppId": "",
"dtEnv": "production",
"dtUrl": "",
"dtService": "payment",
"tagInfo": [
{
"id": "tag_example",
"uuid": "tag_example",
"name": "production",
"scope": [
"monitor"
]
}
],
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling Method |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation conditions | Parameter parsing failed | Check name, level, and field types against message; do not add undeclared assignee or status parameters. |
| 400 | ft.RequestJsonFormatError | The request JSON syntax is invalid | Request JSON format error | Correct the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The JSON top level is not an object | Some json file format error | Submit an object. |
| 400 | ft.TagScopeMismatch | The tag being written already exists with the same name but its scope does not include monitor/all | production: ['scene'] -> monitor | First query whether the incident has already been created, then correct the tag name/scope or length; if it has been created, handle it through the modify API instead of blindly creating again. |
| 406 | ft.ExceedMaxCharacterLimit | The tag name exceeds 128 characters | {} exceeds the maximum character length limit | First query whether the incident has already been created, then correct the tag name/scope or length; if it has been created, handle it through the modify API instead of blindly creating again. |
| 404 | ft.ObjectNotExists | The associated tag was deleted or became invalid during processing | The requested associated object does not exist. | Refresh the tag list; first verify whether the incident has already been created, then select a valid tag and decide whether to retry. |
| 500 | ft.InternalServerError | An unhandled exception occurred during saving, attachment/tag processing, or in a downstream service; the request may have partially taken effect | Internal error | Save the traceId; first verify the current state of the incident and notifications, then decide whether to retry. Check the attachment UUIDs and JSON sub-field types, and contact the administrator if the error persists. |