---
title: Creates a custom event
slug: creates-a-custom-event
docTags: 
createdAt: 2025-01-28T10:28:11.769Z
---

{
  "id": "4oNSQCGqb39wo-W-IKQt2",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.waydev.co/v2/events",
    "name": "Creates a custom event",
    "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": "",
          "schema": [
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "Name of the event type. Must be a valid name of an event type created via the first route",
              "example": "total_runs"
            },
            {
              "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": "5362"
            },
            {
              "name": "value",
              "kind": "required",
              "type": "integer",
              "description": "Quantifiable value of the event",
              "example": "6"
            },
            {
              "name": "ref",
              "kind": "optional",
              "type": "string",
              "description": "Ref of the associated commit. Must be the full SHA of a commit that is detected by Waydev",
              "example": "example_ref"
            },
            {
              "name": "number",
              "kind": "optional",
              "type": "integer",
              "description": "Unique identifier for the event. If it is not provided then one will be randomly generated",
              "example": "1234"
            },
            {
              "name": "start_date",
              "kind": "optional",
              "type": "string<date-time>",
              "description": "Creation date of the event in format y-m-d h:m:s. Defaults to current date if not provided",
              "example": "2023-01-01 12:34:56"
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful operation",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Bad input parameter",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "WBWMBavWLKdETTiUYtU8s",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.waydev.co/v2/events \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'authorization: string' \\\n     --data '{\n     \"name\": \"total_runs\",\n     \"repository_id\": \"5362\",\n     \"value\": \"6\"\n     }'"
        },
        {
          "id": "vjjNfTf25QAOr2OBPPsgK",
          "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   \"name\": \"total_runs\",\n   \"repository_id\": \"5362\",\n   \"value\": \"6\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.waydev.co/v2/events\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "2fp4PtFxQtgKbbve0H6zX",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.waydev.co/v2/events\")\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   \"name\": \"total_runs\",\n   \"repository_id\": \"5362\",\n   \"value\": \"6\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "_LStOyeXGyrsk6xStGdr6",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.waydev.co/v2/events\"\n\npayload = json.dumps({\n   \"name\": \"total_runs\",\n   \"repository_id\": \"5362\",\n   \"value\": \"6\"\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": "WBWMBavWLKdETTiUYtU8s"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful operation\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad input parameter\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}