# Workflow

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

Functionality to add and change workflow events for all the API objects that support workflows.

Salaxy API v04 (beta), **Finland only**. 4 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/{apiType}/{id}/workflows`

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

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `apiType` | path | string | yes | API type for the object: calculations, payroll, workers |
| `id` | path | string | yes | Unique identifier for the API object |

Response: `WorkflowData`

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

## `POST /v04/api/{apiType}/{id}/workflows`

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

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `apiType` | path | string | yes | API type for the object: calculations, payroll, workers |
| `id` | path | string | yes | Unique identifier for the API object |

Request body: `WorkflowEvent` (required)

Response: `WorkflowData`

Try it: [interactive reference](https://code.salaxy.com/reference/rest-api-v04.md#tag/workflow/POST/v04/api/{apiType}/{id}/workflows)

## `GET /v04/api/{apiType}/{id}/workflows/events/{eventId}`

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

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `apiType` | path | string | yes | API type for the object: calculations, payroll, workers |
| `id` | path | string | yes | Unique identifier for the API object |
| `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/workflow/GET/v04/api/{apiType}/{id}/workflows/events/{eventId})

## `DELETE /v04/api/{apiType}/{id}/workflows/{eventIdOrType}`

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

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `apiType` | path | string | yes | API type for the object: calculations, payroll, workers |
| `id` | path | string | yes | Unique identifier for the API object |
| `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/workflow/DELETE/v04/api/{apiType}/{id}/workflows/{eventIdOrType})
