---
agentTools:
  projectIndex: https://zafepay.readme.io/llms.txt
---

# Create webhook

> **Important:** The secret attribute is only shown when creating a webhook. Store your webhook secret securely. If it is lost, you will need to delete and recreate the webhook to obtain a new one.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Onlypays",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.staging.zafepay.com/api"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/integration/webhooks": {
      "post": {
        "summary": "Create webhook",
        "description": "> **Important:** The secret attribute is only shown when creating a webhook. Store your webhook secret securely. If it is lost, you will need to delete and recreate the webhook to obtain a new one.",
        "operationId": "create-webhook",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "Header to access api endpoints (Check the authentication section).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "webhook": {
                    "properties": {
                      "events": {
                        "type": "array",
                        "description": "An array containing the events that you want to be notified",
                        "items": {
                          "type": "string"
                        }
                      },
                      "name": {
                        "type": "string",
                        "description": "Custom name to identify the webhook"
                      },
                      "url": {
                        "type": "string",
                        "description": "URL to which the webhook will send the request"
                      }
                    },
                    "required": [
                      "events",
                      "name",
                      "url"
                    ],
                    "type": "object",
                    "description": "Envelops the message content."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  data: {\n    id: \"6a74bc9c-c007-45a8-a52e-3156491f52ee\",\n    events: [\n      \"accepted_transaction\",\n   \t\t\"rejected_transaction\"\n    ],\n    name: \"Test webhook\"\n    secret: \"56ae93962302e1fced24b426c59484ba94517870d10d74b3096\"\n    url: \"https://example.com/webhook\",\n  }\n}"
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "security": []
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "64c97d0ad3b2f2002d150a5d:64f71d104fa786005e64768c"
}
```