---
title: Create a new webhook endpoint
slug: create-a-new-webhook-endpoint
docTags: 
createdAt: 2026-08-25T19:28:59.170Z
---

{
  "id": "POvod0B-dDFj4Ct91kwDT",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/webhook-endpoints",
    "servers": [
      {
        "url": "https://api.nue.io/webhook-endpoints",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/webhook-endpoints",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Create a new webhook endpoint",
    "description": "<p>Register a new webhook endpoint to receive real-time notifications about billing events. When you create a webhook, you specify which events to monitor (like invoice creation or payment processing) and where to send the notifications. This enables your system to automatically respond to billing changes without having to constantly check for updates.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json",
            "*/*"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "CreateEventTypeRegistrationRequest",
          "schema": [],
          "modelRef": "#/components/schemas/CreateEventTypeRegistrationRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successfully created webhook endpoint",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "GENERATED",
            "code": "// Successfully created webhook endpoint\n{}"
          },
          {
            "label": "Webhook Created Successfully",
            "code": "{\n  \"id\": \"e4db815d-f8cb-4d51-b729-6417fb1296ee\",\n  \"name\": \"first webhook\",\n  \"object\": \"webhook_endpoint\",\n  \"createdDate\": \"2023-09-20T17:23:16.592+08:00\",\n  \"createdBy\": \"ca9d3479-79c8-4d5b-bee0-4d1100984830\",\n  \"lastModifiedDate\": \"2023-09-20T17:23:16.592+08:00\",\n  \"lastModifiedBy\": \"ca9d3479-79c8-4d5b-bee0-4d1100984830\",\n  \"description\": \"the description\",\n  \"status\": \"enabled\",\n  \"events\": [\n    \"invoice.activated\",\n    \"invoice.canceled\",\n    \"credit_memo.activated\",\n    \"credit_memo.canceled\"\n  ],\n  \"endpoint\": \"https://mywebsite.com/endpoint\"\n}"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "CreateEventTypeRegistrationResponse",
            "schema": [],
            "modelRef": "#/components/schemas/CreateEventTypeRegistrationResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "webhook endpoint url invalid",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "webhook endpoint url invalid",
            "code": "{\n  \"title\": \"BAD_REQUEST\",\n  \"message\": \"A valid url is required for webhook: {{request:endpoint}}\",\n  \"errorCode\": \"INVALID_WEBHOOK_ENDPOINT_URL\"\n}"
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "SCBXpREs7yd5ZYRWUHI1U",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/webhook-endpoints \\\n     --header 'accept: application/json'"
        },
        {
          "id": "DsVNF9pxlAFMz3vx04Orn",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/webhook-endpoints\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "blHAFVfhwyT4JkRDUMc1D",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/webhook-endpoints\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "k81lWfvGAMH7CsNq160h5",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"https://api.nue.io/webhook-endpoints\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "SCBXpREs7yd5ZYRWUHI1U"
    },
    "results": {
      "languages": [
        {
          "id": "mtPMdyV0ZaXTxHKTQEqU6",
          "language": "200",
          "code": "// Successfully created webhook endpoint\n{}",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// Successfully created webhook endpoint\n{}"
            },
            {
              "label": "Webhook Created Successfully",
              "code": "{\n  \"id\": \"e4db815d-f8cb-4d51-b729-6417fb1296ee\",\n  \"name\": \"first webhook\",\n  \"object\": \"webhook_endpoint\",\n  \"createdDate\": \"2023-09-20T17:23:16.592+08:00\",\n  \"createdBy\": \"ca9d3479-79c8-4d5b-bee0-4d1100984830\",\n  \"lastModifiedDate\": \"2023-09-20T17:23:16.592+08:00\",\n  \"lastModifiedBy\": \"ca9d3479-79c8-4d5b-bee0-4d1100984830\",\n  \"description\": \"the description\",\n  \"status\": \"enabled\",\n  \"events\": [\n    \"invoice.activated\",\n    \"invoice.canceled\",\n    \"credit_memo.activated\",\n    \"credit_memo.canceled\"\n  ],\n  \"endpoint\": \"https://mywebsite.com/endpoint\"\n}"
            }
          ]
        },
        {
          "id": "LzsH6zzc2YLNwEYEgjnVu",
          "language": "400",
          "code": "// Bad Request\n"
        },
        {
          "id": "xQPRAMpjHimY3tUoe6rKG",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "O5n6QfBWnTV5H6a1TYikz",
          "language": "500",
          "code": "// webhook endpoint url invalid\n",
          "subExamples": [
            {
              "label": "webhook endpoint url invalid",
              "code": "{\n  \"title\": \"BAD_REQUEST\",\n  \"message\": \"A valid url is required for webhook: {{request:endpoint}}\",\n  \"errorCode\": \"INVALID_WEBHOOK_ENDPOINT_URL\"\n}"
            }
          ]
        }
      ],
      "selectedLanguageId": "mtPMdyV0ZaXTxHKTQEqU6"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}