v2

latestOpenAPI 3.1.02026-07-312303692.4 MB
Event Type

Event Type Import From Openapi

Given an OpenAPI spec, create new or update existing event types.

If an existing archived event type is updated, it will be unarchived. The importer will convert all webhooks found in the either the webhooks or x-webhooks top-level.

post/api/v1/event-type/import/openapi

Headers

idempotency-keystring

The request's idempotency key

Request body

dryRunboolean

If true, return the event types that would be modified without actually modifying them.

replaceAllboolean

If true, all existing event types that are not in the spec will be archived.

specobject nullable

A pre-parsed JSON spec.

specRawstring nullable

A string, parsed by the server as YAML or JSON.

Example request

{
  "spec": {
    "openapi": "3.1.0",
    "info": {
      "title": "Webhook Example",
      "version": "1.0.0"
    },
    "webhooks": {
      "pet.new": {
        "post": {
          "requestBody": {
            "description": "Information about a new pet in the system",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "type": "integer",
                      "format": "int64"
                    },
                    "name": {
                      "type": "string"
                    },
                    "tag": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ]
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": "Return a 200 status to indicate that the data was received successfully"
            }
          }
        }
      }
    }
  },
  "specRaw": "\n# Both YAML and JSON are supported\nopenapi: 3.1.0\ninfo:\n  title: Webhook Example\n  version: 1.0.0\n# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components\nwebhooks:\n  # Each webhook needs a name\n  \"pet.new\":\n    # This is a Path Item Object, the only difference is that the request is initiated by the API provider\n    post:\n      requestBody:\n        description: Information about a new pet in the system\n        content:\n          application/json:\n            schema:\n              $ref: \"#/components/schemas/Pet\"\n      responses:\n        \"200\":\n          description: Return a 200 status to indicate that the data was received successfully\n\ncomponents:\n  schemas:\n    Pet:\n      required:\n        - id\n        - name\n      properties:\n        id:\n          type: integer\n          format: int64\n        name:\n          type: string\n        tag:\n          type: string\n"
}

Response

Example response

{
  "data": {
    "modified": [
      "user.signup"
    ],
    "to_modify": [
      {
        "name": "user.signup",
        "schemas": {
          "title": "Invoice Paid Event",
          "description": "An invoice was paid by a user",
          "type": "object",
          "properties": {
            "invoiceId": {
              "description": "The invoice id",
              "type": "string"
            },
            "userId": {
              "description": "The user id",
              "type": "string"
            }
          },
          "required": [
            "invoiceId",
            "userId"
          ]
        },
        "groupName": "user"
      }
    ]
  }
}