v1
Double column
API
CLI
JS Client

Billing /

Get invoice details

Get details about an invoice. If `timestamp` is passed in as a query parameter, this endpoint returns details about the invoice containing that timestamp. Otherwise, returns a preview invoice displaying billing data from after the most recent invoice.

Required permission

Account > Billing > General > Read

Query parameters

    • timestamp

      integer
      Timestamp of an invoice. If passed in, this endpoint will return details about the invoice that time belongs to.
    • projectId

      string
      ID of a project. If passed in, only details about that project will be returned.
    • addonId

      string
      ID of a addon. If passed in, only details about that addon will be returned.
    • serviceId

      string
      ID of a service. If passed in, only details about that service will be returned.
    • jobId

      string
      ID of a job. If passed in, only details about that job will be returned.

Response body

  • {object}
    Response object.
    • data

      {object} required
      Result data.
      • period

        {object} required
        Information about the billing period of the invoice.
        • start

          number required
          Unix timestamp of the start of the billing period.
        • end

          number required
          Unix timestamp of the end of the billing period.
      • currency

        string required
        Currency code for the currency the invoice is billed in.
      • total

        number required
        Total cost of the invoice, in cents, including tax.
      • subTotal

        number required
        Total cost of the invoice, in cents, excluding tax.
      • paid

        boolean
        If `timestamp` is passed in, whether the invoice has been paid.
      • tax

        {object} required
        Details about the tax on the invoice.
        • percent

          number required
          Percentage of subtotal to be applied as tax.
        • value

          number required
          Value of the tax on the invoice.
      • projects

        [array] required
        An array of projects billed in this invoice. If `projectId` is passed in, only projects with a `projectId` matching the value will be returned.
        • {object}
          Billing details about a project.
          • projectId

            string required
            ID of the project.
          • duration

            string required
            Duration the project has been running in this billing period, in seconds.
          • items

            [array] required
            An array of objects belonging to this project that are billed in this invoice. If `addonId`, `serviceId` or `jobId` are passed in, only objects matching that ID will be returned.
            • {object}
              Billing details about an object.
              • duration

                string required
                Duration the object has been running in this billing period, in seconds.
              • price

                {object} required
                Details about the price of a object, broken down by resource type.
                • cpu

                  number required
                  Price of CPU usage for this object, in cents.
                • memory

                  number required
                  Price of memory usage for this object, in cents.
                • storage

                  number required
                  Price of storage usage for this object, in cents.
                • total

                  number required
                  Total price for this object, in cents.
              • nfObjectId

                string required
                The ID of the object.
              • nfObjectType

                string required
                The type of the object.
                one of
                job, service, addon, volume
          • price

            {object} required
            Details about the price of a project, broken down by resource type.
            • cpu

              number required
              Price of CPU usage for this project, in cents.
            • memory

              number required
              Price of memory usage for this project, in cents.
            • storage

              number required
              Price of storage usage for this project, in cents.
            • total

              number required
              Total price for this project, in cents.
          • objectTypeTotals

            {object} required
            Details about the price of a project, broken down by object type.
            • addon

              {object}
              • price

                {object}
                Details about the price for all addons in this project, broken down by resource type.
                • cpu

                  number required
                  Price of CPU usage for all addons in this project, in cents.
                • memory

                  number required
                  Price of memory usage for all addons in this project, in cents.
                • storage

                  number required
                  Price of storage usage for all addons in this project, in cents.
                • total

                  number required
                  Total price for all addons in this project, in cents.
              • duration

                number required
                Duration addons have been running in this billing period, in seconds.
            • service

              {object}
              • price

                {object}
                Details about the price for all services in this project, broken down by resource type.
                • cpu

                  number required
                  Price of CPU usage for all services in this project, in cents.
                • memory

                  number required
                  Price of memory usage for all services in this project, in cents.
                • storage

                  number required
                  Price of storage usage for all services in this project, in cents.
                • total

                  number required
                  Total price for all services in this project, in cents.
              • duration

                number required
                Duration services have been running in this billing period, in seconds.
            • job

              {object}
              • price

                {object}
                Details about the price for all jobs in this project, broken down by resource type.
                • cpu

                  number required
                  Price of CPU usage for all jobs in this project, in cents.
                • memory

                  number required
                  Price of memory usage for all jobs in this project, in cents.
                • storage

                  number required
                  Price of storage usage for all jobs in this project, in cents.
                • total

                  number required
                  Total price for all jobs in this project, in cents.
              • duration

                number required
                Duration jobs have been running in this billing period, in seconds.
API
CLI
JS Client

GET /v1/billing/invoices/details

Example response

200 OK

Details about an invoice.

JSON

{
  "data": {
    "period": {
      "start": 1655823815,
      "end": 1655910214
    },
    "currency": "usd",
    "total": 1200,
    "subTotal": 1000,
    "tax": {
      "percent": 20,
      "value": 200
    },
    "projects": [
      {
        "projectId": "default-project",
        "duration": 259200,
        "items": [
          {
            "duration": 172800,
            "price": {
              "cpu": 200,
              "memory": 200,
              "storage": 200,
              "total": 600
            },
            "nfObjectId": "example-service",
            "nfObjectType": "service"
          }
        ],
        "price": {
          "cpu": 200,
          "memory": 200,
          "storage": 200,
          "total": 600
        },
        "objectTypeTotals": {
          "addon": {
            "price": {
              "cpu": 200,
              "memory": 200,
              "storage": 200,
              "total": 600
            },
            "duration": 172800
          },
          "service": {
            "price": {
              "cpu": 200,
              "memory": 200,
              "storage": 200,
              "total": 600
            },
            "duration": 172800
          },
          "job": {
            "price": {
              "cpu": 200,
              "memory": 200,
              "storage": 200,
              "total": 600
            },
            "duration": 172800
          }
        }
      }
    ]
  }
}

© 2024 Northflank Ltd. All rights reserved.