# Credit funding details

This chapter describes how to obtain the credit funding details via the Investment API.

## Prerequisites

- **Authentication scopes** — `payments:admin`, `reference_accounts:admin`
For more information, refer to [Authentication scopes](/products/byol/concepts/api_concepts/authentication/authentication_oauth#list-of-authentication-scopes).


Before retrieving credit funding details, ensure you have:

- **Webhook handler ready** — Set up a webhook endpoint to listen for credit funding events.
  - Subscribe to [`CREDIT_FUNDING.*`](/products/byol/guides/payments/payments_webhooks) events.
For more information, refer to [Implementing webhooks](/products/byol/getting_started/implementing_webhooks).
- Upvest must have activated virtual bank accounts for you
- The user and account group must be `ACTIVE`


## Listing credit funding details

Each active account group is assigned a virtual bank account, which is used for credit funding. To retrieve credit funding details, make the following call:

**GET** [`/account_groups/{account_group_id}/payments/credit_funding_details`](/api/credit-fundings/retrieve_funding_details)

**Example response**

```json
 {
      "virtual_bank_account_id": "4e127ac5-dae3-487e-b76b-fef7225a8b80",
      "name": "Max's Virtual Bank Account",
      "currency": "EUR",
      "owner": {
        "name": "Max Musterman"
      },
      "identification": {
        "swift": {
          "iban": "DE02100500000054540402",
          "bic": "DEUTDEFFXXX"
        }
      }
    },
    {
      "virtual_bank_account_id": "a38470db-f54c-4514-ad71-6904a5c2744f",
      "name": "Max's Virtual Bank Account",
      "currency": "EUR",
      "owner": {
        "name": "Max Musterman"
      },
      "identification": {
        "swift": {
          "iban": "DE02100500000054540403",
          "bic": "DEUTDEFFXXX"
        }
      }
    }
```

When presenting funding options to users, it is essential to use the credit funding details endpoint instead of listing virtual bank accounts. This ensures that users see the relevant funding details associated with their account group.

## Listing credit fundings

To get a list of credit fundings, submit the following request:

**GET** [`/account_groups/{account_group_id}/payments/credit_fundings`](/api/credit-fundings/list_credit_fundings)

**Example response**

```json
{
      "id": "1ab4fef9-a097-4c6f-9345-647025d5fde6",
      "created_at": "2020-08-24T14:15:22Z",
      "account_group_id": "1ea60f56-b67b-61fc-829a-0242ac130003",
      "cash_amount": "200.00",
      "currency": "EUR",
      "status": "CONFIRMED",
      "remittance_information": "CF123456789",
      "counterparty": {
        "identification": {
          "name": "Max Musterman"
        },
        "account": {
          "identification": {
            "iban": "DE02100500000054540402"
          }
        }
      },
      "virtual_bank_account_id": "ab8f9b19-6a31-48d3-b201-4dee92f3da0d"
    }
```

## Retrieve a credit funding by ID

To retrieve a specific credit funding, call

**GET** [`/payments/credit_fundings/{credit_funding_id}`](/api/credit-fundings/retrieve_credit_funding)

**Example response**

```json
{
  "id": "1ab4fef9-a097-4c6f-9345-647025d5fde6",
  "created_at": "2020-08-24T14:15:22Z",
  "account_group_id": "1ea60f56-b67b-61fc-829a-0242ac130003",
  "cash_amount": "200.00",
  "currency": "EUR",
  "status": "CONFIRMED",
  "remittance_information": "CF123456789",
  "counterparty": {
    "identification": {
      "name": "Max Musterman"
    },
    "account": {
      "identification": {
        "iban": "DE02100500000054540402"
      }
    }
  },
  "virtual_bank_account_id": "ab8f9b19-6a31-48d3-b201-4dee92f3da0d"
}
```

## Webhook

**Recommended: Use webhooks to track credit funding status**

To track credit funding statuses, set up a webhook listener for `CREDIT_FUNDING.CONFIRMED` and `CREDIT_FUNDING.CANCELLED` events. You will receive automatic notifications when funds are credited or cancelled.

For more information, refer to [Payment webhook events](/products/byol/guides/payments/payments_webhooks)

The webhook `CREDIT_FUNDING_CANCELLED` is sent when we inadvertently link a bank transaction to credit financing. This indicates that we have cancelled the credit financing.

In the case we confirm the credit funding, you will receive the `CREDIT_FUNDING_CONFIRMED` webhook.

**Example webhook**

```json
{
  "id": "8962b496-8d42-4560-bfab-10490dd1a721",
  "created_at": "2021-07-21T14:10:00.00Z",
  "type": "CREDIT_FUNDING.CANCELLED",
  "object": {
    "id": "1ab4fef9-a097-4c6f-9345-647025d5fde6",
    "created_at": "2020-08-24T14:15:22Z",
    "account_group_id": "1ea60f56-b67b-61fc-829a-0242ac130003",
    "cash_amount": "200.00",
    "currency": "EUR",
    "status": "CANCELLED",
    "remittance_information": "CF123456789",
    "counterparty": {
      "identification": {
        "name": "Max Musterman"
      },
      "account": {
        "identification": {
          "iban": "DE02100500000054540402"
        }
      }
    }
  },
  "webhook_id": "9df39835-be87-4243-9018-f2500b39cee6"
}
```