---
title: Create a new incident in your account
slug: create-a-new-incident-in-your-account
createdAt: 2025-01-28T10:28:11.769Z
---

{
  "id": "FOe75QYabBeA-OBOQAx5f",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.waydev.co/v2/incidents",
    "name": "Create a new incident in your account",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "kind": "required",
          "name": "Authorization",
          "type": "string",
          "description": "Your PAT generated in Waydev"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Incident object that needs to be added",
          "customType": "Incident",
          "schema": [
            {
              "name": "title",
              "kind": "required",
              "type": "string",
              "description": "Name of the incident.",
              "example": "Production failure"
            },
            {
              "name": "identifier",
              "kind": "optional",
              "type": "string",
              "description": "Unique identifier for the incident. If not provided, one will be randomly generated.",
              "example": "v1.2"
            },
            {
              "name": "repository_id",
              "kind": "required",
              "type": "integer",
              "description": "ID of the repository. Must be the ID of a repo that is selected for processing within Waydev. Can be identified using the GET /repositories route",
              "example": 2548
            },
            {
              "name": "url",
              "kind": "optional",
              "type": "string",
              "description": "URL of the incident",
              "example": "https://www.pagerduty.com/my-incident"
            },
            {
              "name": "ref",
              "kind": "optional",
              "type": "string",
              "description": "A ref of a commit. Used to associate the incident to a developer if needed",
              "example": "ref"
            },
            {
              "name": "issued_at",
              "kind": "required",
              "type": "string",
              "description": "Date when incident occured. Must be of format Y-m-d H:i:s",
              "example": "2024-03-20 12:34:56"
            },
            {
              "name": "fixed_at",
              "kind": "optional",
              "type": "string",
              "description": "Date when incident was fixed. Can be updated later. Must be of format Y-m-d H:i:s",
              "example": "2024-03-21 12:34:56"
            }
          ],
          "modelRef": "#/definitions/Incident",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successfully created",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Successfully created",
            "schema": [
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "example": "Incident successfully created"
              },
              {
                "name": "number",
                "kind": "optional",
                "type": "string",
                "example": "v1.2"
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Unauthorized",
            "schema": [
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "example": "Unauthorized"
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.waydev.co/v2/incidents \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'authorization: string' \\\n     --data '{\n     \"title\": \"Production failure\",\n     \"repository_id\": 2548,\n     \"issued_at\": \"2024-03-20 12:34:56\"\n     }'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"authorization\", \"string\");\n\nvar raw = JSON.stringify({\n   \"title\": \"Production failure\",\n   \"repository_id\": 2548,\n   \"issued_at\": \"2024-03-20 12:34:56\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.waydev.co/v2/incidents\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.waydev.co/v2/incidents\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"authorization\"] = \"string\"\nrequest.body = JSON.dump({\n   \"title\": \"Production failure\",\n   \"repository_id\": 2548,\n   \"issued_at\": \"2024-03-20 12:34:56\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.waydev.co/v2/incidents\"\n\npayload = json.dumps({\n   \"title\": \"Production failure\",\n   \"repository_id\": 2548,\n   \"issued_at\": \"2024-03-20 12:34:56\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'authorization': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successfully created\n{\n  \"message\": \"Incident successfully created\",\n  \"number\": \"v1.2\"\n}"
        },
        {
          "id": "response-1-401",
          "language": "401",
          "code": "// Unauthorized\n{\n  \"message\": \"Unauthorized\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}