# Mutation

## Get List Mutation

The table given below describes the `/api/v2/mutation`.

## Get Mutation

<mark style="color:blue;">`GET`</mark> `https://app.moota.co/api/v2/mutation`

#### Query Parameters

| Name        | Type   | Description                                                                   |
| ----------- | ------ | ----------------------------------------------------------------------------- |
| type        | string | Type of type mutation example value `CR` \<credit> and `DB` \<debit>          |
| bank        | string | Bank of bank id you account can selected                                      |
| amount      | string | Amount of selected by amount can show it                                      |
| note        | string | Note of selected can show you want                                            |
| start\_date | string | Start Date of selected by date ranges start end mutation date                 |
| end\_date   | string | End Date of selected by date ranges start end mutation date                   |
| tag         | string | Tag of selected by your tag example tag\_name, tag\_name with separator comma |
| page        | string | Page can show data start from page number to ...                              |
| per\_page   | string | Per Page can show total rows                                                  |

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

```
{
  "current_page": 1,
  "data": [
    {
      "account_number": "235264741",
      "date": "2021-10-05 00:00:00",
      "description": "buy other food",
      "amount": "100123.00",
      "type": "CR",
      "note": "",
      "balance": "0.00",
      "created_at": "2021-10-05 10:25:16",
      "updated_at": "2021-10-05 10:25:16",
      "mutation_id": "aolk4PekJxM",
      "token": "aolk4PekJxM",
      "bank_id": "VLagzqBj42D",
      "taggings": [],
      "bank": {
        "corporate_id": null,
        "username": "moota.co",
        "atas_nama": "Moota",
        "balance": "100123.00",
        "account_number": "235264741",
        "bank_type": "bca",
        "login_retry": 0,
        "date_from": "2021-09-24 00:00:00",
        "date_to": "2021-09-24 00:00:00",
        "meta": null,
        "interval_refresh": 15,
        "next_queue": "2021-09-24 11:16:57",
        "is_active": true,
        "in_queue": 0,
        "in_progress": 0,
        "recurred_at": "2021-09-25 11:01:57",
        "created_at": "2021-09-24 11:01:57",
        "token": "VLagzqBj42D",
        "bank_id": "VLagzqBj42D",
        "label": "BCA",
        "last_update": "2021-09-24T03:46:57.000000Z"
      }
    },
    {
      "account_number": "7650583974",
      "date": "2021-09-24 00:00:00",
      "description": "quaerat",
      "amount": "133041.00",
      "type": "DB",
      "note": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley ",
      "balance": "0.00",
      "created_at": "2021-09-24 11:01:57",
      "updated_at": "2021-09-24 11:01:57",
      "mutation_id": "8aolk43WJxM",
      "token": "8aolk43WJxM",
      "bank_id": "e42qjy2WGE5",
      "taggings": [
        {
          "name": "car",
          "tag_id": "M1Z6zK0jJDY"
        }
      ],
      "bank": {
        "corporate_id": null,
        "username": "moota.co",
        "atas_nama": "Moota",
        "balance": "126987.00",
        "account_number": "0144050",
        "bank_type": "mandiriBisnis",
        "login_retry": 0,
        "date_from": "2021-09-24 00:00:00",
        "date_to": "2021-09-24 00:00:00",
        "meta": null,
        "interval_refresh": 15,
        "next_queue": "2021-09-24 11:16:57",
        "is_active": true,
        "in_queue": 0,
        "in_progress": 0,
        "recurred_at": "2021-09-25 11:01:57",
        "created_at": "2021-09-24 11:01:57",
        "token": "e42qjy2WGE5",
        "bank_id": "e42qjy2WGE5",
        "label": "Mandiri Bisnis",
        "last_update": "2021-09-24T03:46:57.000000Z"
      }
    }
  ],
  "first_page_url": "https://app.moota.co/api/v2/mutation?page=1",
  "from": 1,
  "last_page": 50,
  "last_page_url": "https://app.moota.co/api/v2/mutation?page=50",
  "links": [
    {
      "url": null,
      "label": "Sebelumnya",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=1",
      "label": "1",
      "active": true
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=2",
      "label": "2",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=3",
      "label": "3",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=4",
      "label": "4",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=5",
      "label": "5",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=6",
      "label": "6",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=7",
      "label": "7",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=8",
      "label": "8",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=9",
      "label": "9",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=10",
      "label": "10",
      "active": false
    },
    {
      "url": null,
      "label": "...",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=49",
      "label": "49",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=50",
      "label": "50",
      "active": false
    },
    {
      "url": "https://app.moota.co/api/v2/mutation?page=2",
      "label": "Selanjutnya",
      "active": false
    }
  ],
  "next_page_url": "https://app.moota.co/api/v2/mutation?page=2",
  "path": "https://app.moota.co/api/v2/mutation",
  "per_page": "2",
  "prev_page_url": null,
  "to": 2,
  "total": 100
}
```

{% endtab %}
{% endtabs %}

## Create Dummy Mutation

you can create test with dummy mutation for you bank account

The table given below describes the `/api/v2/mutation/store/{bank_id}`.

Use this API to update an existing beneficiary identified by its `bank_id`.

## Store Mutation

<mark style="color:green;">`POST`</mark> `https://app.moota/co/api/v2/mutation/store/{bank_id}`

#### Path Parameters

| Name     | Type   | Description                                          |
| -------- | ------ | ---------------------------------------------------- |
| bank\_id | string | Bank Id identified target mutation from bank account |

