> For the complete documentation index, see [llms.txt](https://docs.insurehero.io/shield-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.insurehero.io/shield-api/claims/workflows-management.md).

# Workflows Management

***

This page will introduce you to **workflows**. But what do we mean by workflows? **Workflows** are the sequences of steps that certain claims go through. In other words, the process doesn't end once a claim is created. There are specific steps that must be completed.

Let's consider an example: suppose there is a theft claim. The first step is to create the claim, but then two things need to be validated—a police report confirming the theft occurred and the amount to be covered. These aspects can't be verified at the time of creating the claim because you don't have the theft report, and without it, we can't validate what will be covered.

Therefore, the claim enters a system of steps where the necessary information can be requested to fulfill the requirements, allowing for much more granular and asynchronous management of each case. This may involve agents and communication with third parties. This documentation will guide you on how to integrate **workflows**, always keeping in mind that this process takes place after the claim has been created.

## Endpoints

<table><thead><tr><th width="113">Method</th><th>Endpoint</th></tr></thead><tbody><tr><td><mark style="color:green;">POST</mark></td><td><a href="#post-a-step"><code>https://api.insurehero.io/api/shield/v1/users/:userId</code></a></td></tr><tr><td><mark style="color:blue;">GET</mark></td><td><a href="#get-step-information"><code>https://api.insurehero.io/api/shield/v1/claims/:claimId/workflow</code></a></td></tr></tbody></table>

## How to interact with a workflow

To interact with a **workflow**, it's necessary to know the **claim ID**. Therefore, we recommend understanding how **claim gets** work.

### Post a step

{% tabs %}
{% tab title="v1" %} <mark style="color:green;">`POST`</mark> `https://app.insurehero.io/api/shield/v1/claims/:claimId/workflow`
{% endtab %}

{% tab title="v2" %} <mark style="color:green;">`POST`</mark> `https://app.insurehero.io/api/shield/v2/claims`
{% endtab %}
{% endtabs %}

#### Headers

| Name                                                 | Type   | Description                                                                                          |
| ---------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark>      | string | Bearer access token                                                                                  |
| User-Authorization<mark style="color:red;">\*</mark> | string | [User unique token to create claims](https://docs.insurehero.io/shield-api/policies/user-management) |

#### Request Body

This endpoint support raw and form-data depending upon the kind of requirement of the step. To know more about what kind of data you can send use the get workflow endpoint.

{% tabs %}
{% tab title="raw" %}

| Name                                                  | Type   | Description                                |
| ----------------------------------------------------- | ------ | ------------------------------------------ |
| WorkflowStepRequest<mark style="color:red;">\*</mark> | object | The coverage variant chosen for this claim |
| {% endtab %}                                          |        |                                            |

{% tab title="form-data" %}

| Key                                    | Value | Description                                                   |
| -------------------------------------- | ----- | ------------------------------------------------------------- |
| file<mark style="color:red;">\*</mark> | File  | All files must have "file" as key to be processed succesfully |
| {% endtab %}                           |       |                                                               |
| {% endtabs %}                          |       |                                                               |

**Types of responses**

{% tabs %}
{% tab title="201: Created Created successfully" %}

{% endtab %}

{% tab title="400: Bad Request Request contains malformed data" %}

{% endtab %}

{% tab title="401: Unauthorized Invalid or expired access token" %}

{% endtab %}

{% tab title="402: Payment Required Pending payment" %}

```json
{
    "error": "Internal validation failed",
    "details": "This workflow is already completed."
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Internal validation failed" %}

```json
{
    "error": "Internal validation failed",
    "details": "This workflow is already completed."
}
```

{% endtab %}

{% tab title="429: Too Many Requests API rate limit" %}

{% endtab %}
{% endtabs %}

### Get step information

Fetch the information needed to pass the step

<mark style="color:blue;">`GET`</mark> `https://api.insurehero.io/api/shield/v1/claims/:claimId/workflow`

#### Path Parameters

| Name                                      | Type   | Description            |
| ----------------------------------------- | ------ | ---------------------- |
| claimId<mark style="color:red;">\*</mark> | string | Either user\_id or uid |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200: OK Retrieved successfully" %}

```json
{
    "data": {
        "id": "c7bc72aa-6d0a-4958-ad09-50bd4fc9c232",
        "current_step": "step_2",
        "workflow": {
            "step_2": {
                "name": "EXAMPLE 1: Receive the form - .png",
                "inbound": {
                    "undefined": {
                        "type": "file",
                        "typeOfFile": ".png"
                    }
                }
            }
        }
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Request contains malformed data" %}

{% endtab %}

{% tab title="401: Unauthorized Invalid or expired access token" %}

{% endtab %}

{% tab title="402: Payment Required Pending payment" %}

{% endtab %}

{% tab title="422: Unprocessable Entity Internal validation failed" %}

{% endtab %}

{% tab title="429: Too Many Requests API rate limit" %}

{% endtab %}

{% tab title="404: Not Found User not found" %}

{% endtab %}
{% endtabs %}

#### Attributes

| Name          | Type   | Description (English)                            |
| ------------- | ------ | ------------------------------------------------ |
| data          | object | Contains the workflow data.                      |
| id            | uuid   | Unique identifier of the workflow instance.      |
| current\_step | string | Indicates the current step in the workflow.      |
| workflow      | object | Defines the steps and their configurations.      |
| step\_2       | object | Represents a specific step within the workflow.  |
| name          | string | Name of the step.                                |
| inbound       | object | Defines the expected input requirements.         |
| undefined     | object | Contains details about required files or inputs. |
| type          | string | Specifies the input type (e.g., file).           |
| typeOfFile    | string | Specifies the expected file type (e.g., .png).   |
