Skip to content

Get a server's daily cost and uptime

Returns one row per day with what the server was billed and how long it was running, plus this month's total cost and uptime. It feeds the usage and cost chart of a server's detail page.

Costs are read from the same billing ledger as your organization's usage page: the hours the server ran plus, while it is parked, the storage of its saved copy (billed per GB-hour). Nothing is estimated. An hour is billed shortly after it starts, so today's figure can lag by about an hour. Bring-your-own servers are billed by your provider, not by Aitronos: their costs are null.

A server is visible to the person who created it and to members with manage_forge; anyone else is told it does not exist. Requires a bearer token (or API key) whose principal holds the use_forge capability in the acting organization. It works while Forge cloud compute is switched off.

GEThttps://api.aitronos.com/v1/forge/compute/hosts/{host_id}/usage

Path Parameters

host_id string required

The server's id: the fchost_ id returned in id, or the UUID sent when the server was created (any letter case, with or without hyphens).

Query Parameters

from string optional

First day of the period, inclusive, as YYYY-MM-DD (UTC). Defaults to the first day of to's month; with neither from nor to, the period is the current calendar month (UTC).

to string optional

Last day of the period, inclusive, as YYYY-MM-DD (UTC). Defaults to the last day of from's month. The period is at most 93 days, both ends counted. It may end in the future; future days are never returned.

granularity string optional

The size of one row. Only day is supported, and it is the default.

organization_id string optional

The organization the server belongs to: send its organization.id (from List your servers in every organization). Defaults to your current organization, where a server of another organization is not found. You must be an active member of it, or the request is refused with 403 ORGANIZATION_ACCESS_DENIED.

Headers

X-Organization-Id string optional

The same as organization_id, as a header. When both are sent, the query parameter wins.


Returns

  • host_id string — the server's fchost_ id.
  • currency string — the currency of every amount, CHF.
  • period object — the period of days, as asked or defaulted: from and to strings (YYYY-MM-DD, inclusive).
  • month_to_date string or null — what the server has cost this calendar month (UTC), two decimals. It is the same value as month_to_date on Get a server. null for bring-your-own servers.
  • uptime_seconds_month integer — how many seconds the server was running this calendar month (UTC), up to now.
  • days array — one row per day, oldest first, from the later of from and the day the server was created, to the earliest of to, today and the day the server was deleted. Days before the server existed and future days are left out; a day with no activity is a row with zero cost and zero uptime. Each row has:
    • date string — the day, YYYY-MM-DD (UTC).
    • cost string or null — what the server was billed for that day, two decimals: running hours plus parked storage. Within each month, the days are rounded so that they add up to the month's rounded total; no day differs from its exact amount by a cent or more. null for bring-your-own servers.
    • uptime_seconds integer — how many seconds the server was running within that day (UTC), from 0 to 86400.

A server counts as running from when it starts after being created, or when a resume finishes, until a park finishes, a delete starts, access is revoked, or a step fails. The same periods are listed by List a server's running intervals.

{
  "host_id": "fchost_5d0c2b9e7a414f3c9e8b1a6d2f4c7e90",
  "currency": "CHF",
  "period": {"from": "2026-10-01", "to": "2026-10-31"},
  "month_to_date": "5.69",
  "uptime_seconds_month": 29880,
  "days": [
    {"date": "2026-10-01", "cost": "1.91", "uptime_seconds": 10800},
    {"date": "2026-10-02", "cost": "3.78", "uptime_seconds": 19080}
  ]
}

Errors

StatusCodeWhen
401AUTHENTICATION_REQUIREDNo valid credential.
403ORGANIZATION_ACCESS_DENIEDorganization_id or X-Organization-Id names an organization you are not an active member of.
403INSUFFICIENT_PERMISSIONSThe caller does not hold use_forge in the acting organization.
404FORGE_COMPUTE_HOST_NOT_FOUNDNo server with this id in the acting organization, or it was created by someone else and the caller does not hold manage_forge.
422INVALID_DATE_RANGEto is before from.
422DATE_RANGE_TOO_LARGEThe period is longer than 93 days.
422VALIDATION_ERRORfrom or to is not a YYYY-MM-DD date, or granularity is not day.
422INVALID_ID_FORMAThost_id is neither a UUID nor fchost_<32 hex>.
cURL
curl "https://api.aitronos.com/v1/forge/compute/hosts/fchost_5d0c2b9e7a414f3c9e8b1a6d2f4c7e90/usage?from=2026-10-01&to=2026-10-31" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

Response:

{
  "host_id": "fchost_5d0c2b9e7a414f3c9e8b1a6d2f4c7e90",
  "currency": "CHF",
  "period": {"from": "2026-10-01", "to": "2026-10-31"},
  "month_to_date": "5.69",
  "uptime_seconds_month": 29880,
  "days": [
    {"date": "2026-10-01", "cost": "1.91", "uptime_seconds": 10800},
    {"date": "2026-10-02", "cost": "3.78", "uptime_seconds": 19080}
  ]
}