{
  "swagger": "2.0",
  "info": {
    "version": "v1",
    "title": "Accounts API Lånekassen",
    "description": "Hent kontoinformasjon for kunder i Lånekassen"
  },
  "schemes": [
    "http"
  ],
  "paths": {
    "/v1/Accounts": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "Returns a Account List for Customer",
        "description": "The Consent-ID header should contain the consent for the actual customer.",
        "operationId": "Accounts_Get",
        "consumes": [],
        "produces": [
          "application/json",
          "text/json"
        ],
        "parameters": [
          {
            "name": "PSU_ID",
            "in": "header",
            "required": true,
            "type": "string",
            "description": "Social security number for the requested costumer"
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "type": "string",
            "description": "Authorization token from Maskinporten"
          },
          {
            "name": "Consent-ID",
            "in": "header",
            "required": true,
            "type": "string",
            "description": "Consent token from Altinn"
          },
          {
            "name": "X-Request-Id",
            "in": "header",
            "required": true,
            "type": "string",
            "description": "Unique id for the request, used for logging and tracing"
          },
          {
            "name": "ApiKey",
            "in": "header",
            "required": true,
            "type": "string",
            "description": "Api key, required to get access to the api"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a Json response containing the list of the Accounts for a Customer in Lånekassen",
            "schema": {
              "$ref": "#/definitions/CustomerPSU"
            }
          },
          "400": {
            "description": "One or more headers are invalid"
          },
          "401": {
            "description": "Authorization token is invalid"
          },
          "403": {
            "description": "Consent token is invalid"
          },
          "404": {
            "description": "Requested PSU_ID does not exist"
          },
          "429": {
            "description": "Too busy"
          },
          "500": {
            "description": "Unknown error. Contact support if the error persists"
          }
        }
      }
    }
  },
  "definitions": {
    "CustomerPSU": {
      "type": "object",
      "properties": {
        "Accounts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Account"
          }
        },
        "TotalAmount": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "Account": {
      "type": "object",
      "properties": {
        "Balances": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Balance"
          }
        },
        "Name": {
          "type": "string",
          "readOnly": true
        },
        "Bban": {
          "type": "string",
          "readOnly": true
        },
        "Assert": {
          "type": "object",
          "readOnly": true
        }
      }
    },
    "Balance": {
      "type": "object",
      "properties": {
        "BalanceType": {
          "type": "string",
          "readOnly": true
        },
        "BalanceAmount": {
          "$ref": "#/definitions/Currency"
        },
        "LastChangeDateTime": {
          "format": "date-time",
          "type": "string"
        }
      }
    },
    "Currency": {
      "type": "object",
      "properties": {
        "currency": {
          "type": "string"
        },
        "amount": {
          "format": "double",
          "type": "number"
        }
      }
    }
  }
}