Harmont docs

Billing

Billing endpoints expose an organization's ledger: its current balance, its transaction history, and a usage breakdown of VM-lease time by pipeline and user. They also start a Stripe Checkout session for topping up and redeem coupon codes.

Balances are denominated in cents. Top-ups are credited asynchronously when Stripe confirms the checkout via webhook, so a successful checkout call returns a redirect URL, not an immediate balance change.

Get an organization's balance

GET
/api/v0/billing/balance/{org}
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Path Parameters

org*string

The organization slug.

Response Body

application/json

application/json

curl -X GET "https://api.harmont.dev/api/v0/billing/balance/string"
{
  "balance_cents": 0
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}

List an organization's ledger entries

GET
/api/v0/billing/transactions/{org}
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Path Parameters

org*string

The organization slug.

Query Parameters

limit?integer

Page size (1–100, default 50).

cursor?string

Opaque cursor from a previous page's next_cursor.

Response Body

application/json

application/json

curl -X GET "https://api.harmont.dev/api/v0/billing/transactions/string"
{
  "data": [
    {
      "amount_cents": 0,
      "created_at": "2019-08-24T14:15:22Z",
      "description": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "source": "stripe_topup"
    }
  ],
  "next_cursor": "string"
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}

Get an organization's VM usage

GET
/api/v0/billing/usage/{org}
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Path Parameters

org*string

The organization slug.

Query Parameters

from*string

Window start (inclusive), ISO-8601.

to*string

Window end (exclusive), ISO-8601.

Response Body

application/json

application/json

application/json

curl -X GET "https://api.harmont.dev/api/v0/billing/usage/string?from=string&to=string"
{
  "cpu_seconds": 0,
  "disk_gb_seconds": 0,
  "memory_gb_seconds": 0,
  "total_cents": 0
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}

Per-build VM usage breakdown

GET
/api/v0/billing/usage/{org}/breakdown
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Path Parameters

org*string

Organization slug.

Query Parameters

from*string

ISO-8601 window start (inclusive).

to*string

ISO-8601 window end (exclusive).

Response Body

application/json

application/json

application/json

curl -X GET "https://api.harmont.dev/api/v0/billing/usage/string/breakdown?from=string&to=string"
{
  "data": [
    {
      "build_external_id": "f682c5b8-d94b-4355-a5f0-409725a3764f",
      "build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
      "build_number": 0,
      "finished_at": "2019-08-24T14:15:22Z",
      "job_count": 0,
      "jobs": [
        {
          "amount_cents": 0,
          "cpu_count": 0,
          "disk_gb": 0,
          "duration_seconds": 0,
          "finished_at": "2019-08-24T14:15:22Z",
          "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f",
          "job_name": "string",
          "memory_gb": 0,
          "started_at": "2019-08-24T14:15:22Z",
          "step_key": "string",
          "vm_handle": "string"
        }
      ],
      "pipeline_id": "ec036e81-7903-4e4d-bbfa-ac8516341cf0",
      "pipeline_name": "string",
      "pipeline_slug": "string",
      "started_at": "2019-08-24T14:15:22Z",
      "total_cents": 0
    }
  ]
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}

Per-day usage time-series

GET
/api/v0/billing/usage/{org}/series
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Path Parameters

org*string

Organization slug.

Query Parameters

from*string

ISO-8601 window start (inclusive).

to*string

ISO-8601 window end (exclusive).

Response Body

application/json

application/json

application/json

curl -X GET "https://api.harmont.dev/api/v0/billing/usage/string/series?from=string&to=string"
{
  "data": [
    {
      "cpu_seconds": 0,
      "date": "2019-08-24",
      "disk_gb_seconds": 0,
      "memory_gb_seconds": 0,
      "total_cents": 0
    }
  ]
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}