# Create

## Create Flow

<mark style="color:green;">`POST`</mark> `https://biometridon.polygon.pt/api/flows`

This endpoint allows you to create flows.

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Content-Type  | string | application/json          |
| Authorization | string | Authentication user token |

#### Request Body

| Name          | Type    | Description                                        |
| ------------- | ------- | -------------------------------------------------- |
| childFlowId   | string  | required if stepsOrdered have step type multiusers |
| name          | string  | Unique name                                        |
| stepsOrdered  | array   | List of step ids                                   |
| settingsId    | string  | Flow settings id                                   |
| clientId      | string  | Client id (Master User)                            |
| forAllClients | boolean | Availability (Master User)                         |

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

```bash
{
  "data": {
    "name": "flow 1",
    "stepsOrdered": [
      "5f06dd39a89fd30bd4671862"
    ],
    "settingsId": "5f06dd3c198040265c1fc732",
    "clientId": "5f06dd360d2a954da80c098f",
    "active": true,
    "created_at": "2020-07-10T10:51:20.599Z",
    "updated_at": "2020-07-10T10:51:20.599Z",
    "id": "5f084828ed1bb82d64ee7b44"
  },
  "meta": {
    "message": "Flow created with success."
  },
  "status": true
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
// Step not found
{
  "data": {},
  "meta": {
    "message": "Step not found",
    "code": "4001"
  },
  "status": false
}

// Flow settings not found
{
  "data": {},
  "meta": {
    "message": "Settings not found",
    "code": "4004"
  },
  "status": false
}
```

{% endtab %}

{% tab title="409 Flow settings not active" %}

```bash
{
  "data": {},
  "meta": {
    "message": "Resource not active",
    "code": "5001"
  },
  "status": false
}
```

{% endtab %}
{% endtabs %}

```javascript
// Example

{
	"name": "flow 1",
	"stepsOrdered": [
		"5f06dd39a89fd30bd4671862"
	],
	"settingsId": "5f06dd3c198040265c1fc732",
	"clientId": "5f06dd360d2a954da80c098f",
	"forAllClients": true
}
```
