> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/go/go-bundle/sdks/billing/api/invoicesapi.md).

# InvoicesApi

All URIs are relative to *<https://api.ionos.com/billing>*

| Method                                            | HTTP request                      | Description |
| ------------------------------------------------- | --------------------------------- | ----------- |
| [**InvoicesFindById**](#InvoicesFindById)         | **Get** /{contract}/invoices/{id} |             |
| [**InvoicesFindByPeriod**](#InvoicesFindByPeriod) | **Get** /invoices/{period}        |             |
| [**InvoicesGet**](#InvoicesGet)                   | **Get** /{contract}/invoices      |             |

## InvoicesFindById

```go
var result Invoice = InvoicesFindById(ctx, contract, id)
                      .Dateformat(dateformat)
                      .Execute()
```

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    billing "github.com/ionos-cloud/sdk-go-bundle/products/billing"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    contract := int32(56) // int32 | Contract number
    id := "id_example" // string | Invoice ID
    dateformat := "dateformat_example" // string | Vendor date format (optional)

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := billing.NewAPIClient(configuration)
    resource, resp, err := apiClient.InvoicesApi.InvoicesFindById(context.Background(), contract, id).Dateformat(dateformat).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `InvoicesApi.InvoicesFindById``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `InvoicesFindById`: Invoice
    fmt.Fprintf(os.Stdout, "Response from `InvoicesApi.InvoicesFindById`: %v\n", resource)
}
```

### Path Parameters

| Name         | Type                | Description                                                                 | Notes |
| ------------ | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**      | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **contract** | **int32**           | Contract number                                                             |       |
| **id**       | **string**          | Invoice ID                                                                  |       |

### Other Parameters

Other parameters are passed through a pointer to an apiInvoicesFindByIdRequest struct via the builder pattern

| Name           | Type       | Description        | Notes |
| -------------- | ---------- | ------------------ | ----- |
| **dateformat** | **string** | Vendor date format |       |

### Return type

[**Invoice**](/cloud/go/go-bundle/sdks/billing/models/invoice.md)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## InvoicesFindByPeriod

```go
var result []Invoice = InvoicesFindByPeriod(ctx, period)
                      .Contractid(contractid)
                      .Dateformat(dateformat)
                      .Execute()
```

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    billing "github.com/ionos-cloud/sdk-go-bundle/products/billing"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    period := "2020-01" // string | Period of interest in format YYYY-MM
    contractid := "contractid_example" // string | Filter out the exact contractID (optional)
    dateformat := "dateformat_example" // string | Vendor date format (optional)

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := billing.NewAPIClient(configuration)
    resource, resp, err := apiClient.InvoicesApi.InvoicesFindByPeriod(context.Background(), period).Contractid(contractid).Dateformat(dateformat).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `InvoicesApi.InvoicesFindByPeriod``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `InvoicesFindByPeriod`: []Invoice
    fmt.Fprintf(os.Stdout, "Response from `InvoicesApi.InvoicesFindByPeriod`: %v\n", resource)
}
```

### Path Parameters

| Name       | Type                | Description                                                                 | Notes |
| ---------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**    | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **period** | **string**          | Period of interest in format YYYY-MM                                        |       |

### Other Parameters

Other parameters are passed through a pointer to an apiInvoicesFindByPeriodRequest struct via the builder pattern

| Name           | Type       | Description                     | Notes |
| -------------- | ---------- | ------------------------------- | ----- |
| **contractid** | **string** | Filter out the exact contractID |       |
| **dateformat** | **string** | Vendor date format              |       |

### Return type

[**\[\]Invoice**](/cloud/go/go-bundle/sdks/billing/models/invoice.md)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## InvoicesGet

```go
var result InvoicesGet200Response = InvoicesGet(ctx, contract)
                      .Execute()
```

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    billing "github.com/ionos-cloud/sdk-go-bundle/products/billing"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    contract := int32(56) // int32 | Contract number

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := billing.NewAPIClient(configuration)
    resource, resp, err := apiClient.InvoicesApi.InvoicesGet(context.Background(), contract).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `InvoicesApi.InvoicesGet``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `InvoicesGet`: InvoicesGet200Response
    fmt.Fprintf(os.Stdout, "Response from `InvoicesApi.InvoicesGet`: %v\n", resource)
}
```

### Path Parameters

| Name         | Type                | Description                                                                 | Notes |
| ------------ | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**      | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **contract** | **int32**           | Contract number                                                             |       |

### Other Parameters

Other parameters are passed through a pointer to an apiInvoicesGetRequest struct via the builder pattern

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |

### Return type

[**InvoicesGet200Response**](/cloud/go/go-bundle/sdks/billing/models/invoicesget200response.md)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/go/go-bundle/sdks/billing/api/invoicesapi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
