Create
Create a new incident.
curl --request POST \
--url https://api.incident.io/v1/incidents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"custom_field_entries": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"values": [
{
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_catalog_entry_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_text": "This is my text field, I hope you like it",
"value_timestamp": ""
}
]
}
],
"idempotency_key": "alert-uuid",
"incident_role_assignments": [
{
"assignee": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"incident_role_id": "01FH5TZRWMNAFB0DZ23FD1TV96"
}
],
"incident_type_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"mode": "real",
"name": "Our database is sad",
"severity_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"slack_team_id": "T02A1FSLE8J",
"source_message_channel_id": "C02AW36C1M5",
"source_message_timestamp": "1653650280.526509",
"status": "triage",
"summary": "Our database is really really sad, and we don't know why yet.",
"visibility": "public"
}
EOFimport requests
url = "https://api.incident.io/v1/incidents"
payload = {
"custom_field_entries": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"values": [
{
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_catalog_entry_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_text": "This is my text field, I hope you like it",
"value_timestamp": ""
}
]
}
],
"idempotency_key": "alert-uuid",
"incident_role_assignments": [
{
"assignee": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"incident_role_id": "01FH5TZRWMNAFB0DZ23FD1TV96"
}
],
"incident_type_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"mode": "real",
"name": "Our database is sad",
"severity_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"slack_team_id": "T02A1FSLE8J",
"source_message_channel_id": "C02AW36C1M5",
"source_message_timestamp": "1653650280.526509",
"status": "triage",
"summary": "Our database is really really sad, and we don't know why yet.",
"visibility": "public"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
custom_field_entries: [
{
custom_field_id: '01FCNDV6P870EA6S7TK1DSYDG0',
values: [
{
id: '01FCNDV6P870EA6S7TK1DSYDG0',
value_catalog_entry_id: '01FCNDV6P870EA6S7TK1DSYDG0',
value_link: 'https://google.com/',
value_numeric: '123.456',
value_option_id: '01FCNDV6P870EA6S7TK1DSYDG0',
value_text: 'This is my text field, I hope you like it',
value_timestamp: ''
}
]
}
],
idempotency_key: 'alert-uuid',
incident_role_assignments: [
{
assignee: {
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
},
incident_role_id: '01FH5TZRWMNAFB0DZ23FD1TV96'
}
],
incident_type_id: '01FH5TZRWMNAFB0DZ23FD1TV96',
mode: 'real',
name: 'Our database is sad',
severity_id: '01FH5TZRWMNAFB0DZ23FD1TV96',
slack_team_id: 'T02A1FSLE8J',
source_message_channel_id: 'C02AW36C1M5',
source_message_timestamp: '1653650280.526509',
status: 'triage',
summary: 'Our database is really really sad, and we don\'t know why yet.',
visibility: 'public'
})
};
fetch('https://api.incident.io/v1/incidents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.incident.io/v1/incidents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'custom_field_entries' => [
[
'custom_field_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'values' => [
[
'id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'value_catalog_entry_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'value_link' => 'https://google.com/',
'value_numeric' => '123.456',
'value_option_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'value_text' => 'This is my text field, I hope you like it',
'value_timestamp' => ''
]
]
]
],
'idempotency_key' => 'alert-uuid',
'incident_role_assignments' => [
[
'assignee' => [
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
],
'incident_role_id' => '01FH5TZRWMNAFB0DZ23FD1TV96'
]
],
'incident_type_id' => '01FH5TZRWMNAFB0DZ23FD1TV96',
'mode' => 'real',
'name' => 'Our database is sad',
'severity_id' => '01FH5TZRWMNAFB0DZ23FD1TV96',
'slack_team_id' => 'T02A1FSLE8J',
'source_message_channel_id' => 'C02AW36C1M5',
'source_message_timestamp' => '1653650280.526509',
'status' => 'triage',
'summary' => 'Our database is really really sad, and we don\'t know why yet.',
'visibility' => 'public'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.incident.io/v1/incidents"
payload := strings.NewReader("{\n \"custom_field_entries\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"values\": [\n {\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_catalog_entry_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_link\": \"https://google.com/\",\n \"value_numeric\": \"123.456\",\n \"value_option_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_text\": \"This is my text field, I hope you like it\",\n \"value_timestamp\": \"\"\n }\n ]\n }\n ],\n \"idempotency_key\": \"alert-uuid\",\n \"incident_role_assignments\": [\n {\n \"assignee\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"incident_role_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\"\n }\n ],\n \"incident_type_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"mode\": \"real\",\n \"name\": \"Our database is sad\",\n \"severity_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"slack_team_id\": \"T02A1FSLE8J\",\n \"source_message_channel_id\": \"C02AW36C1M5\",\n \"source_message_timestamp\": \"1653650280.526509\",\n \"status\": \"triage\",\n \"summary\": \"Our database is really really sad, and we don't know why yet.\",\n \"visibility\": \"public\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.incident.io/v1/incidents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"custom_field_entries\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"values\": [\n {\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_catalog_entry_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_link\": \"https://google.com/\",\n \"value_numeric\": \"123.456\",\n \"value_option_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_text\": \"This is my text field, I hope you like it\",\n \"value_timestamp\": \"\"\n }\n ]\n }\n ],\n \"idempotency_key\": \"alert-uuid\",\n \"incident_role_assignments\": [\n {\n \"assignee\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"incident_role_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\"\n }\n ],\n \"incident_type_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"mode\": \"real\",\n \"name\": \"Our database is sad\",\n \"severity_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"slack_team_id\": \"T02A1FSLE8J\",\n \"source_message_channel_id\": \"C02AW36C1M5\",\n \"source_message_timestamp\": \"1653650280.526509\",\n \"status\": \"triage\",\n \"summary\": \"Our database is really really sad, and we don't know why yet.\",\n \"visibility\": \"public\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v1/incidents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"custom_field_entries\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"values\": [\n {\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_catalog_entry_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_link\": \"https://google.com/\",\n \"value_numeric\": \"123.456\",\n \"value_option_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_text\": \"This is my text field, I hope you like it\",\n \"value_timestamp\": \"\"\n }\n ]\n }\n ],\n \"idempotency_key\": \"alert-uuid\",\n \"incident_role_assignments\": [\n {\n \"assignee\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"incident_role_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\"\n }\n ],\n \"incident_type_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"mode\": \"real\",\n \"name\": \"Our database is sad\",\n \"severity_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"slack_team_id\": \"T02A1FSLE8J\",\n \"source_message_channel_id\": \"C02AW36C1M5\",\n \"source_message_timestamp\": \"1653650280.526509\",\n \"status\": \"triage\",\n \"summary\": \"Our database is really really sad, and we don't know why yet.\",\n \"visibility\": \"public\"\n}"
response = http.request(request)
puts response.read_body{
"incident": {
"call_url": "https://zoom.us/foo",
"created_at": "2021-08-17T13:28:57.801578Z",
"creator": {
"api_key": {
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "My test API key"
},
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "viewer",
"slack_user_id": "U02AYNF2XJM"
}
},
"custom_field_entries": [
{
"custom_field": {
"description": "Which team is impacted by this issue",
"field_type": "single_select",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Affected Team",
"options": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
}
]
},
"values": [
{
"value_catalog_entry": {
"aliases": [
"lawrence@incident.io",
"lawrence"
],
"external_id": "761722cd-d1d7-477b-ac7e-90f9e079dc33",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Primary On-call"
},
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option": {
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
},
"value_text": "This is my text field, I hope you like it"
}
]
}
],
"id": "01FDAG4SAP5TYPT98WGR2N7W91",
"incident_role_assignments": [
{
"assignee": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "viewer",
"slack_user_id": "U02AYNF2XJM"
},
"role": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "The person currently coordinating the incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"instructions": "Take point on the incident; Make sure people are clear on responsibilities",
"name": "Incident Lead",
"required": false,
"role_type": "lead",
"shortform": "lead",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}
],
"incident_type": {
"create_in_triage": "always",
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Customer facing production outages",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"is_default": false,
"name": "Production Outage",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incidents_only": false,
"updated_at": "2021-08-17T13:28:57.801578Z"
},
"mode": "real",
"name": "Our database is sad",
"permalink": "https://app.incident.io/incidents/123",
"postmortem_document_url": "https://docs.google.com/my_doc_id",
"reference": "INC-123",
"severity": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Issues with **low impact**.",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Minor",
"rank": 1,
"updated_at": "2021-08-17T13:28:57.801578Z"
},
"slack_channel_id": "C02AW36C1M5",
"slack_channel_name": "inc-165-green-parrot",
"slack_team_id": "T02A1FSLE8J",
"status": "triage",
"summary": "Our database is really really sad, and we don't know why yet.",
"timestamps": [
{
"last_occurred_at": "2021-08-17T13:28:57.801578Z",
"name": "last_activity"
}
],
"updated_at": "2021-08-17T13:28:57.801578Z",
"visibility": "public"
}
}incidents.create scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
Unique string used to de-duplicate incident create requests
"alert-uuid"
Set the incident's custom fields to these values
Show child attributes
Show child attributes
[
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"values": [
{
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_catalog_entry_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_text": "This is my text field, I hope you like it",
"value_timestamp": ""
}
]
}
]
Assign incident roles to these people
Show child attributes
Show child attributes
[
{
"assignee": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"incident_role_id": "01FH5TZRWMNAFB0DZ23FD1TV96"
}
]
Incident type to create this incident as
"01FH5TZRWMNAFB0DZ23FD1TV96"
Whether the incident is real or test
real, test "real"
Explanation of the incident
"Our database is sad"
Severity to create incident as
"01FH5TZRWMNAFB0DZ23FD1TV96"
ID of the Slack team / workspace. This is only required if you are using a Slack Enterprise Grid with multiple teams.
"T02A1FSLE8J"
Channel ID of the source message, if this incident was created from one
"C02AW36C1M5"
Timestamp of the source message, if this incident was created from one
"1653650280.526509"
Current status of the incident
triage, investigating, fixing, monitoring, closed, declined "triage"
Detailed description of the incident
"Our database is really really sad, and we don't know why yet."
Response
OK response.
Show child attributes
Show child attributes
{
"call_url": "https://zoom.us/foo",
"created_at": "2021-08-17T13:28:57.801578Z",
"creator": {
"api_key": {
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "My test API key"
},
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "viewer",
"slack_user_id": "U02AYNF2XJM"
}
},
"custom_field_entries": [
{
"custom_field": {
"description": "Which team is impacted by this issue",
"field_type": "single_select",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Affected Team",
"options": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
}
]
},
"values": [
{
"value_catalog_entry": {
"aliases": ["lawrence@incident.io", "lawrence"],
"external_id": "761722cd-d1d7-477b-ac7e-90f9e079dc33",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Primary On-call"
},
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option": {
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
},
"value_text": "This is my text field, I hope you like it"
}
]
}
],
"id": "01FDAG4SAP5TYPT98WGR2N7W91",
"incident_role_assignments": [
{
"assignee": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "viewer",
"slack_user_id": "U02AYNF2XJM"
},
"role": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "The person currently coordinating the incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"instructions": "Take point on the incident; Make sure people are clear on responsibilities",
"name": "Incident Lead",
"required": false,
"role_type": "lead",
"shortform": "lead",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}
],
"incident_type": {
"create_in_triage": "always",
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Customer facing production outages",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"is_default": false,
"name": "Production Outage",
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"],
"private_incidents_only": false,
"updated_at": "2021-08-17T13:28:57.801578Z"
},
"mode": "real",
"name": "Our database is sad",
"permalink": "https://app.incident.io/incidents/123",
"postmortem_document_url": "https://docs.google.com/my_doc_id",
"reference": "INC-123",
"severity": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Issues with **low impact**.",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Minor",
"rank": 1,
"updated_at": "2021-08-17T13:28:57.801578Z"
},
"slack_channel_id": "C02AW36C1M5",
"slack_channel_name": "inc-165-green-parrot",
"slack_team_id": "T02A1FSLE8J",
"status": "triage",
"summary": "Our database is really really sad, and we don't know why yet.",
"timestamps": [
{
"last_occurred_at": "2021-08-17T13:28:57.801578Z",
"name": "last_activity"
}
],
"updated_at": "2021-08-17T13:28:57.801578Z",
"visibility": "public"
}
Was this page helpful?
curl --request POST \
--url https://api.incident.io/v1/incidents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"custom_field_entries": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"values": [
{
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_catalog_entry_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_text": "This is my text field, I hope you like it",
"value_timestamp": ""
}
]
}
],
"idempotency_key": "alert-uuid",
"incident_role_assignments": [
{
"assignee": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"incident_role_id": "01FH5TZRWMNAFB0DZ23FD1TV96"
}
],
"incident_type_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"mode": "real",
"name": "Our database is sad",
"severity_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"slack_team_id": "T02A1FSLE8J",
"source_message_channel_id": "C02AW36C1M5",
"source_message_timestamp": "1653650280.526509",
"status": "triage",
"summary": "Our database is really really sad, and we don't know why yet.",
"visibility": "public"
}
EOFimport requests
url = "https://api.incident.io/v1/incidents"
payload = {
"custom_field_entries": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"values": [
{
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_catalog_entry_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"value_text": "This is my text field, I hope you like it",
"value_timestamp": ""
}
]
}
],
"idempotency_key": "alert-uuid",
"incident_role_assignments": [
{
"assignee": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"incident_role_id": "01FH5TZRWMNAFB0DZ23FD1TV96"
}
],
"incident_type_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"mode": "real",
"name": "Our database is sad",
"severity_id": "01FH5TZRWMNAFB0DZ23FD1TV96",
"slack_team_id": "T02A1FSLE8J",
"source_message_channel_id": "C02AW36C1M5",
"source_message_timestamp": "1653650280.526509",
"status": "triage",
"summary": "Our database is really really sad, and we don't know why yet.",
"visibility": "public"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
custom_field_entries: [
{
custom_field_id: '01FCNDV6P870EA6S7TK1DSYDG0',
values: [
{
id: '01FCNDV6P870EA6S7TK1DSYDG0',
value_catalog_entry_id: '01FCNDV6P870EA6S7TK1DSYDG0',
value_link: 'https://google.com/',
value_numeric: '123.456',
value_option_id: '01FCNDV6P870EA6S7TK1DSYDG0',
value_text: 'This is my text field, I hope you like it',
value_timestamp: ''
}
]
}
],
idempotency_key: 'alert-uuid',
incident_role_assignments: [
{
assignee: {
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
},
incident_role_id: '01FH5TZRWMNAFB0DZ23FD1TV96'
}
],
incident_type_id: '01FH5TZRWMNAFB0DZ23FD1TV96',
mode: 'real',
name: 'Our database is sad',
severity_id: '01FH5TZRWMNAFB0DZ23FD1TV96',
slack_team_id: 'T02A1FSLE8J',
source_message_channel_id: 'C02AW36C1M5',
source_message_timestamp: '1653650280.526509',
status: 'triage',
summary: 'Our database is really really sad, and we don\'t know why yet.',
visibility: 'public'
})
};
fetch('https://api.incident.io/v1/incidents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.incident.io/v1/incidents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'custom_field_entries' => [
[
'custom_field_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'values' => [
[
'id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'value_catalog_entry_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'value_link' => 'https://google.com/',
'value_numeric' => '123.456',
'value_option_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'value_text' => 'This is my text field, I hope you like it',
'value_timestamp' => ''
]
]
]
],
'idempotency_key' => 'alert-uuid',
'incident_role_assignments' => [
[
'assignee' => [
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
],
'incident_role_id' => '01FH5TZRWMNAFB0DZ23FD1TV96'
]
],
'incident_type_id' => '01FH5TZRWMNAFB0DZ23FD1TV96',
'mode' => 'real',
'name' => 'Our database is sad',
'severity_id' => '01FH5TZRWMNAFB0DZ23FD1TV96',
'slack_team_id' => 'T02A1FSLE8J',
'source_message_channel_id' => 'C02AW36C1M5',
'source_message_timestamp' => '1653650280.526509',
'status' => 'triage',
'summary' => 'Our database is really really sad, and we don\'t know why yet.',
'visibility' => 'public'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.incident.io/v1/incidents"
payload := strings.NewReader("{\n \"custom_field_entries\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"values\": [\n {\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_catalog_entry_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_link\": \"https://google.com/\",\n \"value_numeric\": \"123.456\",\n \"value_option_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_text\": \"This is my text field, I hope you like it\",\n \"value_timestamp\": \"\"\n }\n ]\n }\n ],\n \"idempotency_key\": \"alert-uuid\",\n \"incident_role_assignments\": [\n {\n \"assignee\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"incident_role_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\"\n }\n ],\n \"incident_type_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"mode\": \"real\",\n \"name\": \"Our database is sad\",\n \"severity_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"slack_team_id\": \"T02A1FSLE8J\",\n \"source_message_channel_id\": \"C02AW36C1M5\",\n \"source_message_timestamp\": \"1653650280.526509\",\n \"status\": \"triage\",\n \"summary\": \"Our database is really really sad, and we don't know why yet.\",\n \"visibility\": \"public\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.incident.io/v1/incidents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"custom_field_entries\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"values\": [\n {\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_catalog_entry_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_link\": \"https://google.com/\",\n \"value_numeric\": \"123.456\",\n \"value_option_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_text\": \"This is my text field, I hope you like it\",\n \"value_timestamp\": \"\"\n }\n ]\n }\n ],\n \"idempotency_key\": \"alert-uuid\",\n \"incident_role_assignments\": [\n {\n \"assignee\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"incident_role_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\"\n }\n ],\n \"incident_type_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"mode\": \"real\",\n \"name\": \"Our database is sad\",\n \"severity_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"slack_team_id\": \"T02A1FSLE8J\",\n \"source_message_channel_id\": \"C02AW36C1M5\",\n \"source_message_timestamp\": \"1653650280.526509\",\n \"status\": \"triage\",\n \"summary\": \"Our database is really really sad, and we don't know why yet.\",\n \"visibility\": \"public\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v1/incidents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"custom_field_entries\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"values\": [\n {\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_catalog_entry_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_link\": \"https://google.com/\",\n \"value_numeric\": \"123.456\",\n \"value_option_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"value_text\": \"This is my text field, I hope you like it\",\n \"value_timestamp\": \"\"\n }\n ]\n }\n ],\n \"idempotency_key\": \"alert-uuid\",\n \"incident_role_assignments\": [\n {\n \"assignee\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"incident_role_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\"\n }\n ],\n \"incident_type_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"mode\": \"real\",\n \"name\": \"Our database is sad\",\n \"severity_id\": \"01FH5TZRWMNAFB0DZ23FD1TV96\",\n \"slack_team_id\": \"T02A1FSLE8J\",\n \"source_message_channel_id\": \"C02AW36C1M5\",\n \"source_message_timestamp\": \"1653650280.526509\",\n \"status\": \"triage\",\n \"summary\": \"Our database is really really sad, and we don't know why yet.\",\n \"visibility\": \"public\"\n}"
response = http.request(request)
puts response.read_body{
"incident": {
"call_url": "https://zoom.us/foo",
"created_at": "2021-08-17T13:28:57.801578Z",
"creator": {
"api_key": {
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "My test API key"
},
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "viewer",
"slack_user_id": "U02AYNF2XJM"
}
},
"custom_field_entries": [
{
"custom_field": {
"description": "Which team is impacted by this issue",
"field_type": "single_select",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Affected Team",
"options": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
}
]
},
"values": [
{
"value_catalog_entry": {
"aliases": [
"lawrence@incident.io",
"lawrence"
],
"external_id": "761722cd-d1d7-477b-ac7e-90f9e079dc33",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Primary On-call"
},
"value_link": "https://google.com/",
"value_numeric": "123.456",
"value_option": {
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
},
"value_text": "This is my text field, I hope you like it"
}
]
}
],
"id": "01FDAG4SAP5TYPT98WGR2N7W91",
"incident_role_assignments": [
{
"assignee": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "viewer",
"slack_user_id": "U02AYNF2XJM"
},
"role": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "The person currently coordinating the incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"instructions": "Take point on the incident; Make sure people are clear on responsibilities",
"name": "Incident Lead",
"required": false,
"role_type": "lead",
"shortform": "lead",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}
],
"incident_type": {
"create_in_triage": "always",
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Customer facing production outages",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"is_default": false,
"name": "Production Outage",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incidents_only": false,
"updated_at": "2021-08-17T13:28:57.801578Z"
},
"mode": "real",
"name": "Our database is sad",
"permalink": "https://app.incident.io/incidents/123",
"postmortem_document_url": "https://docs.google.com/my_doc_id",
"reference": "INC-123",
"severity": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Issues with **low impact**.",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Minor",
"rank": 1,
"updated_at": "2021-08-17T13:28:57.801578Z"
},
"slack_channel_id": "C02AW36C1M5",
"slack_channel_name": "inc-165-green-parrot",
"slack_team_id": "T02A1FSLE8J",
"status": "triage",
"summary": "Our database is really really sad, and we don't know why yet.",
"timestamps": [
{
"last_occurred_at": "2021-08-17T13:28:57.801578Z",
"name": "last_activity"
}
],
"updated_at": "2021-08-17T13:28:57.801578Z",
"visibility": "public"
}
}