# Fortnox\FortnoxPredefinedAccountsApi



All URIs are relative to https://api.fortnox.se, except if the operation defines another base path.

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**preDefinedAccountControllerDoIndex()**](FortnoxPredefinedAccountsApi.md#preDefinedAccountControllerDoIndex) | **GET** /3/predefinedaccounts | Retrieve a list of all predefined accounts |
| [**preDefinedAccountControllerDoShow()**](FortnoxPredefinedAccountsApi.md#preDefinedAccountControllerDoShow) | **GET** /3/predefinedaccounts/{name} | Retrieve information for a specific account type |
| [**preDefinedAccountControllerDoUpdate()**](FortnoxPredefinedAccountsApi.md#preDefinedAccountControllerDoUpdate) | **PUT** /3/predefinedaccounts/{name} | Update a Predefined Account |


## `preDefinedAccountControllerDoIndex()`

```php
preDefinedAccountControllerDoIndex(): \Fortnox\Model\FortnoxPreDefinedAccountListItemWrap
```

Retrieve a list of all predefined accounts

Get pre defined accounts

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxPredefinedAccountsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->preDefinedAccountControllerDoIndex();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxPredefinedAccountsApi->preDefinedAccountControllerDoIndex: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

This endpoint does not need any parameter.

### Return type

[**\Fortnox\Model\FortnoxPreDefinedAccountListItemWrap**](../Model/FortnoxPreDefinedAccountListItemWrap.md)

### Authorization

No authorization required

### HTTP request headers

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

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `preDefinedAccountControllerDoShow()`

```php
preDefinedAccountControllerDoShow($name): \Fortnox\Model\FortnoxPreDefinedAccountSingleItemWrap
```

Retrieve information for a specific account type

Retrieve a pre defined account

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxPredefinedAccountsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$name = 'name_example'; // string | identifies the predefined account

try {
    $result = $apiInstance->preDefinedAccountControllerDoShow($name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxPredefinedAccountsApi->preDefinedAccountControllerDoShow: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **name** | **string**| identifies the predefined account | |

### Return type

[**\Fortnox\Model\FortnoxPreDefinedAccountSingleItemWrap**](../Model/FortnoxPreDefinedAccountSingleItemWrap.md)

### Authorization

No authorization required

### HTTP request headers

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

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `preDefinedAccountControllerDoUpdate()`

```php
preDefinedAccountControllerDoUpdate($name, $predefined_account): \Fortnox\Model\FortnoxPreDefinedAccountSingleItemWrap
```

Update a Predefined Account

An endpoint for updating a Predefined Account. Predefined Accounts are identified by their <em>name</em>-field, and as such must be unique.  Some Predefined Accounts distinguish between Goods and Services.  In this case, the former retains the original name whereas the latter ends with a 2. Such as <em>SALES</em> and <em>SALES2</em>.  Accounts are chosen from the Account Registry, and if you have EasyVat enabled then the new EasyVat Predefined Accounts (<em>SALES_25_SE</em>, etc.) have certain restrictions on the accounts that can be selected.  Refer to the table below.   <table>      <caption>Account restrictions when EasyVat has been enabled.</caption>      <tr>          <th>Name</th>          <th>VAT Code</th>          <th>Restrictions</th>      </tr>      <tr>          <td>SALES_25_SE</td>          <td>MP1</td>          <td>Must have a compatible VAT Code.</td>      </tr>      <tr>          <td>SALES_12_SE</td>          <td>MP2</td>          <td>Must have a compatible VAT Code.</td>      </tr>      <tr>          <td>SALES_6_SE</td>          <td>MP3</td>          <td>Must have a compatible VAT Code.</td>      </tr>      <tr>          <td>SALES_0_SE</td>          <td>MF</td>          <td>Must have a compatible VAT Code.</td>      </tr>  </table>   This endpoint can produce errors, some of which may only be relevant for EasyVat. Refer to the table below.  <table>      <caption>Errors that can be raised by this endpoint.</caption>      <tr>          <th>Error Code</th>          <th>HTTP Code</th>          <th>Description</th>          <th>Solution</th>      </tr>      <tr>          <td>2001265</td>          <td>400</td>          <td>The provided account is invalid. It either has not been provided, does not exist, or is inactive.</td>          <td>Verify that an account has been provided and that it exists and is active.</td>      </tr>      <tr>          <td>2002462</td>          <td>400</td>          <td>The account is not in a valid format.</td>          <td>Verify that the format of the account is correct. It has to consist of 4 digits.</td>      </tr>      <tr>          <td>2000729</td>          <td>400</td>          <td>A Predefined Account has not been provided.</td>          <td>Verify that a valid Predefined Account has been provided as a PATH-parameter.</td>      </tr>      <tr>          <td>2004052</td>          <td>400</td>          <td>The provided account has an incompatible VAT Code. Only applies if EasyVat has been enabled.</td>          <td>Verify that the provided account has a VAT Code that is compatible with the selected Predefined Account. Refer to the table above for more information about compatibility.</td>      </tr>  </table>   If you have activated EasyVat, you can read more about how to use the new Predefined Accounts with your documents in their respective api documentation.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxPredefinedAccountsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$name = 'name_example'; // string | identifies the predefined account
$predefined_account = new \Fortnox\Model\FortnoxPreDefinedAccountSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxPreDefinedAccountSinglePayloadItemWrap | Request body for update pre defined account

try {
    $result = $apiInstance->preDefinedAccountControllerDoUpdate($name, $predefined_account);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxPredefinedAccountsApi->preDefinedAccountControllerDoUpdate: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **name** | **string**| identifies the predefined account | |
| **predefined_account** | [**\Fortnox\Model\FortnoxPreDefinedAccountSinglePayloadItemWrap**](../Model/FortnoxPreDefinedAccountSinglePayloadItemWrap.md)| Request body for update pre defined account | [optional] |

### Return type

[**\Fortnox\Model\FortnoxPreDefinedAccountSingleItemWrap**](../Model/FortnoxPreDefinedAccountSingleItemWrap.md)

### Authorization

No authorization required

### HTTP request headers

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

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
