# Get provider invoice months

> Returns spend per invoice month split by cost type (regular, tax, adjustment, rounding). Google Cloud only; other providers return no months.

Source: https://docs.levelfour.ai/api-reference/providers/get-providers-by-id-costs-invoices


## GET /api/v1/providers/{provider_id}/costs/invoices

Returns spend per invoice month split by cost type (regular, tax, adjustment, rounding). Google Cloud only; other providers return no months.

### Authentication

Send `Authorization: Bearer <token>`.

### Parameters

- `provider_id` (path, string, required)
- `months` (query, integer, default `6`): How many invoice months to return, newest first
- `credits` (query, one of `before`, `after`, default `after`): Cost basis for Google Cloud: after credits (default) or before them. AWS stays on its invoiced basis.

### Responses

#### 200: Successful Response

- `success` (boolean, default `true`)
- `timestamp` (date-time string)
- `data` (object, required)
  - `items` (array of object, required): Invoice months, newest first
    - `invoice_month` (string, required): Invoice month, YYYYMM
    - `total` (number, required): Total for the month
    - `by_cost_type` (object, required): Total split by cost type
      - `regular` (number, required): Usage and fees
      - `tax` (number, required): Taxes
      - `adjustment` (number, required): Billing adjustments
      - `rounding_error` (number, required): Rounding corrections
    - `marketplace_total` (number, required): Charges sold by a third party through the marketplace
  - `includes_billing_account_charges` (boolean, required): True when lines billed to the account rather than a project (tax, rounding) are included
  - `credits` (one of `before`, `after`, required): Cost basis applied

#### Errors

- `400`: Bad Request
- `401`: Authentication Error
- `403`: Authorization Error
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Rate Limit Exceeded
- `500`: Internal Server Error

Body of `400`, `401`, `403`, `404`, `409`, `422`, `429`, `500`:

- `success` (`false`, required)
- `error` (object, required)
  - `code` (string, required)
  - `message` (string, required)
  - `details` (any)
- `timestamp` (date-time string, required)
