# Webhook

## Create Webhook

define webhook and you can receive new muation from moota

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

## Create

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

#### Request Body

| Name                | Type   | Description                                                                                                                                    |
| ------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| url                 | string | URL of targeting your sistem for moota push data. so lets define route here                                                                    |
| bank\_account\_id   | string | Bank Account Id for refrence mutation by bank account can push with webhook. (leave blank if you want to add all bank account to this webhook) |
| kinds               | string | Kinds can filter mutation by type like `credit` `debit` or `both` for all mutation type                                                        |
| secret\_token       | string | Secret Token for generate signature security. your can identifier mutation from moota                                                          |
| start\_unique\_code | number | Start Unique Code for filter  amount mutation can push with webhook                                                                            |
| end\_unique\_code   | number | End Unique Code for filter amount mutation can push with webhook                                                                               |

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

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

{% endtab %}

{% tab title="422 " %}

```
{
  "message": "The given data was invalid.",
  "errors": {
    "bank_account_id": [
      "The selected bank account id is invalid."
    ],
    "kinds": [
      "The selected kinds is invalid."
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## Get List Webhook&#x20;

The table given below describes the `/api/v2/integration/webhook`.

## Fetch

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

#### Query Parameters

| Name              | Type   | Description                               |
| ----------------- | ------ | ----------------------------------------- |
| url               | string | URL of filter by url you have             |
| bank\_account\_id | string | Bank Account Id of filter by bank account |
| page              | string | Page of number page                       |
| per\_page         | string | Per Page of total rows                    |

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

```
{
  "current_page": 1,
  "data": [
    {
      "id": 2,
      "user_id": 1,
      "bank_account_id": "",
      "type": "all",
      "url": "http://moota.test/integrations/webhook",
      "secret_token": "H7DboYtO",
      "start_unique_code": "0",
      "end_unique_code": "999",
      "kinds": "both",
      "created_at": "2021-10-04T07:38:42.000000Z",
      "updated_at": "2021-10-04T07:38:42.000000Z",
      "token": "e42qjy2WGE5",
      "webhook_id": "e42qjy2WGE5"
    },
    {
      "id": 1,
      "user_id": 1,
      "bank_account_id": "VLagzqBj42D",
      "type": "single",
      "url": "http://moota.test/webhook",
      "secret_token": "FcZnoVBN",
      "start_unique_code": "0",
      "end_unique_code": "999",
      "kinds": "credit",
      "created_at": "2021-10-04T06:10:32.000000Z",
      "updated_at": "2021-10-04T06:10:32.000000Z",
      "token": "VLagzqBj42D",
      "webhook_id": "VLagzqBj42D"
    }
  ],
  "first_page_url": "http://moota.test/api/v2/integration/webhook?page=1",
  "from": 1,
  "last_page": 1,
  "last_page_url": "http://moota.test/api/v2/integration/webhook?page=1",
  "links": [
    {
      "url": null,
      "label": "Sebelumnya",
      "active": false
    },
    {
      "url": "http://moota.test/api/v2/integration/webhook?page=1",
      "label": "1",
      "active": true
    },
    {
      "url": null,
      "label": "Selanjutnya",
      "active": false
    }
  ],
  "next_page_url": null,
  "path": "http://moota.test/api/v2/integration/webhook",
  "per_page": 15,
  "prev_page_url": null,
  "to": 2,
  "total": 2
}
```

{% endtab %}
{% endtabs %}

## History Webhook By Moota Sending To Your Sistem

The table given below describes the `/api/v2/integration/webhook/hitory/{webhook_id}`.

## History

<mark style="color:blue;">`GET`</mark> `https://app.moota.api/api/v2/integration/webhook/hitory/{webhook_id}`

#### Path Parameters

| Name        | Type   | Description                    |
| ----------- | ------ | ------------------------------ |
| webhook\_id | string | Webhook id of refrence webhook |

#### Query Parameters

| Name      | Type   | Description            |
| --------- | ------ | ---------------------- |
| page      | string | Page of number by page |
| per\_page | string | Per Page of total rows |

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

```
```

{% endtab %}
{% endtabs %}

## Remove Webhook

The table given below describes the `/api/v2/integration/webhook/{webhook_id}`.

## Remove

<mark style="color:red;">`DELETE`</mark> `https://app.moota.app/api/v2/integration/webhook/{webhook_id}`

#### Path Parameters

| Name        | Type   | Description                      |
| ----------- | ------ | -------------------------------- |
| webhook\_id | string | Webhook Id of identified webhook |

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

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

{% endtab %}

{% tab title="404 " %}

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

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://moota.gitbook.io/technical-docs/untitled.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
