{
  "openapi": "3.0.1",
  "info": {
    "title": "Younium API (production-westeurope)",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.younium.com"
    }
  ],
  "paths": {
    "/Webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get Webhooks",
        "operationId": "get-webhooks",
        "parameters": [
          {
            "name": "api-version",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookModel"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookModel"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookModel"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "oauth2": [
              "youniumapi"
            ]
          }
        ]
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create Webhook",
        "operationId": "post-webhooks",
        "parameters": [
          {
            "name": "api-version",
            "in": "header",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "younium-idempotency-key",
            "in": "header",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "younium-idempotency-durationInHours",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CreateWebhookRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookModel"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookModel"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookModel"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "oauth2": [
              "youniumapi"
            ]
          }
        ]
      }
    },
    "/Webhooks/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get Webhook by id",
        "operationId": "get-webhooks-id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "api-version",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookModel"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookModel"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "400": {
            "description": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "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
                    },
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "additionalProperties": { }
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "youniumapi"
            ]
          }
        ]
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete Webhook",
        "description": "",
        "operationId": "delete-webhooks-id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The identifier of the webhook",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "api-version",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "400": {
            "description": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "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
                    },
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "additionalProperties": { }
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "youniumapi"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "CreateWebhookRequest": {
        "required": [
          "events",
          "url"
        ],
        "type": "object",
        "properties": {
          "url": {
            "minLength": 1,
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "webhookStatus": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookStatus"
              }
            ]
          }
        },
        "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
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "additionalProperties": { }
      },
      "WebhookModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "nullable": true
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "token": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "webhookStatus": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookStatus"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "WebhookStatus": {
        "enum": [
          "Enabled",
          "Disabled"
        ],
        "type": "string"
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "password": {
            "tokenUrl": "https://auth.younium.com/connect/token",
            "scopes": {
              "youniumapi": "Access Younium API"
            }
          }
        }
      }
    }
  }
}