# Fortnox\FortnoxAccountsApi



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

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**accountControllerDoCreate()**](FortnoxAccountsApi.md#accountControllerDoCreate) | **POST** /3/accounts | Create an account |
| [**accountControllerDoDelete()**](FortnoxAccountsApi.md#accountControllerDoDelete) | **DELETE** /3/accounts/{Number} | Deletes an account |
| [**accountControllerDoIndex()**](FortnoxAccountsApi.md#accountControllerDoIndex) | **GET** /3/accounts | List all accounts |
| [**accountControllerDoShow()**](FortnoxAccountsApi.md#accountControllerDoShow) | **GET** /3/accounts/{Number} | Retrieve an account |
| [**accountControllerDoUpdate()**](FortnoxAccountsApi.md#accountControllerDoUpdate) | **PUT** /3/accounts/{Number} | Update an account |


## `accountControllerDoCreate()`

```php
accountControllerDoCreate($financialyear, $account_payload): \Fortnox\Model\FortnoxBfAccountSingleItemWrap
```

Create an account

The created account will be returned if everything succeeded, if there were any problems an error will be returned.

### Example

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



$apiInstance = new Fortnox\Api\FortnoxAccountsApi(
    // 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()
);
$financialyear = 56; // int | financial year to create account against
$account_payload = new \Fortnox\Model\FortnoxBfAccountSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxBfAccountSinglePayloadItemWrap | Request body for create account

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

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **financialyear** | **int**| financial year to create account against | [optional] |
| **account_payload** | [**\Fortnox\Model\FortnoxBfAccountSinglePayloadItemWrap**](../Model/FortnoxBfAccountSinglePayloadItemWrap.md)| Request body for create account | [optional] |

### Return type

[**\Fortnox\Model\FortnoxBfAccountSingleItemWrap**](../Model/FortnoxBfAccountSingleItemWrap.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)

## `accountControllerDoDelete()`

```php
accountControllerDoDelete($number)
```

Deletes an account

Deletes the specified account in the users current year

### Example

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



$apiInstance = new Fortnox\Api\FortnoxAccountsApi(
    // 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()
);
$number = 56; // int | account to delete

try {
    $apiInstance->accountControllerDoDelete($number);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxAccountsApi->accountControllerDoDelete: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **number** | **int**| account to delete | |

### Return type

void (empty response body)

### 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)

## `accountControllerDoIndex()`

```php
accountControllerDoIndex($sortby, $lastmodified, $sru): \Fortnox\Model\FortnoxBfAccountListItemWrap
```

List all accounts

The accounts are returned sorted by account number with the lowest number appearing first.

### Example

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



$apiInstance = new Fortnox\Api\FortnoxAccountsApi(
    // 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()
);
$sortby = 'sortby_example'; // string | field to sort returned list on
$lastmodified = 'lastmodified_example'; // string | Lastmodified of accounts to list
$sru = 56; // int | Sru of accounts to list

try {
    $result = $apiInstance->accountControllerDoIndex($sortby, $lastmodified, $sru);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxAccountsApi->accountControllerDoIndex: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **sortby** | **string**| field to sort returned list on | [optional] |
| **lastmodified** | **string**| Lastmodified of accounts to list | [optional] |
| **sru** | **int**| Sru of accounts to list | [optional] |

### Return type

[**\Fortnox\Model\FortnoxBfAccountListItemWrap**](../Model/FortnoxBfAccountListItemWrap.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)

## `accountControllerDoShow()`

```php
accountControllerDoShow($number): \Fortnox\Model\FortnoxBfAccountSingleItemWrap
```

Retrieve an account

Retrieves the details of an account. You need to supply the unique account number that was returned when the account was created or retrieved from the list of accounts.

### Example

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



$apiInstance = new Fortnox\Api\FortnoxAccountsApi(
    // 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()
);
$number = 56; // int | identifies the account

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

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **number** | **int**| identifies the account | |

### Return type

[**\Fortnox\Model\FortnoxBfAccountSingleItemWrap**](../Model/FortnoxBfAccountSingleItemWrap.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)

## `accountControllerDoUpdate()`

```php
accountControllerDoUpdate($number, $financialyear, $account_payload): \Fortnox\Model\FortnoxBfAccountSingleItemWrap
```

Update an account

Updates the specified account with the values provided in the properties. Any property not provided will be left unchanged.  Note that even though the account number is writeable you can&acute;t change the number of an existing account.

### Example

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



$apiInstance = new Fortnox\Api\FortnoxAccountsApi(
    // 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()
);
$number = 56; // int | identifies the account
$financialyear = 56; // int | financial year to update account against
$account_payload = new \Fortnox\Model\FortnoxBfAccountSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxBfAccountSinglePayloadItemWrap | Request body for update account

try {
    $result = $apiInstance->accountControllerDoUpdate($number, $financialyear, $account_payload);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxAccountsApi->accountControllerDoUpdate: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **number** | **int**| identifies the account | |
| **financialyear** | **int**| financial year to update account against | [optional] |
| **account_payload** | [**\Fortnox\Model\FortnoxBfAccountSinglePayloadItemWrap**](../Model/FortnoxBfAccountSinglePayloadItemWrap.md)| Request body for update account | [optional] |

### Return type

[**\Fortnox\Model\FortnoxBfAccountSingleItemWrap**](../Model/FortnoxBfAccountSingleItemWrap.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)
