{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "KS Fiks: Fiks IO Katalog service",
    "description" : "KS Fiks: FIKS IO Katalog Service",
    "contact" : {
      "name" : "Fiks brukerstøtte",
      "url" : "https://www.ks.no/fagomrader/digitalisering/utviklingsprosjekter/",
      "email" : "fiks@ks.no"
    },
    "version" : "v1"
  },
  "servers" : [ {
    "url" : "https://api.fiks.test.ks.no",
    "description" : "KS Fiks API host"
  } ],
  "security" : [ {
    "bearerAuth" : [ ]
  } ],
  "tags" : [ {
    "name" : "FiksIoKatalog",
    "description" : "API for å slå opp informasjon fra Fiks IO"
  } ],
  "paths" : {
    "/fiks-io/katalog/api/v1/kontoer/{kontoId}" : {
      "get" : {
        "tags" : [ "FiksIoKatalog" ],
        "description" : "Hent en spesifisert konto basert på konto-id",
        "operationId" : "getKonto",
        "parameters" : [ {
          "name" : "kontoId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Konto",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/KatalogKonto"
                }
              }
            }
          }
        }
      }
    },
    "/fiks-io/katalog/api/v1/kontoer/{kontoId}/status" : {
      "get" : {
        "tags" : [ "FiksIoKatalog" ],
        "description" : "Hent status for en spesifisert konto, basert på konto-id",
        "operationId" : "getKontoStatus",
        "parameters" : [ {
          "name" : "kontoId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Henter status for konto",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/KontoStatusApiModel"
                }
              }
            }
          }
        }
      }
    },
    "/fiks-io/katalog/api/v1/kontoer/{kontoId}/offentligNokkel" : {
      "get" : {
        "tags" : [ "FiksIoKatalog" ],
        "description" : "Hent offentlig nokkel for en konto",
        "operationId" : "getOffentligNokkel",
        "parameters" : [ {
          "name" : "kontoId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Offentlig nøkkel for konto",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OffentligNokkel"
                }
              }
            }
          },
          "404" : {
            "description" : "Offentlig nøkkel er ikke satt eller konto finnes ikke"
          }
        }
      }
    },
    "/fiks-io/katalog/api/v1/matchendeAdresser" : {
      "post" : {
        "tags" : [ "FiksIoKatalog" ],
        "description" : "Hent eksisterende adresser som samsvarer med spesifiserte parametere. Tjenesten kan benyttes for å verifisere at en adresse ikke overlapper med en annen",
        "operationId" : "matchendeAdresser",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AdresseMatchSpesifikasjon"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "viser like adresser",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/AdresseMatch"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/fiks-io/katalog/api/v1/sertifikat/verifiser" : {
      "post" : {
        "tags" : [ "FiksIoKatalog" ],
        "description" : "Verifiser at sertifikat/offentlig nøkkel er gyldig. Kan sende inn både P12/PFX- og PEM-format, den offentlige nøkkelen returneres alltid. Passord er bare nødvendig for P12/PFX",
        "operationId" : "verifiserSertifikat",
        "requestBody" : {
          "content" : {
            "multipart/form-data" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "file" : {
                    "$ref" : "#/components/schemas/file"
                  },
                  "format" : {
                    "type" : "string",
                    "description" : "Formatet på sertifikatet som skal bli lastet inn",
                    "enum" : [ "PEM", "P12" ]
                  },
                  "passord" : {
                    "type" : "string",
                    "description" : "Passord for å laste inn pfx/p12-fil"
                  }
                }
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "description" : "Status for offentlig nøkkel",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OffentligNokkelStatusApiModel"
                }
              }
            }
          }
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "KatalogKonto" : {
        "type" : "object",
        "properties" : {
          "fiksOrgId" : {
            "type" : "string",
            "format" : "uuid"
          },
          "fiksOrgNavn" : {
            "type" : "string"
          },
          "organisasjonsnummer" : {
            "type" : "string"
          },
          "kommunenummer" : {
            "type" : "string"
          },
          "kontoId" : {
            "type" : "string",
            "format" : "uuid"
          },
          "kontoNavn" : {
            "type" : "string"
          },
          "status" : {
            "$ref" : "#/components/schemas/KontoStatusApiModel"
          }
        }
      },
      "KontoStatusApiModel" : {
        "type" : "object",
        "properties" : {
          "gyldigAvsender" : {
            "type" : "boolean"
          },
          "gyldigMottaker" : {
            "type" : "boolean"
          },
          "antallKonsumenter" : {
            "type" : "integer",
            "format" : "int64"
          },
          "melding" : {
            "type" : "string"
          },
          "antallUavhentedeMeldinger" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "OffentligNokkel" : {
        "required" : [ "nokkel", "valid" ],
        "type" : "object",
        "properties" : {
          "nokkel" : {
            "type" : "string"
          },
          "validFrom" : {
            "type" : "string",
            "format" : "date-time"
          },
          "validTo" : {
            "type" : "string",
            "format" : "date-time"
          },
          "serial" : {
            "type" : "string"
          },
          "subjectDN" : {
            "type" : "string"
          },
          "issuerDN" : {
            "type" : "string"
          },
          "valid" : {
            "type" : "boolean"
          },
          "statusMessage" : {
            "type" : "string"
          }
        }
      },
      "AdresseMatch" : {
        "type" : "object",
        "properties" : {
          "fiksOrgId" : {
            "type" : "string",
            "format" : "uuid"
          },
          "kontoId" : {
            "type" : "string",
            "format" : "uuid"
          },
          "adresseId" : {
            "type" : "string",
            "format" : "uuid"
          },
          "identifikatorMatch" : {
            "uniqueItems" : true,
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          },
          "meldingTypeMatch" : {
            "uniqueItems" : true,
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          },
          "nivaMatch" : {
            "uniqueItems" : true,
            "type" : "array",
            "items" : {
              "type" : "integer",
              "format" : "int32"
            }
          }
        }
      },
      "AdresseMatchSpesifikasjon" : {
        "required" : [ "identifikator", "meldingType", "sikkerhetsnivaer" ],
        "type" : "object",
        "properties" : {
          "adresseId" : {
            "type" : "string",
            "format" : "uuid"
          },
          "identifikator" : {
            "minItems" : 1,
            "uniqueItems" : true,
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/Identifikator"
            }
          },
          "meldingType" : {
            "minItems" : 1,
            "uniqueItems" : true,
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          },
          "sikkerhetsnivaer" : {
            "minItems" : 1,
            "uniqueItems" : true,
            "type" : "array",
            "items" : {
              "type" : "integer",
              "format" : "int32"
            }
          }
        }
      },
      "Identifikator" : {
        "required" : [ "identifikator" ],
        "type" : "object",
        "properties" : {
          "identifikatorType" : {
            "type" : "string",
            "enum" : [ "ORG_NO", "NAVENHET_ID" ]
          },
          "identifikator" : {
            "minLength" : 1,
            "pattern" : "^\\d+$",
            "type" : "string"
          }
        }
      },
      "OffentligNokkelStatusApiModel" : {
        "type" : "object",
        "properties" : {
          "gyldig" : {
            "type" : "boolean"
          },
          "melding" : {
            "type" : "string"
          },
          "offentligNokkel" : {
            "type" : "string"
          }
        }
      },
      "file" : {
        "type" : "object",
        "format" : "binary"
      }
    },
    "securitySchemes" : {
      "bearerAuth" : {
        "type" : "http",
        "scheme" : "bearer",
        "bearerFormat" : "JWT"
      }
    }
  }
}