# Invoice

Invoices in Salaxy contect are the payments that should be made to pay the net salary and side costs. The service is for querying invoices and notifying them as unread/paid/read/canceled from 3rd party system.

Salaxy API v03, **Finland only**. 23 operations. Interactive version: [REST API reference](https://code.salaxy.com/reference/rest-api.md). Machine-readable: [OpenAPI document](https://code.salaxy.com/openapi/salaxy-03.json).

**The reference wins:**
These pages are generated from the OpenAPI document. If a guide and this reference disagree about a field, follow the reference. Error responses are not in the document — see [Errors](https://code.salaxy.com/reference/errors.md).

## `GET /v03/api/invoices`

**Returns list of invoices for the current owner.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `$search` | query | string |  |  |
| `$filter` | query | string |  | Specifies the logic to pull back a subset of records. |
| `$orderby` | query | string |  | Specifies the values used to sort the collection of entries. |
| `$select` | query | string |  | The $select system query option allows the clients to requests a limited set of properties for each entry. |
| `$top` | query | number |  | Specifies the subset of entries by count. |
| `$skip` | query | number |  | Specifies the count of entries to skip. |
| `$count` | query | boolean |  | Indicates whether or not to include a total entry count. |

Response: `PageResultOfInvoiceListItem`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/GET/v03/api/invoices)

## `GET /v03/api/invoices/{id}`

**Gets a single invoice. based on identier.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Unique identifier for the object |

Response: `Invoice`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/GET/v03/api/invoices/{id})

## `DELETE /v03/api/invoices/{id}`

**Deletes an object from the storage**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Unique identifier for the object. |

Response: `string`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/DELETE/v03/api/invoices/{id})

## `GET /v03/api/invoices/{id}/content`

**Downloads the pdf file for the invoice.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The id of the invoice. |
| `inline` | query | boolean |  | If true, returns the content as inline (disposition). If false, the content is returned as an attachmnent. |

Response: OK

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/GET/v03/api/invoices/{id}/content)

## `POST /v03/api/invoices/content`

**Downloads the pdf file for the invoice.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `inline` | query | boolean |  | If true, returns the content as inline (disposition). If false, the content is returned as an attachmnent. |

Request body: `Invoice` (required)

Response: OK

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/content)

## `GET /v03/api/invoices/sepa`

**Downloads the sepa file for the posted ids.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `ids` | query | string[] |  | Ids of the invoices for the sepa payment. |
| `payerIbanNumber` | query | string |  | Payer iban number. |
| `payerBic` | query | string |  | Payer BIC. |
| `bankPartyId` | query | string |  | Payer bank party id. Depends on the bank. |
| `inline` | query | boolean |  | If true, returns the content as inline (disposition). If false, the content is returned as an attachmnent. |
| `version` | query | string |  | ISO 20022 version, pain.001.001.02 (default) or pain.001.001.03 |

Response: OK

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/GET/v03/api/invoices/sepa)

## `POST /v03/api/invoices/sepa`

**Downloads the sepa file for the posted invoices.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `payerIbanNumber` | query | string |  | Payer iban number. |
| `payerBic` | query | string |  | Payer BIC. |
| `bankPartyId` | query | string |  | Payer bank party id. Depends on the bank. |
| `inline` | query | boolean |  | If true, returns the content as inline (disposition). If false, the content is returned as an attachmnent. |
| `version` | query | string |  | ISO 20022 version, pain.001.001.02 (default) or pain.001.001.03 |

Request body: `Invoice[]` (required)

Response: OK

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/sepa)

## `GET /v03/api/invoices/{id}/finvoice`

**Downloads the finvoice file for the invoice.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The id of the invoice. |
| `inline` | query | boolean |  | If true, returns the content as inline (disposition). If false, the content is returned as an attachmnent. |

Response: OK

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/GET/v03/api/invoices/{id}/finvoice)

## `POST /v03/api/invoices/finvoice`

**Downloads the finvoice file for the invoice.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `inline` | query | boolean |  | If true, returns the content as inline (disposition). If false, the content is returned as an attachment. |

Request body: `Invoice` (required)

Response: OK

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/finvoice)

## `POST /v03/api/invoices/create/{channel}`

