# Account

**Beta:**
Salaxy API v04 is in beta: it may change, and it is not used in production yet. Build on v03, the current version.

Read and update access to Palkkaus-account: Person or Company accounts that are currently in use as well as Worker Accounts that are created under this account.

Salaxy API v04 (beta), **Finland only**. 24 operations. Interactive version: [REST API reference](https://code.salaxy.com/reference/rest-api-v04.md). Machine-readable: [OpenAPI document](https://code.salaxy.com/openapi/salaxy-04.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 /v04/api/accounts/company`

**Gets the current company account if the current account is a company**

Response: `CompanyAccount`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/company)

## `POST /v04/api/accounts/company`

**Saves the company account.**

Request body: `CompanyAccount` (required)

Response: `CompanyAccount`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/company)

## `GET /v04/api/accounts/person`

**Gets the current Person account: Either the current account or the Primary contact person account if the current account is a company.**

Response: `PersonAccount`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/person)

## `POST /v04/api/accounts/person`

**Saves the person account.**

Request body: `PersonAccount` (required)

Response: `PersonAccount`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/person)

## `POST /v04/api/accounts/avatar`

**Saves the avatar file for the account, does not save the account and avatar.**

Request body: `object` (required)

Response: `Avatar`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/avatar)

## `POST /v04/api/accounts/switchRole`

**Switches the role of the current user between
Worker and Household**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `role` | query | WebSiteUserRole |  | The user role |

Response: `WebSiteUserRole`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/switchRole)

## `POST /v04/api/accounts/certificate`

**Issues a new X.509 certificate for the account in PFX (PKCS12) format for Microsoft / Windows systems.**

Request body: `Certificate` (required)

Response: `Certificate`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/certificate)

## `GET /v04/api/accounts/certificate`

**Lists existing X.509 certificates for the account.**

Response: `Certificate[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/certificate)

## `POST /v04/api/accounts/certificate/pem`

**Issues a new certificate for the account and provides the certificate in PEM format.
For this method, also the Certificate Signing Request (CSR) may be passed in the certificate Text field.**

Request body: `Certificate` (required)

Response: `IssuedCertificate`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/certificate/pem)

## `DELETE /v04/api/accounts/certificate/{id}`

**Revokes existing X.509 certificate from the account.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Certificate (thumbprint) to revoke. |

Response: `string`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/DELETE/v04/api/accounts/certificate/{id})

## `GET /v04/api/accounts/authorizingAccount`

**Lists all accounts on behalf of which this account has been authorized to act.**

Response: `AccountBase[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/authorizingAccount)

## `DELETE /v04/api/accounts/authorizingAccount/{id}`

**Deletes the account. Restricted to the test system only.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Id of the account which should be deleted. |

Response: `string`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/DELETE/v04/api/accounts/authorizingAccount/{id})

## `GET /v04/api/accounts/authorizedAccount`

**Lists all accounts to which this account has given authorizations.**

Response: `AuthorizedAvatar[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/authorizedAccount)

## `POST /v04/api/accounts/authorizedAccount`

**Allow an account to act on behalf of this account.**

Request body: `AuthorizedAvatar` (required)

Response: `AuthorizedAvatar`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/authorizedAccount)

## `DELETE /v04/api/accounts/authorizedAccount/{id}`

**Disallow an account to act on behalf of this account.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Account who is no more authorized to act on behalf of this account. |

Response: `string`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/DELETE/v04/api/accounts/authorizedAccount/{id})

## `GET /v04/api/accounts/credential`

**Lists all credentials which can access to this account.**

Response: `SessionUserCredential[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/credential)

## `POST /v04/api/accounts/credential`

**Updates the credential.**

Request body: `SessionUserCredential` (required)

Response: `SessionUserCredential`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/credential)

## `DELETE /v04/api/accounts/credential/{id}`

**Remove the credential linked to the account.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Credential (id) to remove. |

Response: `string`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/DELETE/v04/api/accounts/credential/{id})

## `POST /v04/api/accounts/credential/{id}/avatar`

**Changes the avatar file for the credential, does not save the credential. It requires a separate save.**

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

Request body: `object` (required)

Response: `SessionUserCredential`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/credential/{id}/avatar)

## `POST /v04/api/accounts/credential/avatar`

**Changes the avatar file for the credential, does not save the credential. It requires a separate save.**

Request body: `object` (required)

Response: `SessionUserCredential`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/credential/avatar)

## `GET /v04/api/accounts/workflows`

**Returns workflow data for the given API object.**

Response: `WorkflowData`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/workflows)

## `POST /v04/api/accounts/workflows`

**Adds or updates workflow event for the given API object.**

Request body: `WorkflowEvent` (required)

Response: `WorkflowData`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/POST/v04/api/accounts/workflows)

## `GET /v04/api/accounts/workflows/events/{eventId}`

**Returns workflow event for the given API object and event id.**

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

Response: `WorkflowEvent`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/GET/v04/api/accounts/workflows/events/{eventId})

## `DELETE /v04/api/accounts/workflows/{eventIdOrType}`

**Deletes the workflow event from the given API object.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `eventIdOrType` | path | string | yes | Id or type of the event to delete. |

Response: `string`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/account/DELETE/v04/api/accounts/workflows/{eventIdOrType})
