# Create or update a webhook

Creates a new webhook or updates an existing one based on the webhook type

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "CM.Email.Configuration.API - Create/Update Webhook",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.cm.com/email/webhook"
    }
  ],
  "paths": {
    "/v1/accounts/{logicalAccountId}/create": {
      "post": {
        "tags": [
          "EmailWebhooks"
        ],
        "summary": "Create or update a webhook",
        "description": "Creates a new webhook or updates an existing one based on the webhook type",
        "parameters": [
          {
            "name": "logicalAccountId",
            "in": "path",
            "required": true,
            "style": "simple",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPostDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Int32ControllerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "WebhookPostDto": {
        "type": "object",
        "properties": {
          "webhookType": {
            "type": "string",
            "nullable": true
          },
          "webhookUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Int32ControllerResponse": {
        "type": "object",
        "properties": {
          "isSuccess": {
            "type": "boolean"
          },
          "statusCode": {
            "$ref": "#/components/schemas/StatusCode"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "data": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "StatusCode": {
        "enum": [
          200,
          400,
          404,
          500,
          999
        ],
        "type": "integer",
        "format": "int32"
      }
    },
    "securitySchemes": {
      "X-CM-SSO-ACCOUNTGUID": {
        "type": "apiKey",
        "description": "Custom header for SSO Account GUID",
        "name": "X-CM-SSO-ACCOUNTGUID",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "X-CM-SSO-ACCOUNTGUID": []
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 104,
      "1": 190,
      "2": 117,
      "3": 138,
      "4": 5,
      "5": 88,
      "6": 169,
      "7": 11,
      "8": 25,
      "9": 16,
      "10": 160,
      "11": 250
    }
  }
}
```