> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argyle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payouts Webhooks

> Learn about payouts webhooks.

There are two types of payout webhook events:

* Webhooks that trigger only during the initial scan when a new account is connected: `payouts.fully_synced` and `payouts.partially_synced`. They will trigger once per invocation for each added account.
* Webhooks that trigger later on, when new payouts are added in the future: `payouts.added` and `payouts.updated`. They will only trigger during a periodic scan for accounts that are already connected and have been fully synced, and only after the `payouts.fully_synced` webhook has been triggered.

A typical account can contain thousands of payouts and the `payouts.fully_synced` webhook will only fire after all of the payouts are scanned, which in some cases might take hours. Therefore, the `payouts.partially_synced` webhook can be used if only a partial range of the payouts is needed. For example, a history of the last 30 days instead of a complete history of payouts. This will reduce the sync time to minutes or, in some cases, seconds.

For more information about initial and periodic scans, with specific examples for using payout webhook events, please check the [Data Retrieval Guide](/legacy/api-reference/data-retrieval).

## Fully synced

**POST** `/v1/webhooks`

Implement the `payouts.fully_synced` webhook to know when all payouts are fully scanned.

* The `payouts.fully_synced` webhook triggers when all payouts are fully scanned. Scanning starts from the most recent payouts and finishes with the oldest ones.

<Note>
  This webhook only triggers when the initial scan finishes. It is not invoked during periodic scanning.
</Note>

### Request body

<Note>
  ### Webhook message

  * `name` (string, optional): Name used for the webhook subscription.
  * `data` (object, optional)
  * `account` (string (uuid), optional): ID of the account.
  * `user` (string (uuid), optional): ID of the user.
  * `available_to` (string (timestamp), optional): The date of the most recent available payout.
  * `available_count` (integer, optional): The total number of payouts associated with the account at the moment the webhook call is made.
</Note>

<Tabs>
  <Tab title="curl">
    ```bash theme={}
    curl --request POST \\
    --url https://api.argyle.com/v1/webhooks \\
    --header 'accept: application/json' \\
    --header 'content-type: application/json' \\
    --data '{
    "events": ["payouts.fully_synced"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret"
    }'
    ```
  </Tab>

  <Tab title="python">
    ```python theme={}
    import requests
    url = "https://api.argyle.com/v1/webhooks"
    payload = {
    "events": ["payouts.fully_synced"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret"
    }
    headers = {
    "accept": "application/json",
    "content-type": "application/json"
    }
    response = requests.post(url, json=payload, headers=headers)
    ```
  </Tab>
</Tabs>

```json theme={}

{
"event": "payouts.fully_synced",
"name": "All historical data synced",
"data": {
"account": "12db5af4-fd5f-4d1f-bd98-0360df770aa8",
"user": "abdb5af4-fd5f-4d1f-bd10-0360df77012c",
"available_from": "2019-03-07T20:12:09Z",
"available_to": "2019-09-23T23:57:31Z",
"available_count": 432
}
},
null,
2

```

<RefSubLayout.Divider />

## Partially synced

**POST** `/v1/webhooks`

