# Create a webhook endpoint (/docs/api/webhooks/create-webhook-endpoint)

The response carries the signing secret. It is shown only here and after a rotation.

The operation, from the OpenAPI contract (https://docs.caibopay.app/openapi.json):

```json

{
  "method": "POST",
  "path": "/v1/webhook-endpoints",
  "description": "The response carries the signing secret. It is shown only here and after a rotation.",
  "operationId": "createWebhookEndpoint",
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/WebhookEndpointCreate"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/WebhookEndpoint"
          }
        }
      },
      "description": "The request was already made: the existing resource is returned.",
      "headers": {
        "Idempotent-Replayed": {
          "schema": {
            "enum": [
              "true"
            ],
            "type": "string"
          }
        }
      }
    },
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/WebhookEndpoint"
          }
        }
      },
      "description": "Created"
    },
    "400": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "The request is not valid."
    },
    "401": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "The API key is missing or not valid."
    },
    "403": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "The API key lacks the required scope."
    },
    "422": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "The request is well formed but cannot be carried out."
    },
    "429": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Too many requests."
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "An error on our side. Safe to retry with the same Idempotency-Key."
    },
    "503": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Temporarily unavailable or suspended. Safe to retry with the same Idempotency-Key."
    }
  },
  "summary": "Create a webhook endpoint",
  "tags": [
    "Webhooks"
  ],
  "x-required-scope": "write",
  "x-codeSamples": [
    {
      "lang": "js",
      "label": "Node.js",
      "source": "import { Caibo } from \"caibopay\";\n\nconst caibo = new Caibo(process.env.CAIBO_API_KEY);\n\nconst result = await caibo.webhookEndpoints.create({\n  url: \"https://example.com/webhooks/caibo\",\n});"
    },
    {
      "lang": "python",
      "label": "Python",
      "source": "import os\n\nimport caibopay\n\nclient = caibopay.Client(os.environ[\"CAIBO_API_KEY\"])\n\nresult = client.webhook_endpoints.create(url=\"https://example.com/webhooks/caibo\")"
    },
    {
      "lang": "go",
      "label": "Go",
      "source": "client, err := caibopay.NewClient(os.Getenv(\"CAIBO_API_KEY\"))\nif err != nil {\n\treturn err\n}\nctx := context.Background()\n\nresult, err := client.WebhookEndpoints.Create(ctx, &caibopay.WebhookEndpointCreate{\n\tURL: \"https://example.com/webhooks/caibo\",\n})\nif err != nil {\n\treturn err\n}\nfmt.Println(result)"
    }
  ]
}

```