---
title: Create webhook
slug: webhook-api/create-webhook
docTags: 
createdAt: 2024-06-10T16:49:31.068Z
---

{
  "id": "_9dh94KFIQig1JxA5GQRR",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.catenda.com/v2/projects/{project-id}/webhooks/user",
    "servers": [
      {
        "url": "https://api.catenda.com/v2/projects/{project-id}/webhooks/user"
      }
    ],
    "name": "Create webhook",
    "description": "Add a new webhook subscription.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project-id",
          "type": "string",
          "example": "af2d8af0fa54465b89bf26dd3d92cfd0",
          "description": "Catenda project id"
        }
      ],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "schema": [
            {
              "name": "event",
              "kind": "required",
              "type": "string<issue.created | issue.deleted | issue.modified | issue.status.changed | library.document.revision.published | model.created | revision.created>",
              "description": "The event that triggers the callback URL.\n\nValid values are: \n  - issue.created\n  - issue.deleted\n  - issue.modified\n  - issue.status.changed\n  - library.document.revision.published\n  - model.created\n  - revision.created\n",
              "example": "issue.created"
            },
            {
              "name": "target_url",
              "kind": "required",
              "type": "string",
              "description": "The URL to be called when the event occurs",
              "example": "https://hooks.zapier.com/hooks/catch/1028857/a8w0or/"
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "Bearer",
          "name": "Bearer",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Represents the subscription to an event with an associated callback.",
            "customType": "webhook-subscription",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "description": "A unique identifier for a Webhook, represented as compacted UUID using 32 hexadecimal characters",
                "example": "57d5457e09d64380af75da94ed96557h"
              },
              {
                "name": "target_url",
                "kind": "optional",
                "type": "string",
                "description": "The URL to be called when the event occurs",
                "example": "https://hooks.zapier.com/hooks/catch/1028857/a8w0or/"
              },
              {
                "name": "createdAt",
                "kind": "optional",
                "type": "string",
                "description": "Creation date of the Webhook",
                "example": "2019-02-13T14:15:18Z\""
              },
              {
                "name": "state",
                "kind": "optional",
                "type": "string",
                "description": "The state of the Webhook.\n\nValid values are: \n  - ENABLED\n  - DISABLED_GONE\n  - DISABLED_TOO_MANY_FAILURES\n  - DISABLED_BY_USER\n",
                "example": ""
              },
              {
                "name": "failureCount",
                "kind": "optional",
                "type": "number",
                "description": "The number of times the Webhook has failed",
                "example": 0
              },
              {
                "name": "event",
                "kind": "optional",
                "type": "string",
                "description": "The event that triggers the callback URL.\n\nValid values are: \n  - issue.created\n  - issue.deleted\n  - issue.modified\n  - issue.status.changed\n  - library.document.revision.published\n  - model.created\n  - revision.created\n",
                "example": "issue.created"
              }
            ],
            "modelRef": "#/components/schemas/webhook-subscription",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "8v4dbPLLTyDQ1uKzxDmEF",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.catenda.com/v2/projects/{project-id}/webhooks/user \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"event\": \"issue.created\",\n     \"target_url\": \"https://hooks.zapier.com/hooks/catch/1028857/a8w0or/\"\n     }'"
        },
        {
          "id": "SKKTnGZuNCvOg7bK_7yWx",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"event\": \"issue.created\",\n   \"target_url\": \"https://hooks.zapier.com/hooks/catch/1028857/a8w0or/\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.catenda.com/v2/projects/{project-id}/webhooks/user\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "UBcJORKZWY-rTBDt5VEzY",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.catenda.com/v2/projects/{project-id}/webhooks/user\")\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.body = JSON.dump({\n   \"event\": \"issue.created\",\n   \"target_url\": \"https://hooks.zapier.com/hooks/catch/1028857/a8w0or/\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "a7o3Fh_M4eeCPNX1uG73b",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.catenda.com/v2/projects/{project-id}/webhooks/user\"\n\npayload = json.dumps({\n   \"event\": \"issue.created\",\n   \"target_url\": \"https://hooks.zapier.com/hooks/catch/1028857/a8w0or/\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "8v4dbPLLTyDQ1uKzxDmEF"
    },
    "results": {
      "languages": [
        {
          "id": "zNB8mehw8f5ECyblqVDoc",
          "language": "200",
          "code": "// OK\n{\n  \"id\": \"57d5457e09d64380af75da94ed96557h\",\n  \"target_url\": \"https://hooks.zapier.com/hooks/catch/1028857/a8w0or/\",\n  \"createdAt\": \"2019-02-13T14:15:18Z\\\"\",\n  \"state\": \"\",\n  \"failureCount\": 0,\n  \"event\": \"issue.created\"\n}"
        }
      ],
      "selectedLanguageId": "zNB8mehw8f5ECyblqVDoc"
    }
  },
  "children": [
    {
      "id": "5gahFi7f7xMTUz6_kwUez",
      "type": "paragraph",
      "children": [
        {
          "text": "Add a new webhook subscription."
        }
      ]
    }
  ]
}