<Note>
  Implement the `payouts.partially_synced` webhook to know when 30 days of historical payouts have been scanned.

  * By default, the `payouts.partially_synced` webhook triggers when 30 days of historical payouts have been successfully scanned (starting from the date [when the account was added](/legacy/api-reference/accounts-webhooks#added)).
  * The number of days scanned is a configurable parameter. You can subscribe this webhook to multiple times with different day ranges.
  * It triggers only on the initial scan, and does not trigger during a periodic scan. If an account has zero or a small number of payouts, the initial scan may return all historical data and only fire the `payouts.fully_synced` webhook.
</Note>

### Request body

### Webhook message

* `name` (string, optional): Name used for the webhook subscription.
* `data` (object, optional)
* `account` (string (uuid), optional): ID of the account.
* `user` (string (uuid), optional): ID of the user.
* `days_synced` (integer, optional): Number of historical days synced.
* `available_count` (integer, optional): Total number of payouts synced.

<Tabs>
  <Tab title="curl">
    ```bash theme={}
    curl --request POST \\
    --url https://api.argyle.com/v1/webhooks \\
    --header 'accept: application/json' \\
    --header 'content-type: application/json' \\
    --data '{
    "events": ["payouts.partially_synced"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret",
    "config": { "days_synced": 7 }
    }'
    ```
  </Tab>

  <Tab title="python">
    ```python theme={}
    import requests
    url = "https://api.argyle.com/v1/webhooks"
    payload = {
    "events": ["payouts.partially_synced"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret",
    "config": { "days_synced": 7 }
    }
    headers = {
    "accept": "application/json",
    "content-type": "application/json"
    }
    response = requests.post(url, json=payload, headers=headers)
    ```
  </Tab>
</Tabs>

```json theme={}

{
"event": "payouts.partially_synced",
"name": "7 days synced",
"data": {
"account": "12db5af4-fd5f-4d1f-bd98-0360df770aa8",
"user": "abdb5af4-fd5f-4d1f-bd10-0360df77012c",
"days_synced": 7,
"available_from": "2019-06-07T20:12:09Z",
"available_to": "2019-06-14T20:12:09Z",
"available_count": 324
}
},
null,
2

```

<RefSubLayout.Divider />

## Added

**POST** `/v1/webhooks`

Implement the `payouts.added` webhook to know when a [payout object](/legacy/api-reference/payouts#payout-object) is added.

* A new payout object is added after a periodic scan when a user receives a new paystub. If the scan detects more than one paystub, then the `added_count` value in the payload reflects this.

### Request body

### Webhook message

* `name` (string, optional): Name used for the webhook subscription.
* `data` (object, optional)
* `account` (string (uuid), optional): ID of the account.
* `user` (string (uuid), optional): ID of the user.
* `added_to` (string (timestamp), optional): Represents the end of the time period the payouts are added for.
* `added_count` (integer, optional): The number of payouts added to the account.
* `available_to` (string (timestamp), optional): Represents the end of the time period the payouts are available for.
* `available_count` (integer, optional): The total number of payouts associated with the account at the moment the webhook call is made.

<Tabs>
  <Tab title="curl">
    ```bash theme={}
    curl --request POST \\
    --url https://api.argyle.com/v1/webhooks \\
    --header 'accept: application/json' \\
    --header 'content-type: application/json' \\
    --data '{
    "events": ["payouts.added"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret"
    }'
    ```
  </Tab>

  <Tab title="python">
    ```python theme={}
    import requests
    url = "https://api.argyle.com/v1/webhooks"
    payload = {
    "events": ["payouts.added"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret"
    }
    headers = {
    "accept": "application/json",
    "content-type": "application/json"
    }
    response = requests.post(url, json=payload, headers=headers)
    ```
  </Tab>
</Tabs>

```json theme={}

{
"event": "payouts.added",
"name": "Payouts added",
"data": {
"account": "12db5af4-fd5f-4d1f-bd98-0360df770aa8",
"user": "abdb5af4-fd5f-4d1f-bd10-0360df77012c",
"added_from": "2019-08-07T20:12:09Z",
"added_to": "2019-09-23T23:57:31Z",
"added_count": 10,
"available_from": "2019-03-07T20:12:09Z",
"available_to": "2019-09-23T23:57:31Z",
"available_count": 456
}
},
null,
2

```

<RefSubLayout.Divider />

## Updated

**POST** `/v1/webhooks`

<Note>
  Implement the `payouts.updated` webhook to know when a [payout object](/legacy/api-reference/payouts#payout-object) is updated.

  * Payout objects are updated when a periodic scan detects changes to an existing payout — for example, the `status` of a payout execution changes from `scheduled` to `completed`.
</Note>

### Request body

### Webhook message

* `name` (string, optional): Name used for the webhook subscription.
* `data` (object, optional)
* `account` (string (uuid), optional): ID of the account.
* `user` (string (uuid), optional): ID of the user.
* `updated_to` (string (timestamp), optional): Represents the end of the time period the payouts were updated in.
* `updated_count` (integer, optional): The number of payouts that were updated.
* `updated_payouts` (array of (uuid) strings, optional): ID's of the updated payouts.
* `available_to` (string (timestamp), optional): Represents the end of the time period the payouts are available for.
* `available_count` (integer, optional): The total number of payouts associated with the account at the moment the webhook call is made.

<Tabs>
  <Tab title="curl">
    ```bash theme={}
    curl --request POST \\
    --url https://api.argyle.com/v1/webhooks \\
    --header 'accept: application/json' \\
    --header 'content-type: application/json' \\
    --data '{
    "events": ["payouts.updated"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret"
    }'
    ```
  </Tab>

  <Tab title="python">
    ```python theme={}
    import requests
    url = "https://api.argyle.com/v1/webhooks"
    payload = {
    "events": ["payouts.updated"],
    "name": "name-for-the-webhook-subscription",
    "url": "https://your-webhook-backend.com",
    "secret": "optional-secret"
    }
    headers = {
    "accept": "application/json",
    "content-type": "application/json"
    }
    response = requests.post(url, json=payload, headers=headers)
    ```
  </Tab>
</Tabs>

```json theme={}

{
"event": "payouts.updated",
"name": "Payouts updated",
"data": {
"account": "12db5af4-fd5f-4d1f-bd98-0360df770aa8",
"user": "abdb5af4-fd5f-4d1f-bd10-0360df77012c",
"updated_from": "2019-09-10T10:00:00Z",
"updated_to": "2019-09-12T12:00:00Z",
"updated_count": 2,
"updated_payouts": [
"d667a477-e252-4f8a-9518-92a51b235187",
"27f3cde1-1ca0-4b5a-940d-337fd33f97b5"
],
"available_from": "2019-03-07T20:12:09Z",
"available_to": "2019-09-23T23:57:31Z",
"available_count": 456
}
},
null,
2

```
