{
  "openapi": "3.0.3",
  "info": {
    "title": "AuthGuard API",
    "version": "0.22.0"
  },
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/domains/{domain}/accounts": {
      "post": {
        "operationId": "createAccount",
        "description": "Create an account",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdempotentKeyHeader"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "409": {
            "description": "Conflict - if the idempotent key header was used to create an account before",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}": {
      "get": {
        "operationId": "getAccountById",
        "description": "Get an account by ID",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "patch": {
        "operationId": "patchAccount",
        "description": "Update account information",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAccountRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deleteAccount",
        "description": "Delete an account",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/identifier/{id}": {
      "get": {
        "operationId": "getAccountByCredentialsIdentifier",
        "description": "Get an account by credentials identifier",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdentifierParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/externalId/{id}": {
      "get": {
        "operationId": "getAccountByExternalId",
        "description": "Get an account by external ID",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/email/{email}": {
      "get": {
        "operationId": "getAccountByEmail",
        "description": "Get an account by email, regardless of whether it's the primary email or not",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/EmailParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/email/{email}/exists": {
      "get": {
        "operationId": "emailExists",
        "description": "Checks whether an account with that email exists",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/EmailParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}/permissions": {
      "patch": {
        "operationId": "updateAccountPermissions",
        "description": "Update the permissions of an account",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PermissionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}/roles": {
      "patch": {
        "operationId": "updateAccountRoles",
        "description": "Update the roles of an account",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RolesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}/activate": {
      "patch": {
        "operationId": "activateAnAccount",
        "description": "Activate an account if not already active",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}/deactivate": {
      "patch": {
        "operationId": "deactivateAnAccount",
        "description": "Deactivate an account if it's active",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}/apps": {
      "get": {
        "operationId": "getApplicationsByAccountId",
        "description": "Get a list of applications associated with an account",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationsArrayResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}/locks": {
      "get": {
        "operationId": "getLocksByAccountId",
        "description": "Get a list of active locks placed on an account",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountLocksArrayResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/{id}/crypto_keys": {
      "get": {
        "operationId": "getCryptoKeysByAccountId",
        "description": "Get a list of cryptographic keys associated with an account",
        "tags": [
          "Accounts",
          "Key Management System"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          },
          {
            "$ref": "#/components/parameters/CursorQueryParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/CryptoKeysArrayResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/identifier/{identifier}": {
      "get": {
        "operationId": "getAccountByIdentifier",
        "description": "Get account by identifier",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdentifierParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/accounts/identifier/{identifier}/exists": {
      "get": {
        "operationId": "identifierExists",
        "description": "Check whether an identifier exists or not",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdentifierParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/domains/{domain}/credentials/{id}/password": {
      "patch": {
        "operationId": "updatePassword",
        "description": "Update the password in a credentials entity",
        "tags": [
          "Credentials"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCredentialsPasswordRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/credentials/{id}/identifiers": {
      "patch": {
        "operationId": "addIdentifier",
        "description": "Add new identifiers to credentials",
        "tags": [
          "Credentials"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserIdentifiersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deleteIdentifier",
        "description": "Delete identifiers from credentials",
        "tags": [
          "Credentials"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserIdentifiersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/credentials/reset_token": {
      "post": {
        "operationId": "generateResetToken",
        "description": "Generates a new reset token which can be used by the user to set a new password",
        "tags": [
          "Credentials"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/PasswordResetTokenResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/credentials/reset": {
      "post": {
        "operationId": "resetPassword",
        "description": "Set a new password using a reset token or by using an identifier and its current password",
        "tags": [
          "Credentials"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/AccountResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps": {
      "post": {
        "operationId": "createApp",
        "description": "Create an application",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApplicationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/{id}": {
      "get": {
        "operationId": "getAppById",
        "description": "Get an application by ID",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deleteApp",
        "description": "Delete an application",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/{id}/permissions": {
      "patch": {
        "operationId": "updateAppPermissions",
        "description": "Update the permissions of an app",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PermissionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/{id}/roles": {
      "patch": {
        "operationId": "updateAppRoles",
        "description": "Update the roles of an app",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RolesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/{id}/keys": {
      "get": {
        "operationId": "getApiKeysByAppId",
        "description": "Get all API keys associated with an application",
        "tags": [
          "Applications",
          "API Keys"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApiKeysArrayResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/{id}/crypto_keys": {
      "get": {
        "operationId": "getCryptoKeysByAppId",
        "description": "Get a list of cryptographic keys associated with an application",
        "tags": [
          "Applications",
          "Key Management System"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          },
          {
            "$ref": "#/components/parameters/CursorQueryParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/CryptoKeysArrayResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/externalId/{id}": {
      "get": {
        "operationId": "getAppsByExternalId",
        "description": "Get an application by an external ID",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/{id}/activate": {
      "patch": {
        "operationId": "activateAnApp",
        "description": "Activate an application if not already active",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/apps/{id}/deactivate": {
      "patch": {
        "operationId": "deactivateAnApp",
        "description": "Deactivate an application if it's active",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/clients": {
      "post": {
        "operationId": "createClient",
        "description": "Create an AuthGuard client",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateClientRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "$ref": "#/components/responses/ClientResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "get": {
        "operationId": "getClientsByDomain",
        "description": "Get all clients for a domain",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/CursorQueryParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ClientsArrayResponse"
          }
        }
      }
    },
    "/domains/{domain}/clients/{id}": {
      "get": {
        "operationId": "getClientById",
        "description": "Get an client by ID",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ClientResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deleteClient",
        "description": "Delete a client",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ClientResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/clients/{id}/keys": {
      "get": {
        "operationId": "getApiKeysByClientId",
        "description": "Get all API keys associated with a client",
        "tags": [
          "Clients",
          "API Keys"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApiKeysArrayResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/clients/externalId/{id}": {
      "get": {
        "operationId": "getClientsByExternalId",
        "description": "Get an application by an external ID",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ClientResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/clients/{id}/activate": {
      "patch": {
        "operationId": "activateClient",
        "description": "Activate a client if not already active",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ClientResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/clients/{id}/deactivate": {
      "patch": {
        "operationId": "deactivateClient",
        "description": "Deactivate a client if it's active",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ClientResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/keys": {
      "post": {
        "operationId": "generateApiKey",
        "description": "Generate a new API key for an application",
        "tags": [
          "API Keys"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApiKeyResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/keys/verify": {
      "post": {
        "operationId": "verifyKey",
        "description": "Verify an API key",
        "tags": [
          "API Keys"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/keys/{id}": {
      "get": {
        "operationId": "getApiKeyById",
        "description": "Get an API key by ID",
        "tags": [
          "API Keys"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApiKeyResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiKey",
        "description": "Delete an API key by ID",
        "tags": [
          "API Keys"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ApiKeyResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/kms/generator": {
      "post": {
        "operationId": "generateCryptoKey",
        "description": "Generate a new crypto key",
        "tags": [
          "Key Management System"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CryptoKeyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/CryptoKeyResponse"
          },
          "201": {
            "description": "Success",
            "$ref": "#/components/responses/CryptoKeyResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/kms/keys/": {
      "get": {
        "operationId": "getCryptoKeysByDomain",
        "description": "Get crypto keys by domain",
        "tags": [
          "Key Management System"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/CursorQueryParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/CryptoKeysArrayResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/kms/keys/{id}": {
      "get": {
        "operationId": "getCryptoKeyById",
        "description": "Get a crypto key by ID",
        "tags": [
          "Key Management System"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          },
          {
            "$ref": "#/components/parameters/DecryptQueryParameter"
          },
          {
            "$ref": "#/components/parameters/PasscodeQueryParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/CryptoKeyResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deleteCryptoKey",
        "description": "Delete an crypto key by ID",
        "tags": [
          "Key Management System"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/CryptoKeyResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/roles": {
      "post": {
        "operationId": "createRole",
        "description": "Create a role",
        "tags": [
          "Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRoleRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "$ref": "#/components/responses/RoleResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/roles/{id}": {
      "get": {
        "operationId": "getRoleById",
        "description": "Get role by ID",
        "tags": [
          "Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/RoleResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "patch": {
        "operationId": "patchRole",
        "description": "Update role information",
        "tags": [
          "Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRoleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/RoleResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deleteRole",
        "description": "Delete a role",
        "tags": [
          "Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/RoleResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/roles/": {
      "get": {
        "operationId": "getAllRoles",
        "description": "Get all roles",
        "tags": [
          "Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/CursorQueryParameter"
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "$ref": "#/components/responses/RolesArrayResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/roles/domain/name/{name}": {
      "get": {
        "operationId": "getRoleByName",
        "description": "Get a role by its name",
        "tags": [
          "Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/NameParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/RoleResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/permissions": {
      "post": {
        "operationId": "createPermission",
        "description": "Create a permission",
        "tags": [
          "Permissions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePermissionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "$ref": "#/components/responses/PermissionResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/permissions/{id}": {
      "get": {
        "operationId": "getPermissionById",
        "description": "Get a permission by ID",
        "tags": [
          "Permissions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/PermissionResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "patch": {
        "operationId": "patchPermission",
        "description": "Update permission information",
        "tags": [
          "Permissions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePermissionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/PermissionResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "delete": {
        "operationId": "deletePermission",
        "description": "Delete a permission by ID",
        "tags": [
          "Permissions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/PermissionResponse"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/permissions/": {
      "get": {
        "operationId": "getAllPermissions",
        "description": "Get all permissions",
        "tags": [
          "Permissions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/CursorQueryParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/PermissionsArrayResponse"
          }
        }
      }
    },
    "/domains/{domain}/permissions/group/{group}": {
      "get": {
        "operationId": "getPermissionsByGroupName",
        "description": "Get a permissions by group name",
        "tags": [
          "Permissions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "$ref": "#/components/parameters/GroupParameter"
          },
          {
            "$ref": "#/components/parameters/CursorQueryParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/PermissionsArrayResponse"
          }
        }
      }
    },
    "/domains/{domain}/auth/exchange": {
      "post": {
        "operationId": "exchange",
        "description": "Perform an auth exchange",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/auth/exchange/clear": {
      "post": {
        "operationId": "clear",
        "description": "Clear (delete) a token",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "name": "tokenType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/auth/authenticate": {
      "post": {
        "operationId": "authenticate",
        "description": "Perform an auth exchange from 'basic' to what is specified in the configuration",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/auth/refresh": {
      "post": {
        "operationId": "refresh",
        "description": "Perform an auth exchange from 'refresh' to what is specified in the configuration",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/auth/logout": {
      "post": {
        "operationId": "logout",
        "description": "Clear (delete) a token based on whatever is specified in the configuration",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/auth/exchange/attempts": {
      "get": {
        "operationId": "getExchangeAttempts",
        "description": "Get a list of attempts performed for an entity",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fromTimestamp",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "fromExchange",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ExchangeAttemptsArrayResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/passwordless/verify": {
      "post": {
        "operationId": "Verify a passwordless token",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordlessRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/otp/verify": {
      "post": {
        "operationId": "Verify a one-time password",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OtpRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/verification/email": {
      "post": {
        "operationId": "Verify an email",
        "tags": [
          "Verification"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/actions/otp": {
      "post": {
        "operationId": "Generate a one-time password for an action",
        "tags": [
          "Action tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "name": "accountId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/SuccessfulAuthResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/actions/token": {
      "post": {
        "operationId": "Generate an action token either from an OTP generated by /actions/domains/{domain}/otp or by a user identifier and password",
        "tags": [
          "Action tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ActionTokenResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/domains/{domain}/actions/verify": {
      "post": {
        "operationId": "Verify that an action token is valid for the specified action",
        "tags": [
          "Action tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainParameter"
          },
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "$ref": "#/components/responses/ActionTokenResponse"
          },
          "400": {
            "description": "Bad request",
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "name": "Authorization",
        "type": "apiKey",
        "in": "header"
      }
    },
    "parameters": {
      "IdParameter": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "DomainParameter": {
        "name": "domain",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "IdentifierParameter": {
        "name": "identifier",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "NameParameter": {
        "name": "name",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "GroupParameter": {
        "name": "group",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "EmailParameter": {
        "name": "email",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "IdempotentKeyHeader": {
        "name": "X-IdempotentKey",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "CursorQueryParameter": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "DecryptQueryParameter": {
        "name": "decrypt",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "PasscodeQueryParameter": {
        "name": "passcode",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "ErrorResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "SuccessfulAuthResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuthResult"
            }
          }
        }
      },
      "AccountResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Account"
            }
          }
        }
      },
      "ApplicationResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Application"
            }
          }
        }
      },
      "ClientResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Client"
            }
          }
        }
      },
      "ClientsArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Client"
              }
            }
          }
        }
      },
      "ApiKeyResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiKey"
            }
          }
        }
      },
      "CryptoKeyResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CryptoKey"
            }
          }
        }
      },
      "RoleResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Role"
            }
          }
        }
      },
      "RolesArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Role"
              }
            }
          }
        }
      },
      "PermissionResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Permission"
            }
          }
        }
      },
      "ApplicationsArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Application"
              }
            }
          }
        }
      },
      "AccountLocksArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/AccountLock"
              }
            }
          }
        }
      },
      "PermissionsArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Permission"
              }
            }
          }
        }
      },
      "ExchangeAttemptsArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ExchangeAttempt"
              }
            }
          }
        }
      },
      "ApiKeysArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ApiKey"
              }
            }
          }
        }
      },
      "CryptoKeysArrayResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/CryptoKey"
              }
            }
          }
        }
      },
      "PasswordResetTokenResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PasswordResetToken"
            }
          }
        }
      },
      "ActionTokenResponse": {
        "description": "_",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ActionToken"
            }
          }
        }
      }
    },
    "schemas": {
      "Account": {
        "type": "object",
        "required": [
          "id",
          "active",
          "domain"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "middleName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "identifiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserIdentifier"
            }
          },
          "email": {
            "$ref": "#/components/schemas/Email"
          },
          "backupEmail": {
            "$ref": "#/components/schemas/Email"
          },
          "phoneNumber": {
            "$ref": "#/components/schemas/PhoneNumber"
          },
          "permissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Permission"
            }
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          },
          "metadata": {
            "description": "A collection of custom information to be attached to the account",
            "type": "object"
          }
        }
      },
      "UserIdentifier": {
        "type": "object",
        "required": [
          "type",
          "identifier",
          "active"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "USERNAME",
              "EMAIL",
              "PHONE_NUMBER"
            ]
          },
          "identifier": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "Application": {
        "type": "object",
        "required": [
          "id",
          "active",
          "domain"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "accountId": {
            "type": "string"
          },
          "permissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Permission"
            }
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "Client": {
        "type": "object",
        "required": [
          "id",
          "active",
          "domain",
          "clientType"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "clientType": {
            "type": "string",
            "enum": [
              "AUTH",
              "ADMIN"
            ]
          },
          "externalId": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "accountId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "baseUrl": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "Email": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          }
        }
      },
      "PhoneNumber": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          }
        }
      },
      "Permission": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "forAccounts": {
            "type": "boolean"
          },
          "forApplications": {
            "type": "boolean"
          }
        }
      },
      "PermissionsArray": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Permission"
            }
          }
        }
      },
      "Role": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "forAccounts": {
            "type": "boolean"
          },
          "forApplications": {
            "type": "boolean"
          }
        }
      },
      "RolesArray": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Role"
            }
          }
        }
      },
      "AccountLock": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "forClient": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CryptoKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "algorithm": {
            "type": "string"
          },
          "size": {
            "type": "number"
          },
          "accountId": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "privateKey": {
            "type": "string"
          },
          "publicKey": {
            "type": "string"
          },
          "passcodeProtected": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExchangeAttempt": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "entityId": {
            "type": "string"
          },
          "fromExchange": {
            "type": "string"
          },
          "toExchange": {
            "type": "string"
          },
          "successful": {
            "type": "boolean"
          },
          "deviceId": {
            "type": "string"
          },
          "externalSessionId": {
            "type": "string"
          },
          "clientId": {
            "type": "string"
          },
          "sourceIp": {
            "type": "string"
          },
          "userAgent": {
            "type": "string"
          }
        }
      },
      "AuthRequest": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string"
          },
          "identifier": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "token": {
            "type": "string"
          },
          "deviceId": {
            "type": "string"
          },
          "externalSessionId": {
            "type": "string"
          },
          "sourceIp": {
            "type": "string"
          },
          "userAgent": {
            "type": "string"
          },
          "restrictions": {
            "$ref": "#/components/schemas/TokenRestrictions"
          }
        }
      },
      "TokenRestrictions": {
        "type": "object",
        "properties": {
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AuthResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "token": {
            "type": "string"
          },
          "refreshToken": {
            "type": "string"
          },
          "validFor": {
            "type": "string",
            "description": "The duration for which the token will be valid (in seconds)"
          }
        }
      },
      "CreateAccountRequest": {
        "type": "object",
        "required": [
          "domain",
          "identifiers"
        ],
        "properties": {
          "externalId": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "middleName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "identifiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserIdentifier"
            }
          },
          "plainPassword": {
            "type": "string"
          },
          "email": {
            "$ref": "#/components/schemas/Email"
          },
          "backupEmail": {
            "$ref": "#/components/schemas/Email"
          },
          "phoneNumber": {
            "$ref": "#/components/schemas/PhoneNumber"
          },
          "permissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Permission"
            }
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          },
          "metadata": {
            "description": "A collection of custom information to be attached to the account",
            "type": "object"
          }
        }
      },
      "UpdateAccountRequest": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string"
          },
          "middleName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "email": {
            "$ref": "#/components/schemas/Email"
          },
          "backupEmail": {
            "$ref": "#/components/schemas/Email"
          },
          "phoneNumber": {
            "$ref": "#/components/schemas/PhoneNumber"
          }
        }
      },
      "CreateApplicationRequest": {
        "type": "object",
        "required": [
          "domain",
          "name"
        ],
        "properties": {
          "externalId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "accountId": {
            "type": "string"
          },
          "permissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Permission"
            }
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "CreateClientRequest": {
        "type": "object",
        "required": [
          "domain",
          "clientType",
          "name"
        ],
        "properties": {
          "externalId": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "accountId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "baseUrl": {
            "type": "string"
          },
          "clientType": {
            "type": "string",
            "enum": [
              "AUTH",
              "ADMIN"
            ]
          }
        }
      },
      "UpdateCredentialsPasswordRequest": {
        "type": "object",
        "properties": {
          "plainPassword": {
            "type": "string"
          }
        }
      },
      "ApiKeyRequest": {
        "type": "object",
        "required": [
          "appId",
          "keyType",
          "name",
          "forClient"
        ],
        "properties": {
          "appId": {
            "type": "string"
          },
          "keyType": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "validFor": {
            "$ref": "#/components/schemas/DurationRequest"
          },
          "forClient": {
            "type": "boolean"
          }
        }
      },
      "ApiKeyVerificationRequest": {
        "type": "object",
        "required": [
          "key",
          "keyType"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "keyType": {
            "type": "string"
          }
        }
      },
      "CryptoKeyRequest": {
        "type": "object",
        "required": [
          "algorithm",
          "size"
        ],
        "properties": {
          "algorithm": {
            "type": "string",
            "enum": [
              "AES",
              "RSA",
              "EC_SECP128K1"
            ]
          },
          "size": {
            "type": "number"
          },
          "accountId": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "keyType": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "persist": {
            "type": "boolean"
          },
          "passcodeProtected": {
            "type": "boolean"
          },
          "passcode": {
            "type": "string"
          }
        }
      },
      "CreateRoleRequest": {
        "type": "object",
        "required": [
          "name",
          "domain",
          "forAccounts",
          "forApplications"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "forAccounts": {
            "type": "boolean"
          },
          "forApplications": {
            "type": "boolean"
          }
        }
      },
      "UpdateRoleRequest": {
        "type": "object",
        "required": [
          "forAccounts",
          "forApplications"
        ],
        "properties": {
          "forAccounts": {
            "type": "boolean"
          },
          "forApplications": {
            "type": "boolean"
          }
        }
      },
      "CreatePermissionRequest": {
        "type": "object",
        "required": [
          "group",
          "name",
          "domain",
          "forAccounts",
          "forApplications"
        ],
        "properties": {
          "group": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "forAccounts": {
            "type": "boolean"
          },
          "forApplications": {
            "type": "boolean"
          }
        }
      },
      "UpdatePermissionRequest": {
        "type": "object",
        "required": [
          "forAccounts",
          "forApplications"
        ],
        "properties": {
          "forAccounts": {
            "type": "boolean"
          },
          "forApplications": {
            "type": "boolean"
          }
        }
      },
      "AccountEmailRequest": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "boolean"
          },
          "backup": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "PermissionsRequest": {
        "type": "object",
        "required": [
          "action",
          "permissions"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "GRANT",
              "REVOKE"
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Permission"
            }
          }
        }
      },
      "RolesRequest": {
        "type": "object",
        "required": [
          "action",
          "roles"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "GRANT",
              "REVOKE"
            ]
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "UserIdentifiersRequest": {
        "type": "object",
        "required": [
          "identifiers"
        ],
        "properties": {
          "oldIdentifier": {
            "type": "string"
          },
          "identifiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserIdentifier"
            }
          }
        }
      },
      "PasswordlessRequest": {
        "type": "object",
        "required": [
          "token"
        ],
        "properties": {
          "token": {
            "type": "string"
          }
        }
      },
      "OtpRequest": {
        "type": "object",
        "required": [
          "passwordId",
          "password"
        ],
        "properties": {
          "passwordId": {
            "type": "string"
          },
          "password": {
            "type": "string"
          }
        }
      },
      "PasswordResetTokenRequest": {
        "type": "object",
        "required": [
          "identifier",
          "domain"
        ],
        "properties": {
          "identifier": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          }
        }
      },
      "PasswordResetRequest": {
        "type": "object",
        "required": [
          "byToken",
          "plainPassword"
        ],
        "properties": {
          "byToken": {
            "type": "boolean"
          },
          "resetToken": {
            "description": "Required if 'byToken' is true",
            "type": "string"
          },
          "identifier": {
            "description": "Required if 'byToken' is false",
            "type": "string"
          },
          "domain": {
            "description": "Required if 'byToken' is false",
            "type": "string"
          },
          "oldPassword": {
            "description": "Required if 'byToken' is false",
            "type": "string"
          },
          "plainPassword": {
            "type": "string"
          }
        }
      },
      "PasswordResetToken": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "issuedAt": {
            "type": "integer",
            "description": "The time at which the token was issued (in epoch seconds)"
          },
          "expiresAt": {
            "type": "integer",
            "description": "The time after which the token will no longer be valid (in epoch seconds)"
          }
        }
      },
      "ActionToken": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "accountId": {
            "type": "string"
          },
          "validFor": {
            "type": "number",
            "description": "The life time of the token in seconds"
          }
        }
      },
      "ActionTokenRequest": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "OTP",
              "BASIC"
            ]
          },
          "otp": {
            "$ref": "#/components/schemas/OtpRequest"
          },
          "basic": {
            "$ref": "#/components/schemas/AuthRequest"
          },
          "action": {
            "type": "string"
          }
        }
      },
      "DurationRequest": {
        "type": "object",
        "properties": {
          "days": {
            "type": "number"
          },
          "hours": {
            "type": "number"
          },
          "minutes": {
            "type": "number"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}