{
  "openapi": "3.0.1",
  "info": {
    "title": "Proff Premium Credit API – Oppdatert kredittrating og betalingsanmerkninger",
    "description": "Integrer Proff Premium Credit API for å få tilgang til oppdatert informasjon om kredittrating og betalingsanmerkninger, og ta bedre beslutninger for din virksomhet.",
    "version": "v1"
  },
  "paths": {
    "/CompanyReport/{orgNo}": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Return a company report",
        "description": "Returns 404 if the company id is invalid. \nReturn 204 if the company does not exist.\nReturns a report in PDF format by default.\nSend an accept header with \"application/json\" to get a JSON object of the data used in the report.",
        "operationId": "getCompanyReport",
        "parameters": [
          {
            "name": "orgNo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": { }
              }
            }
          }
        }
      }
    },
    "/CompanyCreditReport/{orgNo}": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Return a company credit report",
        "description": "Returns 404 if the company id is invalid. \nReturn 204 if the company does not exist.\nReturns a report in PDF format by default.\nSend an accept header with \"application/json\" to get a JSON object of the data used in the report.",
        "operationId": "getCompanyCreditReport",
        "parameters": [
          {
            "name": "orgNo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": { }
              }
            }
          }
        }
      }
    },
    "/CreditRating/{orgNo}": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Return the current rating code and score",
        "description": "Returns 204 if there is no rating or the company does not exist.",
        "operationId": "getCreditRating",
        "parameters": [
          {
            "name": "orgNo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditRating"
                }
              }
            }
          }
        }
      }
    },
    "/CreditRatingChanges": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Returns a list of rating and score changes in the last 10 days by default.",
        "description": "Returns a list with the newest entry first. The list is limited to 5000 changes per request. If there are more changes, the response has a Link header with rel=\"next\" pointing to the next page. Keep following it until the header is absent to get all changes.",
        "operationId": "getCreditRatingChanges",
        "parameters": [
          {
            "name": "fromDate",
            "in": "query",
            "description": "Only return changes after this date. Date format is yyyy-MM-dd. Supports up to 10 days ago.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque paging token. Use the Link header from the previous response rather than building this yourself.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "Link": {
                "description": "Present when more changes exist: URL of the next page, with rel=\"next\".",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/CreditRatingHistory/{orgNo}": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Return a list of rating history for a company",
        "description": "Always returns a list with the newest entry first.A value of 2099-12-31 in the To field indicates that the rating is valid indefinitely (it may be replaced at any time).The list may be empty if company does not exist or has no rating history.",
        "operationId": "getCreditRatingHistory",
        "parameters": [
          {
            "name": "orgNo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CreditRatingHistoryEntry"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/PaymentRemarks/{orgNo}": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Indicates if the company has payment remarks or mortgages (voluntary or forced).",
        "description": "If you need further details about the remarks use the /PaymentRemarkDetails endpoint.",
        "operationId": "getPaymentRemarks",
        "parameters": [
          {
            "name": "orgNo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemarksResponse"
                }
              }
            }
          }
        }
      }
    },
    "/PaymentRemarkDetails/{orgNo}": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Returns a detailed list of payment remarks for a given company.",
        "description": "Always returns a list. May be empty if company does not exist or has no payment remarks. Note that requests to this endpoint is invoiced per transaction. Known payment remark type id's: IN,AO,RS,NR,IS,ER,BD,BH,TR,DO. Upstream providers may use other remark type id's so this list should not be considered finite.",
        "operationId": "getPaymentRemarksDetailed",
        "parameters": [
          {
            "name": "orgNo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentRemarks"
                }
              }
            }
          }
        }
      }
    },
    "/Webhooks": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "List the webhooks belonging to your customer",
        "description": "Returns id, name, url and settings for each webhook, together with the number of companies it monitors.",
        "operationId": "getWebhooks",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/Webhooks/{webhookId}/Companies": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "List the companies monitored by a webhook",
        "description": "Returns 404 if the webhook does not exist or belongs to another customer.",
        "operationId": "getWebhookMonitoredCompanies",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MonitoredCompany"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          }
        }
      },
      "put": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Replace the list of companies monitored by a webhook",
        "description": "The submitted list replaces the existing list. Send an empty list to stop monitoring all companies. Country codes are two letters (e.g. NO). Norwegian organization numbers are validated. Duplicates are ignored. Returns 404 if the webhook does not exist or belongs to another customer.",
        "operationId": "updateWebhookMonitoredCompanies",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMonitoredCompaniesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/Usage": {
      "get": {
        "tags": [
          "ppc-api"
        ],
        "summary": "Returns information about usage",
        "description": "Note that usage is updated periodically and may not include the most recent requests.",
        "operationId": "getUsage",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CompanyPaymentRemarks": {
        "type": "object",
        "properties": {
          "paymentRemarks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentRemark"
            }
          },
          "voluntaryMortgages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Mortgage"
            }
          },
          "compulsoryMortgages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Mortgage"
            }
          },
          "noAssetsAvailable": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NoAssetsAvailable"
            }
          }
        },
        "additionalProperties": false,
        "description": "Company remarks"
      },
      "CreditRating": {
        "type": "object",
        "properties": {
          "updated": {
            "type": "string",
            "format": "date"
          },
          "organisationNumber": {
            "type": "integer",
            "format": "int32"
          },
          "ratingScore": {
            "type": "integer",
            "description": "Represents the bankruptcy rating as a score between 0 - 100",
            "format": "int32"
          },
          "paymentRemarks": {
            "$ref": "#/components/schemas/RemarksResponse"
          },
          "economy": {
            "type": "integer",
            "description": "Range: 1-5",
            "format": "int32"
          },
          "leadOwnership": {
            "type": "integer",
            "description": "Range: 1-5",
            "format": "int32"
          },
          "paymentHistory": {
            "type": "integer",
            "description": "Range: 1-5",
            "format": "int32"
          },
          "otherGeneral": {
            "type": "integer",
            "description": "Range: 1-5",
            "format": "int32"
          },
          "creditLimit": {
            "type": "integer",
            "description": "In 1 000 NOK",
            "format": "int64"
          },
          "rating": {
            "type": "string",
            "description": "One of these values: C, B, A, A+, A++",
            "nullable": true
          },
          "probabilityOfBankruptcy": {
            "type": "number",
            "description": "Indicates probability of bankruptcy\r\nRange: 0-100",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "CreditRatingHistoryEntry": {
        "type": "object",
        "properties": {
          "rating": {
            "type": "string",
            "nullable": true
          },
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "score": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DocumentType": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MonitoredCompany": {
        "type": "object",
        "properties": {
          "countryCode": {
            "type": "string"
          },
          "companyId": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Mortgage": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "creditor": {
            "type": "string"
          },
          "registrationDate": {
            "type": "string",
            "format": "date"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "legalRepresentative": {
            "type": "string",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "NoAssetsAvailable": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "",
            "format": "date",
            "nullable": true
          },
          "prosecutor": {
            "type": "string",
            "description": "",
            "nullable": true
          },
          "legalRepresentative": {
            "type": "string",
            "description": "",
            "nullable": true
          },
          "enforcementAuthority": {
            "type": "string",
            "description": "",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Better known as Intet Til Utlegg (ITU)"
      },
      "PaymentRemark": {
        "type": "object",
        "properties": {
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "type": {
            "$ref": "#/components/schemas/Type"
          },
          "amount": {
            "type": "integer",
            "description": "The amount outstanding (in øre).",
            "format": "int64"
          },
          "creditor": {
            "type": "string",
            "description": "The creditor"
          },
          "registrationDate": {
            "type": "string",
            "description": "The registration date of the payment remark.",
            "format": "date"
          },
          "refNr": {
            "type": "string",
            "description": "The reference number of the payment remark."
          }
        },
        "additionalProperties": false
      },
      "RemarksResponse": {
        "type": "object",
        "properties": {
          "hasRemarks": {
            "type": "boolean"
          },
          "hasVoluntaryMortgages": {
            "type": "boolean"
          },
          "hasCompulsoryMortgages": {
            "type": "boolean"
          },
          "hasNoAssetsAvailable": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "Source": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A source identifier (e.g. KFOS)"
          },
          "name": {
            "type": "string",
            "description": "A descriptive name of the source (e.g. KREDINOR AS). May be empty.",
            "readOnly": true
          }
        },
        "additionalProperties": false,
        "description": "Payment remark source - a debt collector agency."
      },
      "Type": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A source identifier (e.g. KFOS)"
          },
          "name": {
            "type": "string",
            "description": "A descriptive name of record type (e.g. \"Inkasso\", \"Rettslig skritt\"). May be empty.",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "UpdateMonitoredCompaniesRequest": {
        "type": "object",
        "properties": {
          "companies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MonitoredCompany"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "patch": {
            "type": "boolean"
          },
          "maxMonitoredCompanies": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "monitoredCompanyCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Token": {
        "type": "apiKey",
        "description": "Specify a token. \nExample: \"Token yJhbGciOiJIUzI1iIsInR5cCI6IkpXVCJ9\"",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Token": [ ]
    }
  ]
}