**Saves the calculation in its current state and creates invoices to pay a salary calculation.
Note that if the calculation is already read-only, it will NOT be saved =&amp;gt; Will be fetched from storage.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes | Payment channel to use. |
| `excludePeriodicInvoices` | query | boolean |  | If true, creates and returns calculation specific invoices immediately and creates periodic invoices in the background. The default option is false, all invoices are created immediately. |

Request body: `Calculation` (required)

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/create/{channel})

## `POST /v03/api/invoices/create/{channel}/tax`

**Creates/updates a tax invoice for the period.
If there is already a read-only tax invoice in the period, throws an error.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes | Payment channel to use. |
| `month` | query | string |  | Month for the tax invoice. |

Response: `Invoice`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/create/{channel}/tax)

## `POST /v03/api/invoices/create/{channel}/union`

**Creates/updates a union invoice for the period.
If there is already a read-only union invoice in the period, throws an error.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes | Payment channel to use. |
| `month` | query | string |  | Month for the union invoice. |

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/create/{channel}/union)

## `POST /v03/api/invoices/create-by-id/{channel}`

**Creates invoices to pay a salary calculation(s) that have already been stored in the database.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes | Payment channel to use. |
| `excludePeriodicInvoices` | query | boolean |  | If true, creates and returns calculation specific invoices immediately and creates periodic invoices in the background. The default option is false, all invoices are created immediately. |

Request body: `string[]` (required)

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/create-by-id/{channel})

## `POST /v03/api/invoices/create-for-payroll/{channel}/{payrollId}`

**Creates invoices to pay a Payroll object that has already been stored in the database.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes | Payment channel to use. |
| `payrollId` | path | string | yes | Identifier for the Payroll object. |
| `excludePeriodicInvoices` | query | boolean |  | If true, creates and returns calculation specific invoices immediately and creates periodic invoices in the background. The default option is false, all invoices are created immediately. |

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/create-for-payroll/{channel}/{payrollId})

## `POST /v03/api/invoices/preview-and-created/{channel}`

**Previews invoices to pay a salary calculation(s) and fetches the ones that have already been created.
Used for payment dialog preview: Does not yet save the invoices and does not do any other storage saves.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes | Channel to which the invoices are generated. |
| `excludePeriodicInvoices` | query | boolean |  | If true, does not return periodic invoices. Only calculation specific invoices are returned. |

Request body: `CalculationCollection` (required)

Response: `InvoicePreview[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/preview-and-created/{channel})

## `POST /v03/api/invoices/{id}/status/{status}`

**Requests an update for the status of an invoice.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Id of the invoice to update. |
| `status` | path | InvoiceStatus | yes | The requested status for the invoice. |

Response: `Invoice`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/{id}/status/{status})

## `GET /v03/api/invoices/{id}/status/{status}`

**Requests an update for the status of an invoice.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Id of the invoice to update. |
| `status` | path | InvoiceStatus | yes | The requested status for the invoice. |

Response: `Invoice`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/GET/v03/api/invoices/{id}/status/{status})

## `POST /v03/api/invoices/{id}/einvoice`

**Sends the invoice as einvoice.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Invoice id for which the einvoice should be generated and sent. |
| `receiver` | query | string |  | Receiver address (eivoice) |
| `intermediator` | query | string |  | Intermediator address (einvoice) |

Response: `object`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/{id}/einvoice)

## `GET /v03/api/invoices/psd/accounts`

**List current PSD accounts for the given bank.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `bank` | query | Bank |  | Selected bank. |

Response: `Account[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/GET/v03/api/invoices/psd/accounts)

## `POST /v03/api/invoices/create/{channel}/{id}`

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes |  |
| `id` | path | string | yes |  |

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/create/{channel}/{id})

## `POST /v03/api/invoices/preview-for-payroll/{channel}/{payrollId}`

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes |  |
| `payrollId` | path | string | yes |  |

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/preview-for-payroll/{channel}/{payrollId})

## `POST /v03/api/invoices/preview/{channel}`

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes |  |

Request body: `Calculation` (required)

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/preview/{channel})

## `POST /v03/api/invoices/preview-by-id/{channel}`

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `channel` | path | PaymentChannel | yes |  |

Request body: `string[]` (required)

Response: `Invoice[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api.md#tag/invoice/POST/v03/api/invoices/preview-by-id/{channel})
