{
  "components": {
    "headers": {
      "RateLimit-Limit": {
        "description": "The limit of the window closest to being used up.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in that window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until that window starts over.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before the next request.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "Account": {
        "properties": {
          "id": {
            "description": "An id of the account the key belongs to. It is the same for every key of the account and never changes, so a tool can tell that a new key belongs to the same account.",
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object"
      },
      "Amount": {
        "description": "An amount in Danish kroner, without and with VAT. Negative when it is owed to you.",
        "properties": {
          "exVat": {
            "description": "Without VAT, in kroner.",
            "type": "number"
          },
          "incVat": {
            "description": "With VAT, in kroner.",
            "type": "number"
          }
        },
        "required": [
          "exVat",
          "incVat"
        ],
        "type": "object"
      },
      "Consumption": {
        "properties": {
          "from": {
            "description": "The first day (YYYY-MM-DD) or month (YYYY-MM) asked for.",
            "type": "string"
          },
          "locationId": {
            "description": "The location the answer is for.",
            "type": "string"
          },
          "resolution": {
            "description": "How long each value covers, as asked, as an ISO 8601 duration: a quarter hour, an hour, a day or a month. With PT15M, an hour the meter measured as an hour is one value: start and end say how long.",
            "enum": [
              "PT15M",
              "PT1H",
              "P1D",
              "P1M"
            ],
            "type": "string"
          },
          "to": {
            "description": "The last day or month asked for, included.",
            "type": "string"
          },
          "totalKwh": {
            "description": "The sum of the values.",
            "type": "number"
          },
          "unit": {
            "const": "kWh",
            "description": "Every value is in kWh.",
            "type": "string"
          },
          "values": {
            "description": "Only periods with readings, in time order. A period without readings is left out, so a missing period is a gap, not zero.",
            "items": {
              "$ref": "#/components/schemas/ConsumptionValue"
            },
            "type": "array"
          }
        },
        "required": [
          "locationId",
          "resolution",
          "from",
          "to",
          "unit",
          "totalKwh",
          "values"
        ],
        "type": "object"
      },
      "ConsumptionValue": {
        "properties": {
          "end": {
            "description": "The period ends, not included. ISO 8601 with the Danish offset, e.g. 2026-11-17T00:00:00+01:00.",
            "type": "string"
          },
          "kwh": {
            "description": "kWh used in the period.",
            "type": "number"
          },
          "start": {
            "description": "The period starts. ISO 8601 with the Danish offset, e.g. 2026-11-17T00:00:00+01:00.",
            "type": "string"
          }
        },
        "required": [
          "start",
          "end",
          "kwh"
        ],
        "type": "object"
      },
      "CostComponent": {
        "properties": {
          "description": {
            "description": "The text of the line on the invoice. The invoice can split a line that is one here, such as the electricity tax into Elafgift and Reduceret elafgift.",
            "type": "string"
          },
          "exVat": {
            "description": "The line that day, without VAT, in kroner to four decimals. A discount is negative.",
            "type": "number"
          },
          "incVat": {
            "description": "The same with VAT, to four decimals.",
            "type": "number"
          },
          "type": {
            "description": "spot: the electricity at the market price. tariff: what the local and the national grid charge per kWh, and their discounts. tax: duties to the state. supplier: our own charges per kWh. subscription: the day's share of a monthly subscription: the local grid's, the national grid's or the plan's.",
            "enum": [
              "spot",
              "tariff",
              "tax",
              "supplier",
              "subscription"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "description",
          "exVat",
          "incVat"
        ],
        "type": "object"
      },
      "Error": {
        "description": "Every error has this shape.",
        "properties": {
          "code": {
            "description": "What went wrong, for a program to act on: unauthorized, scope_required, api_access_not_included, not_found, invalid_request, rate_limited, temporarily_unavailable or internal_error. More codes may come.",
            "type": "string"
          },
          "locationId": {
            "description": "The location without API access (api_access_not_included).",
            "type": "string"
          },
          "message": {
            "description": "What went wrong, for a person. The wording can change; act on code.",
            "type": "string"
          },
          "requestId": {
            "description": "Quote this when you contact us.",
            "type": "string"
          },
          "retryAfter": {
            "description": "Seconds to wait (rate_limited, temporarily_unavailable).",
            "type": "number"
          },
          "scope": {
            "description": "The scope the key lacks (scope_required).",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message",
          "requestId"
        ],
        "type": "object"
      },
      "Invoice": {
        "properties": {
          "currency": {
            "const": "DKK",
            "description": "Always DKK.",
            "type": "string"
          },
          "dueDate": {
            "anyOf": [
              {
                "description": "The last day to pay. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last day to pay. Null when it is not known."
          },
          "invoiceDate": {
            "anyOf": [
              {
                "description": "The date on the invoice. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The date on the invoice. Null when it is not known."
          },
          "invoiceNo": {
            "description": "The number on the invoice. Use it with Get invoice.",
            "type": "string"
          },
          "lines": {
            "description": "The lines, as on the invoice.",
            "items": {
              "$ref": "#/components/schemas/InvoiceLine"
            },
            "type": "array"
          },
          "outstanding": {
            "description": "What is left to pay, in kroner incl. VAT.",
            "type": "number"
          },
          "paid": {
            "description": "True when nothing is outstanding.",
            "type": "boolean"
          },
          "total": {
            "$ref": "#/components/schemas/Amount"
          },
          "type": {
            "description": "invoice, or a credit note that reverses one.",
            "enum": [
              "invoice",
              "credit_note",
              "other"
            ],
            "type": "string"
          }
        },
        "required": [
          "invoiceNo",
          "type",
          "paid",
          "invoiceDate",
          "dueDate",
          "currency",
          "total",
          "outstanding",
          "lines"
        ],
        "type": "object"
      },
      "InvoiceLine": {
        "properties": {
          "description": {
            "description": "As on the invoice.",
            "type": "string"
          },
          "exVat": {
            "description": "The line without VAT, in kroner.",
            "type": "number"
          },
          "incVat": {
            "description": "The line with VAT, in kroner: exVat plus vat.",
            "type": "number"
          },
          "periodEnd": {
            "anyOf": [
              {
                "description": "The last day the line covers, included. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last day of the period, included. Null for a line without a period."
          },
          "periodStart": {
            "anyOf": [
              {
                "description": "The first day the line covers. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The first day the line covers. Null for a line without a period."
          },
          "quantity": {
            "description": "How much, in unit.",
            "type": "number"
          },
          "unit": {
            "description": "What quantity counts.",
            "enum": [
              "kWh",
              "day",
              "month",
              "item",
              "other"
            ],
            "type": "string"
          },
          "vat": {
            "description": "The VAT on the line, in kroner.",
            "type": "number"
          }
        },
        "required": [
          "description",
          "periodStart",
          "periodEnd",
          "quantity",
          "unit",
          "exVat",
          "vat",
          "incVat"
        ],
        "type": "object"
      },
      "InvoiceList": {
        "properties": {
          "hasMore": {
            "description": "True when there is a next page.",
            "type": "boolean"
          },
          "invoices": {
            "description": "One page, newest first.",
            "items": {
              "$ref": "#/components/schemas/InvoiceSummary"
            },
            "type": "array"
          },
          "page": {
            "description": "This page, from 1.",
            "type": "number"
          },
          "perPage": {
            "description": "Invoices per page.",
            "type": "number"
          }
        },
        "required": [
          "invoices",
          "page",
          "perPage",
          "hasMore"
        ],
        "type": "object"
      },
      "InvoiceSummary": {
        "properties": {
          "currency": {
            "const": "DKK",
            "description": "Always DKK.",
            "type": "string"
          },
          "dueDate": {
            "anyOf": [
              {
                "description": "The last day to pay. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last day to pay. Null when it is not known."
          },
          "invoiceDate": {
            "anyOf": [
              {
                "description": "The date on the invoice. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The date on the invoice. Null when it is not known."
          },
          "invoiceNo": {
            "description": "The number on the invoice. Use it with Get invoice.",
            "type": "string"
          },
          "outstanding": {
            "description": "What is left to pay, in kroner incl. VAT.",
            "type": "number"
          },
          "paid": {
            "description": "True when nothing is outstanding.",
            "type": "boolean"
          },
          "total": {
            "$ref": "#/components/schemas/Amount"
          },
          "type": {
            "description": "invoice, or a credit note that reverses one.",
            "enum": [
              "invoice",
              "credit_note",
              "other"
            ],
            "type": "string"
          }
        },
        "required": [
          "invoiceNo",
          "type",
          "paid",
          "invoiceDate",
          "dueDate",
          "currency",
          "total",
          "outstanding"
        ],
        "type": "object"
      },
      "Key": {
        "properties": {
          "expiresAt": {
            "description": "When the key stops working. ISO 8601 with the Danish offset, e.g. 2026-11-17T00:00:00+01:00.",
            "type": "string"
          },
          "name": {
            "description": "The name the customer gave the key.",
            "type": "string"
          },
          "prefix": {
            "description": "The first characters of the key.",
            "type": "string"
          },
          "scopes": {
            "description": "What the key may read: prices:read (electricity prices), consumption:read (consumption and standby), costs:read (rated cost and invoices) and labels:read (the names you gave your locations).",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "prefix",
          "scopes",
          "expiresAt"
        ],
        "type": "object"
      },
      "KeyDetails": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/Account"
          },
          "key": {
            "$ref": "#/components/schemas/Key"
          }
        },
        "required": [
          "key",
          "account"
        ],
        "type": "object"
      },
      "Location": {
        "properties": {
          "apiAccess": {
            "description": "Whether the API answers for this location. closed: its routes answer 403.",
            "enum": [
              "open",
              "closed"
            ],
            "type": "string"
          },
          "consumptionThrough": {
            "anyOf": [
              {
                "description": "When the latest reading ends. ISO 8601 with the Danish offset, e.g. 2026-11-17T00:00:00+01:00.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the latest meter reading at the location ends, in your own supply. Readings come from the grid company a few times a day, usually 14 to 43 hours after the hour: when this moves, consumption has something new. A reading for an earlier hour, up to a few days back, can still arrive without moving it. Null before the first reading, without apiAccess, or for a key without consumption:read."
          },
          "id": {
            "description": "The location, for the routes that take one.",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The name you gave the location in the app, e.g. \"Hjem\": the text as typed, which can be a street name. Null when the key does not have the scope labels:read, or when the location has no name. A key created before labels:read existed does not have it: revoke it on My page and create a new one."
          },
          "meterResolution": {
            "anyOf": [
              {
                "const": "PT15M",
                "type": "string"
              },
              {
                "const": "PT1H",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the meter measures, from its latest reading: PT15M (quarter hours) or PT1H (hours). Grid companies are moving meters to quarter hours. Null before the first reading, without apiAccess, or for a key without consumption:read."
          },
          "plan": {
            "anyOf": [
              {
                "const": "osmund_aaben",
                "type": "string"
              },
              {
                "const": "osmund_rolig",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The plan billed today. Null when it is not known right now."
          },
          "plus": {
            "$ref": "#/components/schemas/LocationPlus"
          },
          "priceArea": {
            "anyOf": [
              {
                "const": "DK1",
                "type": "string"
              },
              {
                "const": "DK2",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The electricity price area: DK1 (west of the Great Belt) or DK2 (east). Null when it is not known."
          },
          "ratedThrough": {
            "anyOf": [
              {
                "description": "The latest rated day. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The latest day before today, in your own supply, that costs/rated lists as rated. When it moves, costs/rated has something new. A day before it can still be missing (see missingDays in costs/rated) or be rated again without moving it. Null when nothing is rated yet, without apiAccess, or for a key without costs:read."
          },
          "state": {
            "description": "The electricity supply here. active: supplied now. upcoming: confirmed, starts later. pending: ordered, not confirmed yet. ended: no longer supplied.",
            "enum": [
              "active",
              "upcoming",
              "pending",
              "ended"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "priceArea",
          "state",
          "plan",
          "apiAccess",
          "plus",
          "consumptionThrough",
          "meterResolution",
          "ratedThrough"
        ],
        "type": "object"
      },
      "LocationList": {
        "properties": {
          "locations": {
            "description": "Every location you see in the app, newest first.",
            "items": {
              "$ref": "#/components/schemas/Location"
            },
            "type": "array"
          }
        },
        "required": [
          "locations"
        ],
        "type": "object"
      },
      "LocationPlus": {
        "description": "Osmund Plus at the location: its status and dates, as the app shows them.",
        "properties": {
          "endsOn": {
            "anyOf": [
              {
                "description": "The first day without Plus. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The first day without Plus, after it was opted out of on My page: from that day the API answers 403 here. Null when no opt-out is running, and while an opted-out trial has no dates yet (it then ends with the trial)."
          },
          "status": {
            "description": "Osmund Plus here. included: part of the plan (Rolig). trial: the free trial. active: Plus outside a trial, also after the trial has ended. none: no Plus. unknown: it cannot be read right now. During the beta the API answers for a location with Plus, so apiAccess follows it: closed with none, open with the others.",
            "enum": [
              "included",
              "trial",
              "active",
              "none",
              "unknown"
            ],
            "type": "string"
          },
          "trialEndsOn": {
            "anyOf": [
              {
                "description": "The first day Plus is no longer free. A Danish calendar date, YYYY-MM-DD.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The first day Plus is no longer free: the trial covers the days before it, and Plus goes on after it until it is opted out of. Null when status is not trial, or while the trial has no dates yet (they come when the supply starts)."
          }
        },
        "required": [
          "status",
          "trialEndsOn",
          "endsOn"
        ],
        "type": "object"
      },
      "PriceComponent": {
        "properties": {
          "description": {
            "description": "As on the invoice.",
            "type": "string"
          },
          "perKwh": {
            "description": "kr/kWh excl. VAT.",
            "type": "number"
          },
          "type": {
            "description": "spot: the market price. tariff: what the grid charges. tax: duties to the state. supplier: our own charges.",
            "enum": [
              "spot",
              "tariff",
              "tax",
              "supplier"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "description",
          "perKwh"
        ],
        "type": "object"
      },
      "PriceDay": {
        "properties": {
          "complete": {
            "description": "True when every interval is priced with everything it costs. See reason when false.",
            "type": "boolean"
          },
          "currency": {
            "const": "DKK",
            "description": "Always DKK.",
            "type": "string"
          },
          "date": {
            "description": "The day priced. A Danish calendar date, YYYY-MM-DD.",
            "type": "string"
          },
          "intervals": {
            "description": "One per hour of the Danish day (23, 24 or 25), or one per quarter hour (92, 96 or 100).",
            "items": {
              "$ref": "#/components/schemas/PriceInterval"
            },
            "type": "array"
          },
          "locationId": {
            "description": "The location the answer is for.",
            "type": "string"
          },
          "priceArea": {
            "anyOf": [
              {
                "const": "DK1",
                "type": "string"
              },
              {
                "const": "DK2",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The electricity price area: DK1 (west of the Great Belt) or DK2 (east). Null when it is not known."
          },
          "reason": {
            "anyOf": [
              {
                "const": "not_ready",
                "type": "string"
              },
              {
                "const": "plan_unknown",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why complete is false. not_ready: the day cannot be priced yet, and intervals is empty. plan_unknown: the prices may lack a small surcharge that depends on the plan."
          },
          "resolution": {
            "description": "How long each interval is, as an ISO 8601 duration: a quarter hour or an hour.",
            "enum": [
              "PT15M",
              "PT1H"
            ],
            "type": "string"
          },
          "unit": {
            "const": "kr/kWh",
            "description": "Every price is kroner per kWh.",
            "type": "string"
          }
        },
        "required": [
          "locationId",
          "date",
          "resolution",
          "priceArea",
          "currency",
          "unit",
          "complete",
          "reason",
          "intervals"
        ],
        "type": "object"
      },
      "PriceInterval": {
        "properties": {
          "components": {
            "description": "What the total is made of, spot first.",
            "items": {
              "$ref": "#/components/schemas/PriceComponent"
            },
            "type": "array"
          },
          "end": {
            "description": "The interval ends, not included. ISO 8601 with the Danish offset, e.g. 2026-11-17T00:00:00+01:00.",
            "type": "string"
          },
          "spot": {
            "description": "The spot price, kr/kWh excl. VAT. Also the first of the components.",
            "type": "number"
          },
          "start": {
            "description": "The interval starts. ISO 8601 with the Danish offset, e.g. 2026-11-17T00:00:00+01:00.",
            "type": "string"
          },
          "totalExVat": {
            "description": "Everything a kWh costs in this interval, kr/kWh excl. VAT.",
            "type": "number"
          },
          "totalIncVat": {
            "description": "Everything a kWh costs in this interval, kr/kWh incl. VAT.",
            "type": "number"
          }
        },
        "required": [
          "start",
          "end",
          "spot",
          "totalExVat",
          "totalIncVat",
          "components"
        ],
        "type": "object"
      },
      "RatedCost": {
        "description": "What the consumption cost, day by day, in your own supply. total is the charges per kWh over the rated days, such as the electricity, the tariffs and the electricity tax, priced the way the invoice prices them. subscriptions is the share of the subscriptions over the same days: the local grid's and the national grid's, and the plan's price, each month price spread over the days of its month. totalWithSubscriptions is the two together: what the Osmund app shows, and what the invoice adds up as \"I alt for forbrug\" for the same days. Fees, such as the payment fee, are on the invoice only.",
        "properties": {
          "complete": {
            "description": "Every supplied day up to yesterday is rated.",
            "type": "boolean"
          },
          "currency": {
            "const": "DKK",
            "description": "Always DKK.",
            "type": "string"
          },
          "days": {
            "description": "The rated days, in date order.",
            "items": {
              "$ref": "#/components/schemas/RatedCostDay"
            },
            "type": "array"
          },
          "daysInMonth": {
            "description": "Days in the month: 28 to 31.",
            "type": "number"
          },
          "daysWithData": {
            "description": "Days in days.",
            "type": "number"
          },
          "locationId": {
            "description": "The location the answer is for.",
            "type": "string"
          },
          "missingDays": {
            "description": "Supplied days up to yesterday that are not rated yet.",
            "items": {
              "description": "A day not rated yet. A Danish calendar date, YYYY-MM-DD.",
              "type": "string"
            },
            "type": "array"
          },
          "month": {
            "description": "The month. YYYY-MM.",
            "type": "string"
          },
          "subscriptions": {
            "$ref": "#/components/schemas/Amount"
          },
          "subscriptionsComplete": {
            "description": "False when part of the subscriptions could not be priced, usually because the plan is not known yet. That part is then left out of subscriptions and totalWithSubscriptions.",
            "type": "boolean"
          },
          "total": {
            "$ref": "#/components/schemas/Amount"
          },
          "totalKwh": {
            "description": "kWh over the rated days.",
            "type": "number"
          },
          "totalWithSubscriptions": {
            "$ref": "#/components/schemas/Amount"
          }
        },
        "required": [
          "locationId",
          "month",
          "currency",
          "complete",
          "missingDays",
          "daysInMonth",
          "daysWithData",
          "totalKwh",
          "total",
          "subscriptions",
          "totalWithSubscriptions",
          "subscriptionsComplete",
          "days"
        ],
        "type": "object"
      },
      "RatedCostDay": {
        "description": "One rated day. exVat and incVat are the charges per kWh; subscriptions is the day's share of the subscriptions; totalWithSubscriptions is the two together, the day as the Osmund app shows it.",
        "properties": {
          "components": {
            "description": "The day's lines as on the invoice: the charges per kWh, spot first, then the subscriptions. Each is to four decimals, as the invoice rounds a line once per period, not per day: summed over an invoice's period and rounded to the øre, a line comes within an øre of the invoice's. That holds only where the rated cost for those days is what was invoiced; a day the billing system rated differently from the invoice shows here as it is rated. The subscription lines are worked out from the plan, so a month billed on another plan than the one the plan shows differs from the invoice.",
            "items": {
              "$ref": "#/components/schemas/CostComponent"
            },
            "type": "array"
          },
          "date": {
            "description": "The day. A Danish calendar date, YYYY-MM-DD.",
            "type": "string"
          },
          "exVat": {
            "description": "What the charges per kWh cost that day, without VAT, in kroner.",
            "type": "number"
          },
          "incVat": {
            "description": "The same with VAT.",
            "type": "number"
          },
          "kwh": {
            "description": "kWh used that day.",
            "type": "number"
          },
          "subscriptions": {
            "$ref": "#/components/schemas/Amount"
          },
          "totalWithSubscriptions": {
            "$ref": "#/components/schemas/Amount"
          }
        },
        "required": [
          "date",
          "kwh",
          "exVat",
          "incVat",
          "subscriptions",
          "totalWithSubscriptions",
          "components"
        ],
        "type": "object"
      },
      "Standby": {
        "properties": {
          "locationId": {
            "description": "The location the answer is for.",
            "type": "string"
          },
          "months": {
            "description": "Completed months with enough readings.",
            "items": {
              "$ref": "#/components/schemas/StandbyMonth"
            },
            "type": "array"
          },
          "unit": {
            "const": "kW",
            "description": "Standby is power, in kW.",
            "type": "string"
          }
        },
        "required": [
          "locationId",
          "unit",
          "months"
        ],
        "type": "object"
      },
      "StandbyMonth": {
        "properties": {
          "month": {
            "description": "The month. YYYY-MM.",
            "type": "string"
          },
          "standbyKw": {
            "description": "What the location draws when nothing is switched on: the 10th percentile of the month’s hourly consumption, in kW.",
            "type": "number"
          }
        },
        "required": [
          "month",
          "standbyKw"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiKey": {
        "description": "A personal key from My page, osm_…",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Read your own Osmund data from software you run yourself: prices, consumption, standby, rated cost and invoices. The API only reads, and it answers in JSON.\n\nThis document, to open or hand to a code generator or an AI assistant: [JSON](/docs/osmund-api/openapi.json) or [YAML](/docs/osmund-api/openapi.yaml).\n\n### Quickstart\n\nFrom no key to today's electricity prices. Pick your language in any code box, and every example on the page follows.\n\n> [!NOTE]\n> You need a location with Osmund Plus. During the beta, Plus is what gives a location API access.\n\n#### With an AI assistant\n\nGive your coding assistant this prompt. It reads the API from its own document, and your key stays in the environment, out of the chat:\n\n```text\nUse the Osmund API. Its OpenAPI document is at\nhttps://osmundenergi.dk/docs/osmund-api/openapi.yaml\n\nMy API key is in the environment variable OSMUND_API_KEY.\nNever print the key or write it into the code.\n\nWrite a Python script that shows today's electricity price\nfor each hour at my location, cheapest hour first.\n```\n\n#### By hand\n\n1. **Create a key.** On [My page](https://osmundenergi.dk/min-side#api), under **API access**, choose **Create key** and copy the key. It starts with `osm_` and is shown only once. Keep it in the environment variable `OSMUND_API_KEY`, never in your code: export it in your terminal, or put it in a `.env` file, which Bun reads by itself, Node with `--env-file=.env` and Python with the `python-dotenv` package:\n\n   ```sh\n   export OSMUND_API_KEY=\"osm_…\"\n   ```\n   ```env\n   OSMUND_API_KEY=osm_…\n   ```\n\n2. **Set up your language.** curl and JavaScript need nothing more. Python needs two packages, and TypeScript the types, made from this document:\n\n   ```curl\n   curl --version\n   ```\n   ```pip\n   pip install requests python-dotenv\n   ```\n   ```node\n   node --version   # 20.6 or later, or use Bun\n   ```\n   ```npx\n   npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\n   ```\n\n3. **Make your first request.** Today's price for every hour at your location, cheapest first:\n\n   ```curl\n   curl https://api.osmundenergi.dk/api/v1/locations \\\n     -H \"Authorization: Bearer $OSMUND_API_KEY\"\n\n   # The id of a location where apiAccess is open:\n   export LOCATION_ID=\"0192f3a1-7c2e-7b1a-9d3e-2f6a8c1e4b10\"\n\n   curl https://api.osmundenergi.dk/api/v1/locations/$LOCATION_ID/prices \\\n     -H \"Authorization: Bearer $OSMUND_API_KEY\"\n   ```\n   ```python\n   # prices.py, run it with: python prices.py\n   import os\n   import requests\n   from dotenv import load_dotenv\n\n   load_dotenv()  # reads a .env file, if there is one; a key exported in the terminal stays as it is\n   API = \"https://api.osmundenergi.dk/api/v1\"\n   headers = {\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"}\n\n   def get(path):\n       response = requests.get(f\"{API}{path}\", headers=headers)\n       if not response.ok:\n           raise SystemExit(f\"{response.status_code} {response.json()['code']}\")\n       return response.json()\n\n   location = next((l for l in get(\"/locations\")[\"locations\"] if l[\"apiAccess\"] == \"open\"), None)\n   if location is None:\n       raise SystemExit(\"No location with API access\")\n\n   prices = get(f\"/locations/{location['id']}/prices\")\n   for hour in sorted(prices[\"intervals\"], key=lambda i: i[\"totalIncVat\"]):\n       print(hour[\"start\"], f\"{hour['totalIncVat']:.2f} kr/kWh\")\n   ```\n   ```js\n   // prices.mjs, run it with: node prices.mjs (or bun prices.mjs)\n   // With the key in a .env file: node --env-file=.env prices.mjs (Bun reads .env by itself)\n   const API = 'https://api.osmundenergi.dk/api/v1';\n   const headers = { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` };\n\n   async function get(path) {\n     const response = await fetch(`${API}${path}`, { headers });\n     if (!response.ok) throw new Error(`${response.status} ${(await response.json()).code}`);\n     return response.json();\n   }\n\n   const location = (await get('/locations')).locations.find(l => l.apiAccess === 'open');\n   if (!location) throw new Error('No location with API access');\n\n   const prices = await get(`/locations/${location.id}/prices`);\n   for (const hour of prices.intervals.toSorted((a, b) => a.totalIncVat - b.totalIncVat)) {\n     console.log(hour.start, `${hour.totalIncVat.toFixed(2)} kr/kWh`);\n   }\n   ```\n   ```ts\n   // prices.mts, run it with: bun prices.mts (or npx tsx prices.mts)\n   // With the key in a .env file: npx tsx --env-file=.env prices.mts (Bun reads .env by itself)\n   import type { components } from './osmund';\n\n   type LocationList = components['schemas']['LocationList'];\n   type PriceDay = components['schemas']['PriceDay'];\n\n   const API = 'https://api.osmundenergi.dk/api/v1';\n   const headers = { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` };\n\n   async function get<T>(path: string): Promise<T> {\n     const response = await fetch(`${API}${path}`, { headers });\n     if (!response.ok) throw new Error(`${response.status} ${(await response.json()).code}`);\n     return response.json() as Promise<T>;\n   }\n\n   const { locations } = await get<LocationList>('/locations');\n   const location = locations.find(l => l.apiAccess === 'open');\n   if (!location) throw new Error('No location with API access');\n\n   const prices = await get<PriceDay>(`/locations/${location.id}/prices`);\n   for (const hour of prices.intervals.toSorted((a, b) => a.totalIncVat - b.totalIncVat)) {\n     console.log(hour.start, `${hour.totalIncVat.toFixed(2)} kr/kWh`);\n   }\n   ```\n\n> [!IMPORTANT]\n> Keep the key secret, like a password. Whoever has it can read your data until it expires or you revoke it.",
    "title": "Osmund API",
    "version": "1.1.0-beta",
    "x-scalar-sdk-installation": [
      {
        "description": "```sh\nexport OSMUND_API_KEY=\"osm_…\"\n\ncurl https://api.osmundenergi.dk/api/v1/locations \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\"\n```\n\nThen, with the `id` of a location where `apiAccess` is `open`:\n\n```sh\nexport LOCATION_ID=\"0192f3a1-7c2e-7b1a-9d3e-2f6a8c1e4b10\"\n\ncurl https://api.osmundenergi.dk/api/v1/locations/$LOCATION_ID/prices \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\"\n```",
        "lang": "curl"
      },
      {
        "description": "```sh\npip install requests python-dotenv\n```\n\n```python\n# prices.py, run it with: python prices.py\nimport os\nimport requests\nfrom dotenv import load_dotenv\n\nload_dotenv()  # reads a .env file, if there is one; a key exported in the terminal stays as it is\nAPI = \"https://api.osmundenergi.dk/api/v1\"\nheaders = {\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"}\n\ndef get(path):\n    response = requests.get(f\"{API}{path}\", headers=headers)\n    if not response.ok:\n        raise SystemExit(f\"{response.status_code} {response.json()['code']}\")\n    return response.json()\n\nlocation = next((l for l in get(\"/locations\")[\"locations\"] if l[\"apiAccess\"] == \"open\"), None)\nif location is None:\n    raise SystemExit(\"No location with API access\")\n\nprices = get(f\"/locations/{location['id']}/prices\")\nfor hour in sorted(prices[\"intervals\"], key=lambda i: i[\"totalIncVat\"]):\n    print(hour[\"start\"], f\"{hour['totalIncVat']:.2f} kr/kWh\")\n```",
        "lang": "Python"
      },
      {
        "description": "Node 20.6 or later, or Bun:\n\n```js\n// prices.mjs, run it with: node prices.mjs (or bun prices.mjs)\n// With the key in a .env file: node --env-file=.env prices.mjs (Bun reads .env by itself)\nconst API = 'https://api.osmundenergi.dk/api/v1';\nconst headers = { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` };\n\nasync function get(path) {\n  const response = await fetch(`${API}${path}`, { headers });\n  if (!response.ok) throw new Error(`${response.status} ${(await response.json()).code}`);\n  return response.json();\n}\n\nconst location = (await get('/locations')).locations.find(l => l.apiAccess === 'open');\nif (!location) throw new Error('No location with API access');\n\nconst prices = await get(`/locations/${location.id}/prices`);\nfor (const hour of prices.intervals.toSorted((a, b) => a.totalIncVat - b.totalIncVat)) {\n  console.log(hour.start, `${hour.totalIncVat.toFixed(2)} kr/kWh`);\n}\n```",
        "lang": "JavaScript"
      },
      {
        "description": "Types from the API's own document, made once:\n\n```sh\nnpx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\n```\n\n```ts\n// prices.mts, run it with: bun prices.mts (or npx tsx prices.mts)\n// With the key in a .env file: npx tsx --env-file=.env prices.mts (Bun reads .env by itself)\nimport type { components } from './osmund';\n\ntype LocationList = components['schemas']['LocationList'];\ntype PriceDay = components['schemas']['PriceDay'];\n\nconst API = 'https://api.osmundenergi.dk/api/v1';\nconst headers = { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` };\n\nasync function get<T>(path: string): Promise<T> {\n  const response = await fetch(`${API}${path}`, { headers });\n  if (!response.ok) throw new Error(`${response.status} ${(await response.json()).code}`);\n  return response.json() as Promise<T>;\n}\n\nconst { locations } = await get<LocationList>('/locations');\nconst location = locations.find(l => l.apiAccess === 'open');\nif (!location) throw new Error('No location with API access');\n\nconst prices = await get<PriceDay>(`/locations/${location.id}/prices`);\nfor (const hour of prices.intervals.toSorted((a, b) => a.totalIncVat - b.totalIncVat)) {\n  console.log(hour.start, `${hour.totalIncVat.toFixed(2)} kr/kWh`);\n}\n```",
        "lang": "TypeScript"
      }
    ]
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/me": {
      "get": {
        "description": "The key you are calling with: its name, what it may read, and until when.",
        "operationId": "getKeyDetails",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "account": {
                        "id": "94d922d1-fcc9-5571-b97c-e7e7d1aca4c7"
                      },
                      "key": {
                        "expiresAt": "2027-11-16T09:12:00+01:00",
                        "name": "Mit script",
                        "prefix": "osm_4f9Kx2Qa",
                        "scopes": [
                          "prices:read",
                          "consumption:read",
                          "costs:read",
                          "labels:read"
                        ]
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/KeyDetails"
                }
              }
            },
            "description": "The key you are calling with.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Get key details",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl https://api.osmundenergi.dk/api/v1/me \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\nresponse = requests.get(\n    \"https://api.osmundenergi.dk/api/v1/me\",\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const response = await fetch(`https://api.osmundenergi.dk/api/v1/me`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/me`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['KeyDetails'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    },
    "/api/v1/locations": {
      "get": {
        "description": "Every location you see in the app, newest first. A location never carries its address fields (street, house number, postcode, city). With the scope labels:read it carries the name you gave it in the app, which is the text you typed there and can be a street name.",
        "operationId": "listLocations",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "locations": [
                        {
                          "apiAccess": "open",
                          "consumptionThrough": "2026-11-16T00:00:00+01:00",
                          "id": "0192f3a1-7c2e-7b1a-9d3e-2f6a8c1e4b10",
                          "label": "Hjem",
                          "meterResolution": "PT1H",
                          "plan": "osmund_rolig",
                          "plus": {
                            "endsOn": null,
                            "status": "included",
                            "trialEndsOn": null
                          },
                          "priceArea": "DK1",
                          "ratedThrough": "2026-11-15",
                          "state": "active"
                        },
                        {
                          "apiAccess": "closed",
                          "consumptionThrough": null,
                          "id": "0192f3a1-9a41-7d02-8c11-5b7e3d2f6a22",
                          "label": "Sommerhuset",
                          "meterResolution": null,
                          "plan": null,
                          "plus": {
                            "endsOn": null,
                            "status": "none",
                            "trialEndsOn": null
                          },
                          "priceArea": "DK2",
                          "ratedThrough": null,
                          "state": "upcoming"
                        }
                      ]
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/LocationList"
                }
              }
            },
            "description": "Your locations, newest first.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List locations",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl https://api.osmundenergi.dk/api/v1/locations \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\nresponse = requests.get(\n    \"https://api.osmundenergi.dk/api/v1/locations\",\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const response = await fetch(`https://api.osmundenergi.dk/api/v1/locations`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['LocationList'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    },
    "/api/v1/locations/{id}/prices": {
      "get": {
        "description": "Spot price, tariffs, taxes and the total with and without VAT for every hour or quarter hour of a Danish day. A quarter hour has its own spot price and its hour's tariffs. Tomorrow is ready in the afternoon. Needs the scope prices:read.",
        "operationId": "getElectricityPrices",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "A location id from List locations.",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date",
            "required": false,
            "schema": {
              "description": "Today or tomorrow, YYYY-MM-DD. Default: today.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "resolution",
            "required": false,
            "schema": {
              "default": "PT1H",
              "description": "How long each interval is, as an ISO 8601 duration: PT15M (quarter hour) or PT1H (hour).",
              "enum": [
                "PT15M",
                "PT1H"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "complete": true,
                      "currency": "DKK",
                      "date": "2026-11-17",
                      "intervals": [
                        {
                          "components": [
                            {
                              "description": "Spotpris",
                              "perKwh": 0.412,
                              "type": "spot"
                            },
                            {
                              "description": "Nettarif",
                              "perKwh": 0.287,
                              "type": "tariff"
                            },
                            {
                              "description": "Systemtarif",
                              "perKwh": 0.072,
                              "type": "tariff"
                            },
                            {
                              "description": "Elafgift",
                              "perKwh": 0.008,
                              "type": "tax"
                            }
                          ],
                          "end": "2026-11-17T01:00:00+01:00",
                          "spot": 0.412,
                          "start": "2026-11-17T00:00:00+01:00",
                          "totalExVat": 0.779,
                          "totalIncVat": 0.97375
                        },
                        {
                          "components": [
                            {
                              "description": "Spotpris",
                              "perKwh": 0.389,
                              "type": "spot"
                            },
                            {
                              "description": "Nettarif",
                              "perKwh": 0.287,
                              "type": "tariff"
                            },
                            {
                              "description": "Systemtarif",
                              "perKwh": 0.072,
                              "type": "tariff"
                            },
                            {
                              "description": "Elafgift",
                              "perKwh": 0.008,
                              "type": "tax"
                            }
                          ],
                          "end": "2026-11-17T02:00:00+01:00",
                          "spot": 0.389,
                          "start": "2026-11-17T01:00:00+01:00",
                          "totalExVat": 0.756,
                          "totalIncVat": 0.945
                        }
                      ],
                      "locationId": "0192f3a1-7c2e-7b1a-9d3e-2f6a8c1e4b10",
                      "priceArea": "DK1",
                      "reason": null,
                      "resolution": "PT1H",
                      "unit": "kr/kWh"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/PriceDay"
                }
              }
            },
            "description": "The prices for the day. complete is false while the day cannot be fully priced yet.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "invalid_request",
                      "message": "date must be today or tomorrow, YYYY-MM-DD.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "invalid_request: a parameter is missing or not valid. message says which."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "api_access_not_included",
                      "locationId": "0192f3a1-9a41-7d02-8c11-5b7e3d2f6a22",
                      "message": "API access is not included at this location.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "scope_required: the key does not have this route's scope. api_access_not_included: API access is not included at this location."
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "not_found",
                      "message": "Not found.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "not_found: no location with this id among yours."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [
              "prices:read"
            ]
          }
        ],
        "summary": "Get electricity prices",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl \"https://api.osmundenergi.dk/api/v1/locations/$LOCATION_ID/prices?resolution=PT1H\" \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\nlocation_id = os.environ[\"LOCATION_ID\"]  # an id from List locations\n\nresponse = requests.get(\n    f\"https://api.osmundenergi.dk/api/v1/locations/{location_id}/prices\",\n    params={\"resolution\": \"PT1H\"},\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/prices?resolution=PT1H`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/prices?resolution=PT1H`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['PriceDay'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    },
    "/api/v1/locations/{id}/consumption": {
      "get": {
        "description": "kWh per quarter hour (PT15M), hour (PT1H), day (P1D) or month (P1M), by the Danish calendar. PT15M gives the quarter hours where the meter measures them, and an hour as one value where it measured the hour (meterResolution in List locations says which it measures now). A meter that measures hours is billed at the average of the hour's four quarter-hour prices, so moving consumption within the hour does not change what it costs. Needs the scope consumption:read.",
        "operationId": "getConsumption",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "A location id from List locations.",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "resolution",
            "required": false,
            "schema": {
              "default": "P1D",
              "description": "How long each value covers, as an ISO 8601 duration: PT15M (quarter hour, where the meter measures it), PT1H (hour), P1D (day) or P1M (month).",
              "enum": [
                "PT15M",
                "PT1H",
                "P1D",
                "P1M"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "description": "The first day, YYYY-MM-DD, or the first month, YYYY-MM, for P1M.",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "description": "The last day or month, included, in the same form as from. At most 31 days of quarter hours or hours, 366 days, or 36 months.",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "from": "2026-11-01",
                      "locationId": "0192f3a1-7c2e-7b1a-9d3e-2f6a8c1e4b10",
                      "resolution": "P1D",
                      "to": "2026-11-03",
                      "totalKwh": 42.3,
                      "unit": "kWh",
                      "values": [
                        {
                          "end": "2026-11-02T00:00:00+01:00",
                          "kwh": 13.9,
                          "start": "2026-11-01T00:00:00+01:00"
                        },
                        {
                          "end": "2026-11-03T00:00:00+01:00",
                          "kwh": 15.2,
                          "start": "2026-11-02T00:00:00+01:00"
                        },
                        {
                          "end": "2026-11-04T00:00:00+01:00",
                          "kwh": 13.2,
                          "start": "2026-11-03T00:00:00+01:00"
                        }
                      ]
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Consumption"
                }
              }
            },
            "description": "kWh for each period in the range that has readings.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "invalid_request",
                      "message": "At most 31 days at this resolution.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "invalid_request: a parameter is missing or not valid. message says which."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "api_access_not_included",
                      "locationId": "0192f3a1-9a41-7d02-8c11-5b7e3d2f6a22",
                      "message": "API access is not included at this location.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "scope_required: the key does not have this route's scope. api_access_not_included: API access is not included at this location."
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "not_found",
                      "message": "Not found.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "not_found: no location with this id among yours."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [
              "consumption:read"
            ]
          }
        ],
        "summary": "Get consumption",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl \"https://api.osmundenergi.dk/api/v1/locations/$LOCATION_ID/consumption?from=2026-11-01&to=2026-11-03&resolution=P1D\" \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\nlocation_id = os.environ[\"LOCATION_ID\"]  # an id from List locations\n\nresponse = requests.get(\n    f\"https://api.osmundenergi.dk/api/v1/locations/{location_id}/consumption\",\n    params={\"from\": \"2026-11-01\", \"to\": \"2026-11-03\", \"resolution\": \"P1D\"},\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/consumption?from=2026-11-01&to=2026-11-03&resolution=P1D`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/consumption?from=2026-11-01&to=2026-11-03&resolution=P1D`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['Consumption'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    },
    "/api/v1/locations/{id}/standby": {
      "get": {
        "description": "What the location uses when nothing is switched on, per completed month. Needs the scope consumption:read.",
        "operationId": "getStandbyConsumption",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "A location id from List locations.",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "locationId": "0192f3a1-7c2e-7b1a-9d3e-2f6a8c1e4b10",
                      "months": [
                        {
                          "month": "2026-09",
                          "standbyKw": 0.142
                        },
                        {
                          "month": "2026-10",
                          "standbyKw": 0.151
                        }
                      ],
                      "unit": "kW"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Standby"
                }
              }
            },
            "description": "Standby for each completed month.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "invalid_request",
                      "message": "A parameter is missing or not valid. See the documentation.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "invalid_request: a parameter is missing or not valid. message says which."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "api_access_not_included",
                      "locationId": "0192f3a1-9a41-7d02-8c11-5b7e3d2f6a22",
                      "message": "API access is not included at this location.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "scope_required: the key does not have this route's scope. api_access_not_included: API access is not included at this location."
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "not_found",
                      "message": "Not found.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "not_found: no location with this id among yours."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [
              "consumption:read"
            ]
          }
        ],
        "summary": "Get standby consumption",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl https://api.osmundenergi.dk/api/v1/locations/$LOCATION_ID/standby \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\nlocation_id = os.environ[\"LOCATION_ID\"]  # an id from List locations\n\nresponse = requests.get(\n    f\"https://api.osmundenergi.dk/api/v1/locations/{location_id}/standby\",\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/standby`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/standby`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['Standby'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    },
    "/api/v1/locations/{id}/costs/rated": {
      "get": {
        "description": "What the consumption cost per day: the charges per kWh, priced the way the invoice prices them, and with each day's share of the subscriptions, as the Osmund app shows it, line by line in components. Fees, such as the payment fee, are on the invoice only. Any month up to this one. The latest days are usually not rated yet: see missingDays, and ratedThrough in List locations. Needs the scope costs:read.",
        "operationId": "getRatedCost",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "A location id from List locations.",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "month",
            "required": false,
            "schema": {
              "description": "A month from 2000-01 up to this one, YYYY-MM. Default: this month. A month that is not rated lists its supplied days in missingDays.",
              "pattern": "^\\d{4}-\\d{2}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "complete": false,
                      "currency": "DKK",
                      "days": [
                        {
                          "components": [
                            {
                              "description": "Strøm",
                              "exVat": 13.0512,
                              "incVat": 16.314,
                              "type": "spot"
                            },
                            {
                              "description": "Transmissions nettarif",
                              "exVat": 0.5977,
                              "incVat": 0.7471,
                              "type": "tariff"
                            },
                            {
                              "description": "Systemtarif",
                              "exVat": 1.0008,
                              "incVat": 1.251,
                              "type": "tariff"
                            },
                            {
                              "description": "Nettarif C",
                              "exVat": 4.1592,
                              "incVat": 5.199,
                              "type": "tariff"
                            },
                            {
                              "description": "Elafgift",
                              "exVat": 0.1112,
                              "incVat": 0.139,
                              "type": "tax"
                            },
                            {
                              "description": "TSO - System Abonnement",
                              "exVat": 0.5194,
                              "incVat": 0.6493,
                              "type": "subscription"
                            },
                            {
                              "description": "Net abo C forbrug",
                              "exVat": 1.6583,
                              "incVat": 2.0729,
                              "type": "subscription"
                            },
                            {
                              "description": "Osmund Rolig 210 – 500 kWh",
                              "exVat": 0.9333,
                              "incVat": 1.1667,
                              "type": "subscription"
                            }
                          ],
                          "date": "2026-11-01",
                          "exVat": 18.92,
                          "incVat": 23.65,
                          "kwh": 13.9,
                          "subscriptions": {
                            "exVat": 3.11,
                            "incVat": 3.89
                          },
                          "totalWithSubscriptions": {
                            "exVat": 22.03,
                            "incVat": 27.54
                          }
                        },
                        {
                          "components": [
                            {
                              "description": "Strøm",
                              "exVat": 14.2944,
                              "incVat": 17.868,
                              "type": "spot"
                            },
                            {
                              "description": "Transmissions nettarif",
                              "exVat": 0.6536,
                              "incVat": 0.817,
                              "type": "tariff"
                            },
                            {
                              "description": "Systemtarif",
                              "exVat": 1.0944,
                              "incVat": 1.368,
                              "type": "tariff"
                            },
                            {
                              "description": "Nettarif C",
                              "exVat": 4.5448,
                              "incVat": 5.681,
                              "type": "tariff"
                            },
                            {
                              "description": "Elafgift",
                              "exVat": 0.1216,
                              "incVat": 0.152,
                              "type": "tax"
                            },
                            {
                              "description": "TSO - System Abonnement",
                              "exVat": 0.5194,
                              "incVat": 0.6493,
                              "type": "subscription"
                            },
                            {
                              "description": "Net abo C forbrug",
                              "exVat": 1.6583,
                              "incVat": 2.0729,
                              "type": "subscription"
                            },
                            {
                              "description": "Osmund Rolig 210 – 500 kWh",
                              "exVat": 0.9333,
                              "incVat": 1.1667,
                              "type": "subscription"
                            }
                          ],
                          "date": "2026-11-02",
                          "exVat": 20.71,
                          "incVat": 25.89,
                          "kwh": 15.2,
                          "subscriptions": {
                            "exVat": 3.11,
                            "incVat": 3.89
                          },
                          "totalWithSubscriptions": {
                            "exVat": 23.82,
                            "incVat": 29.78
                          }
                        }
                      ],
                      "daysInMonth": 30,
                      "daysWithData": 2,
                      "locationId": "0192f3a1-7c2e-7b1a-9d3e-2f6a8c1e4b10",
                      "missingDays": [
                        "2026-11-03"
                      ],
                      "month": "2026-11",
                      "subscriptions": {
                        "exVat": 6.22,
                        "incVat": 7.78
                      },
                      "subscriptionsComplete": true,
                      "total": {
                        "exVat": 39.63,
                        "incVat": 49.54
                      },
                      "totalKwh": 29.1,
                      "totalWithSubscriptions": {
                        "exVat": 45.85,
                        "incVat": 57.32
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/RatedCost"
                }
              }
            },
            "description": "The rated cost for the month, day by day, as far as it is rated.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "invalid_request",
                      "message": "month must be a month from 2000-01 up to this one, YYYY-MM.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "invalid_request: a parameter is missing or not valid. message says which."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "api_access_not_included",
                      "locationId": "0192f3a1-9a41-7d02-8c11-5b7e3d2f6a22",
                      "message": "API access is not included at this location.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "scope_required: the key does not have this route's scope. api_access_not_included: API access is not included at this location."
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "not_found",
                      "message": "Not found.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "not_found: no location with this id among yours."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [
              "costs:read"
            ]
          }
        ],
        "summary": "Get rated cost",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl \"https://api.osmundenergi.dk/api/v1/locations/$LOCATION_ID/costs/rated?month=2026-11\" \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\nlocation_id = os.environ[\"LOCATION_ID\"]  # an id from List locations\n\nresponse = requests.get(\n    f\"https://api.osmundenergi.dk/api/v1/locations/{location_id}/costs/rated\",\n    params={\"month\": \"2026-11\"},\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/costs/rated?month=2026-11`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst locationId = process.env.LOCATION_ID; // an id from List locations\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/locations/${locationId}/costs/rated?month=2026-11`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['RatedCost'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    },
    "/api/v1/invoices": {
      "get": {
        "description": "Your invoices for the whole account, newest first. Needs the scope costs:read.",
        "operationId": "listInvoices",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "description": "The page, from 1.",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "perPage",
            "required": false,
            "schema": {
              "default": 25,
              "description": "Invoices per page, at most 100.",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "hasMore": false,
                      "invoices": [
                        {
                          "currency": "DKK",
                          "dueDate": "2026-11-26",
                          "invoiceDate": "2026-11-12",
                          "invoiceNo": "F1234",
                          "outstanding": 0,
                          "paid": true,
                          "total": {
                            "exVat": 662.38,
                            "incVat": 827.98
                          },
                          "type": "invoice"
                        }
                      ],
                      "page": 1,
                      "perPage": 25
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/InvoiceList"
                }
              }
            },
            "description": "One page of invoices, newest first.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "invalid_request",
                      "message": "A parameter is missing or not valid. See the documentation.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "invalid_request: a parameter is missing or not valid. message says which."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "api_access_not_included",
                      "message": "API access is not included at any of your locations.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "scope_required: the key does not have costs:read. api_access_not_included: API access is not included at any of your locations."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [
              "costs:read"
            ]
          }
        ],
        "summary": "List invoices",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl \"https://api.osmundenergi.dk/api/v1/invoices?page=1&perPage=25\" \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\nresponse = requests.get(\n    \"https://api.osmundenergi.dk/api/v1/invoices\",\n    params={\"page\": 1, \"perPage\": 25},\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const response = await fetch(`https://api.osmundenergi.dk/api/v1/invoices?page=1&perPage=25`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/invoices?page=1&perPage=25`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['InvoiceList'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    },
    "/api/v1/invoices/{invoiceNo}": {
      "get": {
        "description": "The invoice with its lines. Needs the scope costs:read.",
        "operationId": "getInvoice",
        "parameters": [
          {
            "in": "path",
            "name": "invoiceNo",
            "required": true,
            "schema": {
              "description": "An invoice number from List invoices.",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "currency": "DKK",
                      "dueDate": "2026-11-26",
                      "invoiceDate": "2026-11-12",
                      "invoiceNo": "F1234",
                      "lines": [
                        {
                          "description": "Strøm",
                          "exVat": 181.1,
                          "incVat": 226.38,
                          "periodEnd": "2026-10-31",
                          "periodStart": "2026-10-01",
                          "quantity": 441.7,
                          "unit": "kWh",
                          "vat": 45.28
                        },
                        {
                          "description": "Osmund Plus",
                          "exVat": 13,
                          "incVat": 16.25,
                          "periodEnd": "2026-10-31",
                          "periodStart": "2026-10-01",
                          "quantity": 31,
                          "unit": "day",
                          "vat": 3.25
                        }
                      ],
                      "outstanding": 0,
                      "paid": true,
                      "total": {
                        "exVat": 662.38,
                        "incVat": 827.98
                      },
                      "type": "invoice"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            },
            "description": "The invoice with its lines.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "invalid_request",
                      "message": "A parameter is missing or not valid. See the documentation.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "invalid_request: a parameter is missing or not valid. message says which."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "unauthorized",
                      "message": "Missing or invalid API key.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "unauthorized: no key, or a key that is not valid, has expired or has been revoked."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "api_access_not_included",
                      "message": "API access is not included at any of your locations.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "scope_required: the key does not have costs:read. api_access_not_included: API access is not included at any of your locations."
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "not_found",
                      "message": "Not found.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "not_found: no invoice with this number among yours."
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "rate_limited",
                      "message": "Too many requests.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 42
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "rate_limited: the key is over a limit. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "internal_error",
                      "message": "Something went wrong. Try again, or contact us with the request id.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "internal_error: something went wrong on our side. Send us the requestId."
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "value": {
                      "code": "temporarily_unavailable",
                      "message": "Try again shortly.",
                      "requestId": "5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d",
                      "retryAfter": 30
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "temporarily_unavailable: the API is closed, or cannot count requests right now. Try again after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [
              "costs:read"
            ]
          }
        ],
        "summary": "Get invoice",
        "tags": [
          "Endpoints"
        ],
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "curl",
            "source": "curl https://api.osmundenergi.dk/api/v1/invoices/$INVOICE_NO \\\n  -H \"Authorization: Bearer $OSMUND_API_KEY\""
          },
          {
            "label": "Python",
            "lang": "Python",
            "source": "import os\nimport requests\n\ninvoice_no = \"…\"  # a number from List invoices\n\nresponse = requests.get(\n    f\"https://api.osmundenergi.dk/api/v1/invoices/{invoice_no}\",\n    headers={\"Authorization\": f\"Bearer {os.environ['OSMUND_API_KEY']}\"},\n)\nresponse.raise_for_status()\nprint(response.json())"
          },
          {
            "label": "JavaScript",
            "lang": "JavaScript",
            "source": "const invoiceNo = '…'; // a number from List invoices\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/invoices/${invoiceNo}`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconsole.log(await response.json());"
          },
          {
            "label": "TypeScript",
            "lang": "TypeScript",
            "source": "// Types: npx openapi-typescript https://osmundenergi.dk/docs/osmund-api/openapi.json -o osmund.ts\nimport type { components } from './osmund';\n\nconst invoiceNo = '…'; // a number from List invoices\n\nconst response = await fetch(`https://api.osmundenergi.dk/api/v1/invoices/${invoiceNo}`, {\n  headers: { Authorization: `Bearer ${process.env.OSMUND_API_KEY}` },\n});\nif (!response.ok) throw new Error((await response.json()).code);\nconst body: components['schemas']['Invoice'] = await response.json();\nconsole.log(body);"
          }
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://api.osmundenergi.dk"
    }
  ],
  "tags": [
    {
      "description": "- Your locations, with the plan and Osmund Plus on each, and when there is new data\n- The electricity price by the hour or the quarter hour, for today and tomorrow\n- Consumption per quarter hour, hour, day or month, back to the start of your supply\n- Standby consumption per month\n- Rated cost per day, line by line, for any month: the charges per kWh, and with the subscriptions as the app shows it\n- Invoices and their lines",
      "name": "What you can read"
    },
    {
      "description": "- [Tomorrow's prices](/docs/osmund-api/#tag/endpoints/GET/api/v1/locations/%7Bid%7D/prices) They arrive in the afternoon, by the hour or the quarter hour.\n- [Your consumption](/docs/osmund-api/#tag/endpoints/GET/api/v1/locations/%7Bid%7D/consumption) Per quarter hour, hour, day or month, back to the start of your supply.\n- [Know when there is new data](/docs/osmund-api/#tag/new-data) Ask one route instead of asking them all.\n- [The community](https://www.facebook.com/groups/1178697878016292/) Ask questions, share what you build and hear about changes.",
      "name": "Next steps"
    },
    {
      "description": "Ask Claude or ChatGPT about your own electricity: prices, the cheapest time to use power, consumption, rated cost and invoices. Osmund MCP reads through this API and only reads.\n\n> [!NOTE]\n> Osmund MCP is part of Osmund Pro, like the API. During the beta, every location with Osmund Plus has it.\n\n### Connect Claude\n\nYou do not need an API key: you log in with MitID. Never paste a key into a chat.\n\n1. In Claude, add a custom connector [as Anthropic describes it](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp): name it Osmund, enter `https://mcp.osmundenergi.dk/mcp` and follow the steps.\n2. Claude sends you to My page. Log in with MitID, choose whether Claude may see the names you gave your locations, and approve.\n3. Ask Claude: When is electricity cheapest today to run my dishwasher for two hours?\n\nIn Claude Code:\n\n```bash\nclaude mcp add --transport http osmund https://mcp.osmundenergi.dk/mcp\n```\n\nThen run `/mcp` in Claude Code and log in.\n\n### Connect ChatGPT\n\n1. In ChatGPT on the web, add a custom MCP server [as OpenAI describes it](https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt): name it Osmund, enter `https://mcp.osmundenergi.dk/mcp`, choose OAuth and follow the steps. Not every ChatGPT plan can add one: the article says which.\n2. ChatGPT sends you to My page. Log in with MitID, choose whether ChatGPT may see the names you gave your locations, and approve.\n3. Ask ChatGPT: How much electricity have I used this month?\n\n### What the assistant reads\n\nWhat the API reads (see [What you can read](/docs/osmund-api/#tag/what-you-can-read)), for every location with API access. The assistant never gets the street address, meter number, name or email on your account, and it cannot change anything at Osmund. If you share the names you gave your locations, it sees them as you wrote them.\n\n### Remove a connection\n\nRemove it under Connected AI assistants on [My page](https://osmundenergi.dk/min-side#api). It stops at once. Removing Osmund in Claude or ChatGPT only removes it there.\n\n### Troubleshooting\n\n| What you see | What to do |\n| --- | --- |\n| Log in with MitID again | Approving needs a MitID login from the last 10 minutes. Log in and approve. |\n| Not open yet | Osmund MCP opens to customers in steps during the beta. Try again later. |\n| This needs API access | During the beta, a location has access while it has Osmund Plus. See [Access](/docs/osmund-api/#tag/access). |\n| You have already connected 10 assistants | Remove one on My page first. |\n| The request has expired | A request waits 10 minutes and can be answered once. Connect again from Claude or ChatGPT. |\n| The assistant asks you to connect again | The connection was removed or has expired. Connect again. |\n| The newest day is missing or incomplete | Readings arrive 14 to 43 hours after the hour. See [New data](/docs/osmund-api/#tag/new-data). |\n| The assistant says Osmund answered `rate_limited` | The API's [limits](/docs/osmund-api/#tag/limits) apply, per minute, hour and day. The answer says how many seconds to wait (`retryAfter`): ask again after that. |\n\nQuestions: [hej@osmundenergi.dk](mailto:hej@osmundenergi.dk) or [the community](https://www.facebook.com/groups/1178697878016292/).",
      "name": "AI assistants"
    },
    {
      "description": "Create a personal key on [My page](https://osmundenergi.dk/min-side#api) and send it with every request:\n\n```http\nAuthorization: Bearer osm_…\n```\n\nA key reads your own data only, and you can revoke it on My page.\n\n> [!IMPORTANT]\n> Keep the key secret, like a password. Whoever has it can read your data until it expires or you revoke it.",
      "name": "Authentication"
    },
    {
      "description": "A route that reads your data needs a scope, cut by how sensitive the data is.\n\n| Scope | What it reads | Routes |\n| --- | --- | --- |\n| `prices:read` | Electricity prices | `/api/v1/locations/{id}/prices` |\n| `consumption:read` | Consumption and standby | `/api/v1/locations/{id}/consumption`, `/api/v1/locations/{id}/standby` |\n| `costs:read` | Rated cost and invoices | `/api/v1/locations/{id}/costs/rated`, `/api/v1/invoices`, `/api/v1/invoices/{invoiceNo}` |\n| `labels:read` | The names you gave your locations | The `label` of each location in `/api/v1/locations` |\n| None | The key itself and your locations | `/api/v1/me`, `/api/v1/locations` |\n\nA key without the scope a route needs gets `403` with the code `scope_required`. Without `labels:read`, `/api/v1/locations` still answers, with every `label` null.\n\n> [!NOTE]\n> During the beta, a new key from My page has every scope. A key keeps the scopes it was created with, so a key from before `labels:read` reads no names: revoke it and create a new one to read them.",
      "name": "Scopes"
    },
    {
      "description": "API access is set per location. `GET /api/v1/locations` shows it as `apiAccess`, and a location without access answers `403` with the code `api_access_not_included`.\n\nDuring the beta, a location has access while it has Osmund Plus. `plus` on each location says which. Plus goes on after a free trial (`trialEndsOn`) until it is opted out of, and `endsOn` says when an opt-out ends it.",
      "name": "Access"
    },
    {
      "description": "Meter readings arrive a few times a day, usually 14 to 43 hours after the hour, and the rated cost follows them. Instead of asking every route, ask `GET /api/v1/locations`: when `consumptionThrough` or `ratedThrough` has moved, there is something new to fetch. Neither moves when a reading for an earlier hour arrives late, up to a few days back, or a day is rated again, so fetch the last five days once a day as well.\n\nConsumption and the rated cost cover your own supply: from its start, and up to its end when it has ended. Ask for at most 31 days of quarter hours or hours at a time.",
      "name": "New data"
    },
    {
      "description": "| Window | Requests | Counted |\n| --- | --- | --- |\n| Minute | 60 | Per key |\n| Hour | 120 | For all your keys together |\n| Day | 1000 | For all your keys together, per Danish day |\n\nAn answer to a key carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` for the window closest to running out. Over a limit, the API answers `429` with `Retry-After`: wait that many seconds, then try again.\n\n```python\nimport time\n\nif response.status_code in (429, 503):\n    time.sleep(int(response.headers.get(\"Retry-After\", \"60\")))\n```",
      "name": "Limits"
    },
    {
      "description": "An error is JSON with a `code` to branch on, a `message` for people and a `requestId`:\n\n```json\n{\n  \"code\": \"rate_limited\",\n  \"message\": \"Too many requests.\",\n  \"requestId\": \"5b0c8f2e-3d41-4a7e-9c6b-1f2e3a4b5c6d\",\n  \"retryAfter\": 42\n}\n```\n\n| Status | Code | What to do |\n| --- | --- | --- |\n| `400` | `invalid_request` | A parameter is missing or not valid. `message` says which. |\n| `401` | `unauthorized` | The key is missing, not valid, expired or revoked. Create a new one on My page. |\n| `403` | `scope_required` | The key does not have the route's scope. Create a key that has it. |\n| `403` | `api_access_not_included` | The location has no API access. See [Access](/docs/osmund-api/#tag/access). |\n| `404` | `not_found` | No location with this id, or no invoice with this number, among yours. Check `/api/v1/locations` or `/api/v1/invoices`. |\n| `429` | `rate_limited` | Over a limit. Wait `Retry-After` seconds, then try again. |\n| `500` | `internal_error` | Something went wrong on our side. Send us the `requestId`. |\n| `503` | `temporarily_unavailable` | The API is closed or cannot count requests right now. Wait `Retry-After` seconds. |\n\nA program should branch on `code`, not on `message`: the text can change. Send us the `requestId` if you need help.",
      "name": "Errors"
    },
    {
      "description": "Times are ISO 8601 with an offset, in Danish time. A resolution is an ISO 8601 duration, such as `PT15M` or `P1D`. Amounts are in DKK, and each answer names its unit.",
      "name": "Formats"
    },
    {
      "name": "Endpoints"
    },
    {
      "description": "The API is in beta and is part of Osmund Pro.\n\n> [!WARNING]\n> The API can still change while it is in beta, also in ways that stop a program from working.\n\nNew fields and values can appear at any time, so a program should ignore what it does not know.",
      "name": "Beta"
    },
    {
      "description": "The releases of the API, newest first.\n\n| Release | Date | What is new |\n| --- | --- | --- |\n| v1.1.0-beta |  | Osmund Plus and when there is new data on each location, consumption per quarter hour, and the rated cost line by line for any month. |\n| v1.0.0-beta |  | The first version: locations, electricity prices, consumption, standby, rated cost and invoices. |",
      "name": "Changelog"
    },
    {
      "description": "Join the [Osmund Pro community on Facebook](https://www.facebook.com/groups/1178697878016292/) to ask questions, share what you build and hear about changes.",
      "name": "Community"
    }
  ],
  "x-tagGroups": [
    {
      "name": "Get started",
      "tags": [
        "What you can read",
        "Next steps",
        "AI assistants"
      ]
    },
    {
      "name": "Using the API",
      "tags": [
        "Authentication",
        "Scopes",
        "Access",
        "New data",
        "Limits",
        "Errors",
        "Formats"
      ]
    },
    {
      "name": "API reference",
      "tags": [
        "Endpoints"
      ]
    },
    {
      "name": "About",
      "tags": [
        "Beta",
        "Changelog",
        "Community"
      ]
    }
  ]
}
