{
  "openapi": "3.0.0",
  "info": {
    "title": "Webhooks service",
    "version": "1.00.11.02",
    "license": {}
  },
  "paths": {
    "/.well-known": {
      "get": {
        "summary": "Get well known config.",
        "description": "Get well known config<br />\n\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns an object\n",
        "tags": [
          "Well Known config"
        ],
        "responses": {
          "200": {
            "description": "Success\n\n```\n{\n    \"public_key\": \"string\" //same as <service>/publickeys endpoint,\n}\n```\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WellKnowResponse"
                }
              }
            }
          }
        }
      }
    },
    "/tenant/{tenantId}/community/{communityId}/webhook": {
      "put": {
        "summary": "Create webhook.",
        "description": "Create webhook.<br />\n- A valid community license key with auth level **system** / **service** or / **service_ext** is required\n\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n\n|            **Request Body**                  |\n|----------------------------------------------|\n\n\n### eventNames (required)\nThis key sets the event names for webhook. <br />\n\n### name (required)\nThis key sets the name for the webhook. <br />\n\n### disabled (required)\nThis key set disabled status of a webhook. <br />\n\n### createdBy (required)\nThis key sets the created by for the webhook. <br />\n\n### tags (optional)\nThe tags key will use to filter the webhooks\n\n### query (optional)\nThe query to filter webhooks.<br />\n\n### criteria (optional)\nThis key sets the status of a webhook. The type key only accept these values (\"ALL\", \"ANY\").<br />\n\n### api (required)\nThis key sets the API details of a webhook.\n\n### successCodes (required)\nThis key sets the success codes of a API.\n\n### retryCodes (optional)\nThis key sets the retry codes of a API.\n\n### retryCount (optional)\nThis key sets the retry count of API calles. min = 0, max 2\n\n### ttl (optional)\nThis key sets the ttl of API response. min = 0, max 5\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns the created webhook data. <br />\nThis API throw an error if something goes wrong.\n",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "keyId": []
          },
          {
            "keySecret": []
          },
          {
            "license": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "tenantId",
            "description": "ID of tenant",
            "required": true,
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxx"
            }
          },
          {
            "in": "path",
            "name": "communityId",
            "required": true,
            "description": "ID of community",
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxx"
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "requestBody": {
          "description": "Request body contains below fields to create webhook.\n  ```\n  {\n      \"eventName\": \"xxxx\",\n      \"name\": \"xxxx\",\n      \"disabled\": false,\n      \"createdBy\": \"xxxx\",\n      \"query\": [\n         {\n          \"key1\": \"xxxx\"\n         }\n       ],\n       \"criteria\": \"ANY/ALL\",\n       \"api\": {\n         \"type\": \"POST\",\n         \"url\": \"https://xxx.xxxxxx.xxx/xxxxx\",\n         \"authType\": \"none\", // Valid auth types [ none, basic, bearer, api_key, oauth2]\n         \"oAuthGrantType\": \"client_credentials\", // required for authType = oauth2\n         \"oAuthTokenUrl\": \"xxxxx\", Token URL for OAuth2, required for authType = oauth2\n         \"oAuthScopes\": [], // Array of OAuth2 scopes, optional\n         \"credential\": {\n           \"username\": \"xxxx\", // This should be plain text\n           \"password\": \"xxxx\", // This should be plain text\n           \"keyName\": \"xxxx\", // This should be plain text\n           \"keyValue\": \"xxxx\", // This should be plain text\n           \"token\": \"xxxx\" // This should be plain text\n           \"oauth2\": {\n              \"clientId\": \"xxxx\", // Client ID for OAuth2\n              \"clientSecret\": \"xxxx\", // Client Secret for OAuth2\n            }\n          }\n        },\n       \"successCodes\": [\n           200\n       ],\n       \"retryCodes\": [\n          0\n       ],\n      \"retryCount\": 0,\n      \"ttl\": 0\n  }\n  ```\n",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "405": {
            "description": "Method Not Allowed"
          }
        }
      }
    },
    "/tenant/{tenantId}/community/{communityId}/webhook/{webhookId}": {
      "patch": {
        "summary": "Update webhook.",
        "description": "Update webhook.<br />\n- A valid community license key with auth level **system** / **service** or / **service_ext** is required\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n\n|            **Request Body**                  |\n|----------------------------------------------|\n\n\n### name (required)\nThis key sets the name for the webhook. <br />\n\n### disabled (required)\nThis key set disabled status of a webhook. <br />\n\n### eventNames (required)\nThis key sets the event names for webhook. <br />\n\n### query (optional)\nThe query to filter webhooks.<br />\n\n### criteria (optional)\nThis key sets the status of a webhook. The type key only accept these values (\"ALL\", \"ANY\").<br />\n\n### api (required)\nThis key sets the API details of a webhook.\n\n### successCodes (required)\nThis key sets the success codes of a API.\n\n### retryCodes (optional)\nThis key sets the retry codes of a API.\n\n### retryCount (optional)\nThis key sets the retry count of API calles. min = 0, max 2\n\n### ttl (optional)\nThis key sets the ttl of API response. min = 0, max 5\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns the created webhook data. <br />\nThis API throw an error if something goes wrong.\n",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "keyId": []
          },
          {
            "keySecret": []
          },
          {
            "license": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "tenantId",
            "description": "ID of tenant",
            "required": true,
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxxxx"
            }
          },
          {
            "in": "path",
            "name": "communityId",
            "required": true,
            "description": "ID of community",
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxxxx"
            }
          },
          {
            "in": "path",
            "name": "webhookId",
            "description": "ID of webhook",
            "required": true,
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxxxx"
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "requestBody": {
          "description": "Request body contains below fields to update webhook.\n  ```\n  {\n      \"name\": \"xxxx\",\n      \"disabled\": false,\n      \"eventNames\": ['E_IDV_DOCUMENT_VALIDATE'],\n      \"query\": [\n         {\n          \"key1\": \"xxxx\"\n         }\n       ],\n       \"criteria\": \"ANY/ALL\",\n       \"api\": {\n         \"type\": \"POST\",\n         \"url\": \"https://xxx.xxxxxx.xxx/xxxxx\",\n         \"authType\": \"none\", // Valid auth types [ none, basic, bearer, api_key, oauth2]\n         \"oAuthGrantType\": \"client_credentials\", // required for authType = oauth2\n         \"oAuthTokenUrl\": \"xxxxx\", Token URL for OAuth2, required for authType = oauth2\n         \"oAuthScopes\": [], // Array of OAuth2 scopes, optional\n         \"credential\": {\n           \"username\": \"xxxx\", // This should be plain text\n           \"password\": \"xxxx\", // This should be plain text\n           \"keyName\": \"xxxx\", // This should be plain text\n           \"keyValue\": \"xxxx\", // This should be plain text\n           \"token\": \"xxxx\" // This should be plain text\n           \"oauth2\": {\n              \"clientId\": \"xxxx\", // Client ID for OAuth2\n              \"clientSecret\": \"xxxx\", // Client Secret for OAuth2\n            }\n          }\n        },\n       \"successCodes\": [\n           200\n       ],\n       \"retryCodes\": [\n          0\n       ],\n      \"retryCount\": 0,\n      \"ttl\": 0\n  }\n  ```\n",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "405": {
            "description": "Method Not Allowed"
          }
        }
      },
      "delete": {
        "summary": "Delete webhook.",
        "description": "Delete webhook.<br />\n- A valid community license key with auth level **system** / **service** or / **service_ext** is required\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns no content. <br />\nThis API throw an error if something goes wrong.\n",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "keyId": []
          },
          {
            "keySecret": []
          },
          {
            "license": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "tenantId",
            "description": "ID of tenant",
            "required": true,
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxxxx"
            }
          },
          {
            "in": "path",
            "name": "communityId",
            "required": true,
            "description": "ID of community",
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxxxx"
            }
          },
          {
            "in": "path",
            "name": "webhookId",
            "description": "ID of webhook",
            "required": true,
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxxxx"
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success\n"
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "405": {
            "description": "Method Not Allowed"
          }
        }
      }
    },
    "/tenant/{tenantId}/community/{communityId}/webhooks/fetch": {
      "post": {
        "summary": "Fetch webhooks.",
        "description": "Fetch webhooks.<br />\n- A valid community license key with auth level **system** / **service** or / **service_ext** is required\n- If the **system** key is used to fetch webhooks, then only webhooks have the credential object.\n- If another key is used to fetch webhooks, the API does not provide a credential object.\n\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n\n|            **Request Body**                  |\n|----------------------------------------------|\n\n### pIndex (optional)\nThe pIndex key is a cursor for the pagination.\n\n### pSize (optional)\nA limit on the number of objects to be returned. The range between 1 to 100 and the default is 25.\n\n### tags (optional)\nThe tags key will use to filter the webhooks\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns the fetched webhook data. <br />\nThis API throw an error if something goes wrong.\n",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "keyId": []
          },
          {
            "keySecret": []
          },
          {
            "license": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "tenantId",
            "description": "ID of tenant",
            "required": true,
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxx"
            }
          },
          {
            "in": "path",
            "name": "communityId",
            "required": true,
            "description": "ID of community",
            "schema": {
              "type": "string",
              "example": "xxxxxxxxxxxx"
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "requestBody": {
          "description": "Request body contains below fields to fetch webhook.\n",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FetchWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success\nWebhooks fetch result with pagination details.\n\n```\n{\n    \"page\": {\n        \"index\": 0,      page number, starting from 0\n        \"total\": 50,     total number of records\n        \"size\": 25      number of records, per page\n    },\n    \"data\": [\n      {\n         \"_id\": \"xxxxxxxxxxxxxxx\",\n          \"tenantId\": \"xxxx\",\n          \"communityId\": \"xxxx\",\n          \"eventNames\": [\"xxxx\"],\n          \"tags\": [\"xxxxx\"],\n          \"name\": \"xxxx\",\n          \"disabled\": false,\n          \"createdBy\": \"xxxx\",\n          \"query\": [\n             {\n              \"key1\": \"xxxx\"\n             }\n           ],\n           \"criteria\": \"ANY\",\n           \"api\": {\n             \"type\": \"POST\",\n             \"url\": \"https://xxx.xxxxxx.xxx/xxxxx\",\n             \"authType\": \"none\",\n             \"oAuthGrantType\": \"client_credentials\",\n             \"oAuthTokenUrl\": \"xxxxx\",\n             \"oAuthScopes\": [],\n             \"credential\": {\n               \"username\": \"xxxx\",\n               \"password\": \"xxxx\",\n               \"keyName\": \"xxxx\",\n               \"keyValue\": \"xxxx\",\n               \"token\": \"xxxx\",\n               \"oauth2\": {\n                    \"clientId\": \"xxxx\",\n                    \"clientSecret\": \"xxxx\"\n                }\n               }\n             },\n           \"successCodes\": [\n               200\n           ],\n           \"retryCodes\": [\n              0\n           ],\n          \"retryCount\": 0,\n          \"ttl\": 0\n      }\n    ],\n    \"publicKey\": \"servicekey's publickey\"\n}\n```\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FetchWebhookResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "405": {
            "description": "Method Not Allowed"
          }
        }
      }
    },
    "/servicekeys": {
      "get": {
        "summary": "Get service keys",
        "description": "This endpoint returns available service keys.\nThe license you are using must be of authLevel 'system'\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns array with service keys\n",
        "tags": [
          "Service Key"
        ],
        "security": [
          {
            "keyId": []
          },
          {
            "keySecret": []
          },
          {
            "license": []
          }
        ],
        "parameters": [
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceKeysResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/servicekey/{keyId}": {
      "delete": {
        "summary": "Reset Service Key",
        "description": "This endpoint resets service key for given keyId. Deletes current one and recreates a new one.\nThe license you are using must be of authLevel 'system'\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### keyId (required)\nThe keyId of service key to reset\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns re-created service key\n",
        "tags": [
          "Service Key"
        ],
        "security": [
          {
            "keyId": []
          },
          {
            "keySecret": []
          },
          {
            "license": []
          }
        ],
        "parameters": [
          {
            "name": "keyId",
            "in": "path",
            "description": "keyId of service key to reset",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceKeysResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/sd": {
      "get": {
        "summary": "Get all service directories.",
        "description": "Get all service directories.\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns all service directories.\n",
        "tags": [
          "Service Directory"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetServiceComponentsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/publickeys": {
      "get": {
        "summary": "Get system's public key.",
        "description": "Get system's public key.\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns a public key object\n",
        "tags": [
          "Public Key"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicKeyResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid ECDSA signature / ID found."
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "summary": "Get healthz.",
        "description": "Get healthz<br />\n\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns a healthz object\n - ```version = <git-tag>.<commit-id>.<dob>``` <br />\n\n - ```git-tag```: When code is compiled from a git-tag, this must carry the tag name. This should match one of the git tags.\n - ```commit-id```: This is the git-commit-id. eg: When code is built from this, the hex code, in the end, is the commit it.\n - ```dob```: Date Of Build. This is epoc-time-in-se\tconds that tell the time when the build was created.\n - \u200bif the code is not built from a git-tag, then the ```version =\ufffc<commit-id>.<dob>```\n",
        "tags": [
          "Healthz"
        ],
        "responses": {
          "200": {
            "description": "Success\n\n```\n{\n    \"status\": \"all services operational\",\n    \"publicKey\": \"string\" //same as <service>/publickeys endpoint,\n    \"code\": \"200\",\n    \"version\": \"<version>\" //as defined above\n}\n```\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthzResponse"
                }
              }
            }
          }
        }
      }
    },
    "/environment": {
      "get": {
        "description": "Provide details regarding the environments.\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns an environment object\n",
        "tags": [
          "Environment"
        ],
        "security": [
          {
            "license": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/ecdsa_helper/{method}": {
      "post": {
        "summary": "Encrypt and decrypt the data string by public key and private key.",
        "description": "Encrypt and decrypt the data string by public key and private key.\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### method (optional)\nThe method parameter is type of enum. Default value is encrypt. <br />\nThis parameter only accepts following values <br />\n   **encrypt**, **decrypt**\n\n\n|            **Request Body**                  |\n|----------------------------------------------|\n\n\n### data (optional)\nThe data key is type of String.\n\n<br />\n### publicKey (required)\nThe publicKey is type of string.\n\n<br />\n### privateKey (required)\nThe privateKey is type of string.\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns the encrypted/decrypted string. <br />\nThis API throw an error if something goes wrong. A common source of error is public or private key is not valid.\n",
        "tags": [
          "ECDSA Helper"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EcdsaEncryptDecryptRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "method",
            "schema": {
              "type": "string",
              "enum": [
                "encrypt",
                "decrypt"
              ],
              "default": "encrypt"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EcdsaEncryptDecryptResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PublicKeyResponse": {
        "type": "object",
        "properties": {
          "publicKey": {
            "type": "string"
          }
        },
        "example": {
          "publicKey": ""
        }
      },
      "HealthzResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "publicKey": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        },
        "example": {
          "status": "all services operational",
          "publicKey": "//same as <service>/publickeys endpoint",
          "code": "200",
          "version": "xxxx.xxxx.xxxx"
        }
      },
      "WellKnowResponse": {
        "type": "object",
        "properties": {
          "public_key": {
            "type": "string"
          }
        },
        "example": {
          "public_key": "//same as <service>/publickeys endpoint"
        }
      },
      "EcdsaEncryptDecryptRequest": {
        "type": "object",
        "properties": {
          "data": {
            "type": "string"
          },
          "publicKey": {
            "type": "string"
          },
          "privateKey": {
            "type": "string"
          }
        },
        "example": {
          "data": "Hey, This is example data string.",
          "publicKey": "xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxx=",
          "privateKey": "xxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxx="
        }
      },
      "EcdsaEncryptDecryptResponse": {
        "type": "object",
        "properties": {
          "publicKey": {
            "type": "string"
          },
          "data": {
            "type": "array"
          }
        },
        "example": {
          "data": "xxxxxxxxxxxxxxxxxxxx",
          "publicKey": "xxxxxxxxxxxxxxxxxxxx"
        }
      },
      "ServiceKeysResponse": {
        "type": "array",
        "description": "Service keys array",
        "items": {
          "type": "object",
          "required": [
            "tag",
            "keyId",
            "keySecret",
            "type"
          ],
          "properties": {
            "tag": {
              "type": "string",
              "description": "service ecdsa"
            },
            "keyId": {
              "type": "string",
              "description": "ecdsa publicKey"
            },
            "keySecret": {
              "type": "string",
              "description": "ecdsa private key"
            },
            "type": {
              "type": "string",
              "description": "default = ecdsa | hawk"
            }
          },
          "example": {
            "tag": "xxxxx",
            "keyId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
            "keySecret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
            "type": "xxxxx"
          }
        }
      },
      "GetServiceComponentsResponse": {
        "type": "object",
        "properties": {
          "name1": {
            "type": "string"
          },
          "name2": {
            "type": "string"
          },
          "name3": {
            "type": "string"
          }
        },
        "example": {
          "name1": "https://xxx.xxxxxx.xxx/xxxxx",
          "name2": "https://xxx.xxxxxx.xxx/xxxxx",
          "name3": "https://xxx.xxxxxx.xxx/xxxxx"
        }
      },
      "CreateWebhookRequest": {
        "type": "object",
        "required": [
          "eventNames",
          "name",
          "api",
          "successCodes"
        ],
        "properties": {
          "eventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "example": "xxxx"
            }
          },
          "name": {
            "type": "string",
            "example": "xxxx"
          },
          "disabled": {
            "type": "boolean",
            "example": false
          },
          "createdBy": {
            "type": "string",
            "example": "xxxx"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "example": "log_stream"
            }
          },
          "query": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key1": {
                  "type": "string",
                  "example": "xxxx"
                }
              }
            }
          },
          "criteria": {
            "type": "string",
            "example": "ANY"
          },
          "api": {
            "type": "object",
            "required": [
              "type",
              "url",
              "authType",
              "credential"
            ],
            "properties": {
              "type": {
                "type": "string",
                "example": "POST"
              },
              "url": {
                "type": "string",
                "example": "https://xxx.xxxxxx.xxx/xxxxx"
              },
              "authType": {
                "type": "string",
                "example": "none"
              },
              "oAuthGrantType": {
                "type": "string",
                "example": "client_credentials"
              },
              "oAuthTokenUrl": {
                "type": "string",
                "example": "xxxx"
              },
              "oAuthScopes": {
                "type": "array",
                "example": [
                  "xxxx"
                ]
              },
              "credential": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "password": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "keyName": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "keyValue": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "token": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "oauth2": {
                    "type": "object",
                    "properties": {
                      "clientId": {
                        "type": "string",
                        "example": "xxxx"
                      },
                      "clientSecret": {
                        "type": "string",
                        "example": "xxxx"
                      }
                    }
                  }
                }
              }
            }
          },
          "successCodes": {
            "type": "array",
            "items": {
              "type": "number",
              "example": 200
            }
          },
          "retryCodes": {
            "type": "array",
            "items": {
              "type": "number",
              "example": 0
            }
          },
          "retryCount": {
            "type": "number",
            "example": 0
          },
          "ttl": {
            "type": "number",
            "example": 0
          }
        }
      },
      "WebhookResponse": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "example": "xxxxxxxxxxxxxxx"
          },
          "tenantId": {
            "type": "string",
            "example": "xxxx"
          },
          "communityId": {
            "type": "string",
            "example": "xxxx"
          },
          "eventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "example": "xxxx"
            }
          },
          "name": {
            "type": "string",
            "example": "xxxx"
          },
          "disabled": {
            "type": "boolean",
            "example": false
          },
          "createdBy": {
            "type": "string",
            "example": "xxxx"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "example": "log_stream"
            }
          },
          "query": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key1": {
                  "type": "string",
                  "example": "xxxx"
                }
              }
            }
          },
          "criteria": {
            "type": "string",
            "example": "ANY"
          },
          "api": {
            "type": "object",
            "required": [
              "type",
              "url",
              "authType",
              "credential"
            ],
            "properties": {
              "type": {
                "type": "string",
                "example": "POST"
              },
              "url": {
                "type": "string",
                "example": "https://xxx.xxxxxx.xxx/xxxxx"
              },
              "authType": {
                "type": "string",
                "example": "none"
              },
              "oAuthGrantType": {
                "type": "string",
                "example": "client_credentials"
              },
              "oAuthTokenUrl": {
                "type": "string",
                "example": "xxxx"
              },
              "oAuthScopes": {
                "type": "array",
                "example": [
                  "xxxx"
                ]
              },
              "credential": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "password": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "keyName": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "keyValue": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "token": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "oauth2": {
                    "type": "object",
                    "properties": {
                      "clientId": {
                        "type": "string",
                        "example": "xxxx"
                      },
                      "clientSecret": {
                        "type": "string",
                        "example": "xxxx"
                      }
                    }
                  }
                }
              }
            }
          },
          "successCodes": {
            "type": "array",
            "items": {
              "type": "number",
              "example": 200
            }
          },
          "retryCodes": {
            "type": "array",
            "items": {
              "type": "number",
              "example": 0
            }
          },
          "retryCount": {
            "type": "number",
            "example": 0
          },
          "ttl": {
            "type": "number",
            "example": 0
          }
        }
      },
      "FetchWebhookRequest": {
        "type": "object",
        "properties": {
          "pIndex": {
            "type": "number",
            "example": 0
          },
          "pSize": {
            "type": "number",
            "example": 25
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "FetchWebhookResponse": {
        "type": "object",
        "properties": {
          "page": {
            "tyep": "object",
            "properties": {
              "index": {
                "type": "number",
                "example": 0
              },
              "total": {
                "type": "number",
                "example": 0
              },
              "size": {
                "type": "number",
                "example": 0
              }
            }
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/WebhookResponse"
            }
          }
        }
      },
      "UpdateWebhookRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "xxxx"
          },
          "disabled": {
            "type": "boolean",
            "example": false
          },
          "eventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "example": "xxxx"
            }
          },
          "query": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key1": {
                  "type": "string",
                  "example": "xxxx"
                }
              }
            }
          },
          "criteria": {
            "type": "string",
            "example": "ANY"
          },
          "api": {
            "type": "object",
            "required": [
              "type",
              "url",
              "authType",
              "credential"
            ],
            "properties": {
              "type": {
                "type": "string",
                "example": "POST"
              },
              "url": {
                "type": "string",
                "example": "https://xxx.xxxxxx.xxx/xxxxx"
              },
              "authType": {
                "type": "string",
                "example": "none"
              },
              "oAuthGrantType": {
                "type": "string",
                "example": "client_credentials"
              },
              "oAuthTokenUrl": {
                "type": "string",
                "example": "xxxx"
              },
              "oAuthScopes": {
                "type": "array",
                "example": [
                  "xxxx"
                ]
              },
              "credential": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "password": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "keyName": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "keyValue": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "token": {
                    "type": "string",
                    "example": "xxxx"
                  },
                  "oauth2": {
                    "type": "object",
                    "properties": {
                      "clientId": {
                        "type": "string",
                        "example": "xxxx"
                      },
                      "clientSecret": {
                        "type": "string",
                        "example": "xxxx"
                      }
                    }
                  }
                }
              }
            }
          },
          "successCodes": {
            "type": "array",
            "items": {
              "type": "number",
              "example": 200
            }
          },
          "retryCodes": {
            "type": "array",
            "items": {
              "type": "number",
              "example": 0
            }
          },
          "retryCount": {
            "type": "number",
            "example": 0
          },
          "ttl": {
            "type": "number",
            "example": 0
          }
        }
      },
      "CreateTopicRequest": {
        "type": "object",
        "required": [
          "topicName",
          "enabled"
        ],
        "properties": {
          "topicName": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "enabled": {
            "type": "string",
            "example": true
          },
          "createdBy": {
            "type": "string",
            "example": "xxxxxxxx"
          }
        }
      },
      "UpdateTopicRequest": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "string",
            "example": true
          }
        }
      },
      "FetchTopicRequest": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "string",
            "example": true
          }
        }
      },
      "FetchTopicsResponse": {
        "type": "array",
        "items": {
          "type": "object",
          "$ref": "#/components/schemas/TopicResponse"
        }
      },
      "TopicResponse": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "tenantId": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "communityId": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "topicName": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "enabled": {
            "type": "string",
            "example": true
          },
          "createdBy": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "updatedTs": {
            "type": "number",
            "example": "xxxxxxxx"
          }
        }
      }
    },
    "securitySchemes": {
      "keyId": {
        "type": "apiKey",
        "name": "keyId",
        "in": "header",
        "description": "ECDSA Public Key"
      },
      "keySecret": {
        "type": "apiKey",
        "name": "keySecret",
        "in": "header",
        "description": "ECDSA Private Key"
      },
      "license": {
        "type": "apiKey",
        "name": "license",
        "in": "header",
        "description": "License key from License Microservice"
      }
    }
  },
  "tags": [
    {
      "name": "Well Known config"
    },
    {
      "name": "Service Key"
    },
    {
      "name": "Public Key"
    },
    {
      "name": "Healthz"
    },
    {
      "name": "Environment"
    },
    {
      "name": "ECDSA Helper"
    }
  ]
}