# GET /api/v1/hosts/machines/{id}/earnings

Per-machine earnings day-series (host owner)

Operation: `getMachineEarnings`.

Per-machine earnings day-series (host owner)

The account-wide `/hosts/earnings` day-series narrowed to one machine and attributed through `jobs.machine_id`, in the identical shape so one chart renders both. Ledger-derived only: every bar links back to `journal_lines` on `host_payable:<id>` for jobs that ran on this machine, and the series reconciles exactly to those rows. `paid_micro` is zero throughout, because payout settlements carry no `job_id` and belong to the account rather than to any one machine — attributing them would double-count a payout across the fleet. A non-owner receives 404, never 403, so machine existence never leaks. A malformed `window` is refused rather than silently defaulted.

## Endpoint

`GET https://amplerun-api.spiry.org/api/v1/hosts/machines/{id}/earnings`

## Authentication

Use the credential and scope required by this operation. For programmatic renter/host calls: `Authorization: Bearer $AMPLERUN_API_KEY`. A host-agent signature or other specialized proof is required where the description specifies it.

## Parameters

| Name | Location | Presence | Type | Description |
| --- | --- | --- | --- | --- |
| `id` | path | Required | UUID |  |
| `window` | query | Optional | string | Trailing window as &lt;n&gt;d (default 30d, 1..365). |

## Responses

### `200`

Daily earnings bars for this machine, oldest first.

`application/json`
| Field | Type | Presence | Description |
| --- | --- | --- | --- |
| `window_days` | integer | Required |  |
| `from` | Rfc3339Utc | Required |  |
| `to` | Rfc3339Utc | Required |  |
| `days` | array of object | Required |  |

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "window_days",
    "from",
    "to",
    "days"
  ],
  "properties": {
    "window_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 365
    },
    "from": {
      "$ref": "#/components/schemas/Rfc3339Utc"
    },
    "to": {
      "$ref": "#/components/schemas/Rfc3339Utc"
    },
    "days": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "day",
          "earned_micro",
          "fee_micro",
          "paid_micro",
          "rental_count"
        ],
        "properties": {
          "day": {
            "type": "string",
            "description": "UTC calendar day, YYYY-MM-DD"
          },
          "earned_micro": {
            "type": "string",
            "pattern": "^-?(0|[1-9][0-9]*)$"
          },
          "fee_micro": {
            "type": "string",
            "pattern": "^-?(0|[1-9][0-9]*)$"
          },
          "paid_micro": {
            "$ref": "#/components/schemas/MicroAmount"
          },
          "rental_count": {
            "type": "integer"
          }
        }
      }
    }
  }
}
```

### `default`

Error envelope. 401 unauthenticated, 403/404 forbidden, 409 conflict, 422 invalid input, 429 rate limited (code UNAVAILABLE, retryable:true, no Retry-After header), 503 unavailable money/provider state with retryable:true.

`application/json`
| Field | Type | Presence | Description |
| --- | --- | --- | --- |
| `error` | object | Required |  |

```json
{
  "$ref": "#/components/schemas/ErrorEnvelope"
}
```

## Static request outline

Replace path/query placeholders and provide the required JSON body, headers and credential from the sections above. This is a request outline, not a command that chooses an amount or starts a rental for you.

```sh
curl --request GET 'https://amplerun-api.spiry.org/api/v1/hosts/machines/{id}/earnings' \
  --header "Authorization: Bearer $AMPLERUN_API_KEY"
```

[Schema definitions](https://docs.amplerun.com/reference/schemas.md) · [Download OpenAPI](/openapi.json) · [Authentication](https://docs.amplerun.com/agents/authentication.md) · [Errors and recovery](https://docs.amplerun.com/reference/errors.md)

---
Generated from the AmpleRun API contract.
Canonical: https://docs.amplerun.com/reference/api/get-machine-earnings/
