{
  "openapi" : "3.1.0",
  "info" : {
    "title" : "OpenAPI definition",
    "version" : "v0.3.1-0"
  },
  "servers" : [ {
    "url" : "https://dev.digitale-patientenrechnung.de/api",
    "description" : "DiPag RU DEV"
  } ],
  "tags" : [ {
    "name" : "Institutionen",
    "description" : "Institutionen account API"
  }, {
    "name" : "Versicherte",
    "description" : "Versicherte account API"
  }, {
    "name" : "Berechtigungen",
    "description" : "Permission management API"
  } ],
  "paths" : {
    "/InsurantAccount" : {
      "get" : {
        "tags" : [ "Versicherte" ],
        "description" : "Get account information for a Versicherter.",
        "operationId" : "get",
        "parameters" : [ {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier' is required",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "200" : {
            "description" : "Successfully retrieved information",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/GetVersicherterResponse"
                }
              }
            }
          },
          "404" : {
            "description" : "Versicherter not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put" : {
        "tags" : [ "Versicherte" ],
        "description" : "Update settings for a Versicherter.",
        "operationId" : "update",
        "parameters" : [ {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier' is required",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/UpdateVersicherterRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "204" : {
            "description" : "Successfully updated settings"
          },
          "404" : {
            "description" : "Versicherter not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post" : {
        "tags" : [ "Versicherte" ],
        "description" : "Create a new account for a Versicherter.",
        "operationId" : "create",
        "parameters" : [ {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier', 'commonName' and 'birthdate' are required",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/CreateVersicherterRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "201" : {
            "description" : "Successfully created a new account for a Versicherter"
          },
          "409" : {
            "description" : "An account for this Versicherter already exists",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/permission/{id}/status" : {
      "post" : {
        "tags" : [ "Berechtigungen" ],
        "summary" : "Setze den Status einer Berechtigung",
        "description" : "Gewährt oder verweigert eine Berechtigung.",
        "operationId" : "updatePermissionStatus",
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "Permission ID",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "requestBody" : {
          "content" : {
            "text/plain" : {
              "schema" : {
                "type" : "string",
                "description" : "Neuer Status der gesetzt werden soll"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "403" : {
            "description" : "Forbidden",
            "content" : {
              "application/json" : { }
            }
          },
          "500" : {
            "description" : "Internal Server Error"
          },
          "400" : {
            "description" : "Bad Request",
            "content" : {
              "application/json" : { }
            }
          },
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/BerechtigungResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : { }
            }
          },
          "404" : {
            "description" : "Not Found",
            "content" : {
              "application/json" : { }
            }
          }
        }
      }
    },
    "/PractitionerAccount" : {
      "post" : {
        "tags" : [ "Institutionen" ],
        "description" : "Create a new account for a Rechnungsersteller",
        "operationId" : "createRechnungsersteller",
        "parameters" : [ {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier' and 'commonName' are required",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/CreateInstitutionRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "201" : {
            "description" : "Successfully created a new account for a Rechnungsersteller"
          },
          "409" : {
            "description" : "An account for this Institution already exists",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/InsuranceAccount" : {
      "post" : {
        "tags" : [ "Institutionen" ],
        "description" : "Create a new account for a Kostenträger",
        "operationId" : "createKostentraeger",
        "parameters" : [ {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier' and 'commonName' are required",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/CreateInstitutionRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "201" : {
            "description" : "Successfully created a new account for a Kostenträger"
          },
          "409" : {
            "description" : "An account for this Institution already exists",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/permission" : {
      "get" : {
        "tags" : [ "Berechtigungen" ],
        "summary" : "Hole alle Berechtigungen",
        "description" : "Liefert eine Liste aller Berechtigungen bei denen der Nutzer entweder Initiator, Bestätiger, Betroffener oder Berechtigter ist.",
        "operationId" : "getPermissions",
        "parameters" : [ {
          "name" : "role",
          "in" : "query",
          "description" : "Nur Berechtigungen anzeigen, bei denen der Nutzer folgende Rolle besitzt",
          "required" : false,
          "schema" : {
            "type" : "string",
            "enum" : [ "initiator", "bestaetiger", "betroffener", "berechtigter" ]
          }
        }, {
          "name" : "not-confirmed",
          "in" : "query",
          "description" : "Nur Berechtigungen anzeigen, die noch nicht bestätigt wurden",
          "required" : false,
          "schema" : {
            "type" : "boolean",
            "default" : false
          }
        } ],
        "responses" : {
          "403" : {
            "description" : "Forbidden",
            "content" : {
              "application/json" : { }
            }
          },
          "500" : {
            "description" : "Internal Server Error"
          },
          "400" : {
            "description" : "Bad Request",
            "content" : {
              "application/json" : { }
            }
          },
          "200" : {
            "description" : "OK",
            "content" : {
              "*/*" : {
                "schema" : {
                  "$ref" : "#/components/schemas/BerechtigungenResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : { }
            }
          }
        }
      }
    },
    "/PractitionerAccount/{telematikId}" : {
      "delete" : {
        "tags" : [ "Institutionen" ],
        "description" : "Delete a PractitionerAccount by telematikId",
        "operationId" : "deletePractitionerAccount",
        "parameters" : [ {
          "name" : "telematikId",
          "in" : "path",
          "description" : "TelematikID of the account to delete",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier' is required and must match telematikId",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "204" : {
            "description" : "Successfully deleted the account"
          },
          "404" : {
            "description" : "Account not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/InsurantAccount/{kvnr}" : {
      "delete" : {
        "tags" : [ "Versicherte" ],
        "description" : "Delete a Versicherter by KVNR",
        "operationId" : "delete",
        "parameters" : [ {
          "name" : "kvnr",
          "in" : "path",
          "description" : "KVNR of the versicherter to delete",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier' is required and must match KVNR",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "204" : {
            "description" : "Successfully deleted the account"
          },
          "404" : {
            "description" : "Versicherter not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/InsuranceAccount/{telematikId}" : {
      "delete" : {
        "tags" : [ "Institutionen" ],
        "description" : "Delete an InsuranceAccount by telematikId",
        "operationId" : "deleteInsuranceAccount",
        "parameters" : [ {
          "name" : "telematikId",
          "in" : "path",
          "description" : "TelematikID of the account to delete",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "ZETA-User-Info",
          "in" : "header",
          "description" : "Base64 encoded JSON ZETA-User info header. 'identifier' is required and must match telematikId",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "403" : {
            "description" : "Invalid scope or claims",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "204" : {
            "description" : "Successfully deleted the account"
          },
          "404" : {
            "description" : "Account not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "Benachrichtigungseinstellungen" : {
        "type" : "object",
        "properties" : {
          "neueRg" : {
            "type" : "string",
            "enum" : [ "PUSH", "E_MAIL", "PUSH_AND_E_MAIL", "OFF" ]
          },
          "papierkorb" : {
            "type" : "string",
            "enum" : [ "PUSH", "E_MAIL", "PUSH_AND_E_MAIL", "OFF" ]
          },
          "rechnungLoeschen" : {
            "type" : "string",
            "enum" : [ "PUSH", "E_MAIL", "PUSH_AND_E_MAIL", "OFF" ]
          },
          "kontoloeschung" : {
            "type" : "string",
            "enum" : [ "PUSH", "E_MAIL", "PUSH_AND_E_MAIL", "OFF" ]
          }
        },
        "required" : [ "kontoloeschung", "neueRg", "papierkorb", "rechnungLoeschen" ]
      },
      "UpdateVersicherterRequest" : {
        "type" : "object",
        "properties" : {
          "benachrichtigungseinstellungen" : {
            "$ref" : "#/components/schemas/Benachrichtigungseinstellungen"
          }
        },
        "required" : [ "benachrichtigungseinstellungen" ]
      },
      "ErrorResponse" : {
        "type" : "object",
        "properties" : {
          "error" : {
            "type" : "string",
            "enum" : [ "MISSING_OR_INVALID_HEADER", "UNSUPPORTED_MEDIATYPE", "UNSUPPORTED_ENCODING", "INVALID_HTTP_OPERATION", "INVALID_ENDPOINT", "SERVICE_INTERNAL_SERVER_ERROR", "OCSP_NOTREACHABLE", "OCSP_TIMEOUT", "MISSING_HEADER_CLIENTDATA", "MISSING_HEADER_USERINFO", "ERROR_HEADER_USERINFO", "ZETA_DPOP_VALIDATION_ERROR", "ZETA_INVALID_ACCESSTOKEN", "ZETA_EXPIRED_ACCESSTOKEN", "DIPAG_INVALID_PAYLOAD", "DIPAG_RESOURCE_ALREADY_EXISTS", "DIPAG_RESOURCE_NOT_FOUND", "DIPAG_VERSICHERTER_NOT_FOUND", "DIPAG_EINWILLIGUNG_REVOKED", "DIPAG_FOUND_MULTIPLE_VERSICHERTE", "DIPAG_VERSICHERTER_PLAUSIBILITY_CHECK_FAILED", "DIPAG_FORBIDDEN_RESOURCE", "DIPAG_WORKFLOW_STATUS_TRANSITION_INVALID", "DIPAG_WORKFLOW_STATUS_NOT_ON_RECHNUNG", "DIPAG_DELETE_NOT_ON_RECHNUNG", "DIPAG_DELETE_REQUIRES_PAPIERKORB_STATUS" ]
          },
          "error_description" : {
            "type" : "string"
          },
          "error_uri" : {
            "type" : "string",
            "format" : "uri"
          }
        }
      },
      "BerechtigungResponse" : {
        "type" : "object",
        "properties" : {
          "id" : {
            "type" : "string",
            "format" : "uuid"
          },
          "typ" : {
            "type" : "string",
            "enum" : [ "RV-Berechtigung" ]
          },
          "status" : {
            "type" : "string",
            "enum" : [ "granted", "revoked" ]
          },
          "initiator" : {
            "$ref" : "#/components/schemas/Nutzer"
          },
          "bestaetiger" : {
            "$ref" : "#/components/schemas/Nutzer"
          },
          "betroffener" : {
            "$ref" : "#/components/schemas/Nutzer"
          },
          "berechtigter" : {
            "$ref" : "#/components/schemas/Nutzer"
          }
        }
      },
      "Nutzer" : {
        "type" : "object",
        "properties" : {
          "id" : {
            "type" : "string"
          },
          "display" : {
            "type" : "string"
          }
        }
      },
      "CreateInstitutionRequest" : {
        "type" : "object",
        "properties" : {
          "zustimmungVerwendungTelematikID" : {
            "type" : "boolean"
          },
          "zustimmungVerwendungAnzeigename" : {
            "type" : "boolean"
          },
          "zustimmungNutzungsbedingungen" : {
            "type" : "boolean"
          }
        }
      },
      "CreateVersicherterRequest" : {
        "type" : "object",
        "properties" : {
          "zustimmungen" : {
            "$ref" : "#/components/schemas/CreateZustimmungenRequest"
          },
          "benachrichtigungseinstellungen" : {
            "$ref" : "#/components/schemas/Benachrichtigungseinstellungen"
          }
        },
        "required" : [ "benachrichtigungseinstellungen", "zustimmungen" ]
      },
      "CreateZustimmungenRequest" : {
        "type" : "object",
        "properties" : {
          "zustimmungVerwendungAnzeigename" : {
            "type" : "boolean"
          },
          "zustimmungVerwendungKvnr" : {
            "type" : "boolean"
          },
          "zustimmungVerwendungGeburtsdatum" : {
            "type" : "boolean"
          },
          "zustimmungNutzungsbedingungen" : {
            "type" : "boolean"
          },
          "zustimmungDigitaleRechnungsermittlung" : {
            "type" : "boolean"
          },
          "zustimmungDigitaleRechnungVerbindlich" : {
            "type" : "boolean"
          },
          "zustimmungKtrRechnungsversand" : {
            "type" : "boolean"
          }
        }
      },
      "BerechtigungenResponse" : {
        "type" : "object",
        "properties" : {
          "permissions" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/BerechtigungResponse"
            },
            "uniqueItems" : true
          }
        }
      },
      "GetVersicherterResponse" : {
        "type" : "object",
        "properties" : {
          "benachrichtigungseinstellungen" : {
            "$ref" : "#/components/schemas/Benachrichtigungseinstellungen"
          }
        },
        "required" : [ "benachrichtigungseinstellungen" ]
      }
    }
  }
}