#### Request Body

| Name   | Type   | Description                                                       |
| ------ | ------ | ----------------------------------------------------------------- |
| date   | string | Date of value for mutation                                        |
| note   | string | Note of value for mutation                                        |
| amount | string | Amount of value total amount dumy                                 |
| type   | string | Type of value for mutation like `CR` \<credit>  and `DB` \<debit> |

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

```
{
  "error": false,
  "mutation": {
    "total": 1,
    "new": 1
  }
}
```

{% endtab %}

{% tab title="422 " %}

```
{
  "message": "The given data was invalid.",
  "errors": {
    "date": [
      "The date does not match the format Y-m-d."
    ],
    "type": [
      "The selected type is invalid."
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## Add Note To Mutation

The table given below describes the `/api/v2/mutation/{mutation_id}/note`.

Use this API to update an existing beneficiary identified by its `mutation_id`.

## Add Note Mutation

<mark style="color:green;">`POST`</mark> `https://app.moota.co/api/v2/mutation/{mutation_id}/note`

#### Path Parameters

| Name         | Type   | Description                                            |
| ------------ | ------ | ------------------------------------------------------ |
| mutation\_id | string | Mutation Id of identified mutation target can add note |

#### Request Body

| Name | Type   | Description                 |
| ---- | ------ | --------------------------- |
| note | string | Note of value mutation note |

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

```
{
  "message": "OK",
}
```

{% endtab %}

{% tab title="404 " %}

```
{
  "message": "Data not found"
}
```

{% endtab %}
{% endtabs %}

## Push Mutation With Webhook

Moota can re try push webhook by request with this endpoint `/api/v2/mutation/{mutation_id}/webhook`.

Use this API to update an existing beneficiary identified by its `mutation_id`.

## Push Mutation&#x20;

<mark style="color:green;">`POST`</mark> `https://app.moota.co/api/v2/mutation/{mutation_id}/webhook`

#### Path Parameters

| Name         | Type   | Description                                              |
| ------------ | ------ | -------------------------------------------------------- |
| mutation\_id | string | Mutation Id of identified mutation can push with webhook |

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

```
{
  "message": "OK",
}
```

{% endtab %}

{% tab title="404 " %}

```
{
  "message": "Data not found"
}
```

{% endtab %}
{% endtabs %}

## Remove Mutation

The table given below describes the `/api/v2/mutation/destroy`.

## Remove

<mark style="color:green;">`POST`</mark> `https://api.moota.co/api/v2/mutation/destroy`

#### Request Body

| Name      | Type  | Description                    |
| --------- | ----- | ------------------------------ |
| mutations | array | Mutations of array mutation id |

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

```
{
  "message": "OK"
}
```

{% endtab %}

{% tab title="422 " %}

```
{
  "message": "The given data was invalid.",
  "errors": {
    "mutations": [
      "The mutations must be an array."
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## Attach Tagging To Mutation

The table given below describes the `/api/v2/tagging/mutation/{mutation_id}`.

## Attach Tagging

<mark style="color:green;">`POST`</mark> `https://app.moota.co/api/v2/tagging/mutation/{mutation_id}`

#### Path Parameters

| Name         | Type   | Description                               |
| ------------ | ------ | ----------------------------------------- |
| mutation\_id | string | Mutation Id of identified target mutation |

#### Request Body

| Name | Type  | Description                |
| ---- | ----- | -------------------------- |
| name | array | Name of array tagging name |

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

```
{
  "message": "Tag berhasil ditambahkan ke mutasi"
}
```

{% endtab %}

{% tab title="422 " %}

```
{
  "message": "User tidak memiliki tag ini"
}
```

{% endtab %}
{% endtabs %}

## Update Tagging From Mutation

The table given below describes the `/api/v2/tagging/mutation/mutation_id}.`

## Update Tagging Mutation

<mark style="color:orange;">`PUT`</mark> `https://app.moota.co/api/v2/tagging/mutation/{mutation_id}`

#### Path Parameters

| Name         | Type   | Description                                                              |
| ------------ | ------ | ------------------------------------------------------------------------ |
| mutation\_id | string | Mutation Id of identified mutation can update tagging name from mutation |

#### Request Body

| Name | Type  | Description                                                  |
| ---- | ----- | ------------------------------------------------------------ |
| name | array | Name of array tagging value for update tagging from mutation |

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

```
{
  "message": "Tag berhasil diupdate ke mutasi"
}
```

{% endtab %}

{% tab title="422 " %}

```
{
  "message": "User tidak memiliki tag ini"
}
```

{% endtab %}
{% endtabs %}

## Detach Tagging From Mutation

The table given below describes the `/api/v2/tagging/mutation/{mutation_id}.`

## Detach Tagging Mutation

<mark style="color:red;">`DELETE`</mark> `https://app.moota.co/api/tagging/mutation/{mutation_id}`

#### Path Parameters

| Name         | Type   | Description                                                       |
| ------------ | ------ | ----------------------------------------------------------------- |
| mutation\_id | string | Mutation Id of identified target mutation can remove tagging name |

#### Request Body

| Name | Type  | Description                                    |
| ---- | ----- | ---------------------------------------------- |
| name | array | Name of array tagging can remove from mutation |

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

```
{
  "message": "Tag berhasil dihapus dari mutasi"
}
```

{% endtab %}

{% tab title="422 " %}

```
{
  "message": "User tidak memiliki tag ini"
}
```

{% endtab %}
{% endtabs %}
