# Employment

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

Employment relations between employers and workers. This is the primary method for Employers to manage their workers.

Salaxy API v04 (beta), **Finland only**. 9 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/employments`

**Performs an OData query to the employment relations in search index.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `$search` | query | string |  |  |
| `activeDate` | query | string |  | Provides a helper for filtering only active employment relations. You can provide an ISO date (yyyy-mm-dd) to list only employments that are active on a specific date. Set to "today" for today's date. Default "all" lists all employments: active and passive. |
| `$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: `PageResultOfEmploymentListItem`

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

## `POST /v04/api/employments`

**Adds or Updates an employment relation this Employer has created (Owned by this employer).
Workers cannot update employment relations.**

Request body: `Employment` (required)

Response: `Employment`

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

## `GET /v04/api/employments/{id}`

**Gets a single object based on identier**

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

Response: `Employment`

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

## `DELETE /v04/api/employments/{id}`

**Deletes a worker account that this Employer has created (Owned by this employer).
The methods looks for the WorkerAccount, deletes it and also deletes all the employment relations, taxcards, holidays and absences.
This method will fail if there are any calculations (paid or draft in WorkerAccount) or if the person is the contact person for the current company.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Identifier of the worker account that will be deleted. |

Response: `string`

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

## `POST /v04/api/employments/{id}/pay-stats/recalculate`

**Recalculates pay statistics for the given employment relation.**

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

Response: `Employment`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/employment/POST/v04/api/employments/{id}/pay-stats/recalculate)

## `POST /v04/api/employments/pay-stats/recalculate`

**Recalculates pay statistics for all employment relations of the current employer.**

Response: `boolean`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/employment/POST/v04/api/employments/pay-stats/recalculate)

## `GET /v04/api/employments/active`

**Gets all the active employment relations (the full payload).**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `date` | query | string |  | Date for which the employment relation should be active. Defaults to today. |

Response: `Employment[]`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/employment/GET/v04/api/employments/active)

## `GET /v04/api/employments/employing`

**Performs an OData query to the employment relations for the current user (Worker).
Worker can list and search all employers which have employed the worker.**

Response: `PageResultOfEmploymentListItem`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/employment/GET/v04/api/employments/employing)

## `GET /v04/api/employments/employing/{id}`

**Returns employer public employment profile for the employed Worker.**

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | Id@owner for the employment. |

Response: `EmployingRelation`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/employment/GET/v04/api/employments/employing/{id})
