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

# Workflow Automation

This guide covers automating payment operations via API, including API key creation, IP whitelisting, access control, permissions, and webhook notifications.

## Automation overview

WEpayments APIs enable you to automate payment operations, reducing manual Dashboard work and enabling seamless integration with your internal systems.

### What can be automated

| **Operation**                                  | **Automation method** |
| :--------------------------------------------- | :-------------------- |
| **Payin (charge creation)**                    | API                   |
| **Payout (payment creation)**                  | API                   |
| **Data Collect (beneficiary self-onboarding)** | API                   |
| **PIX key validation**                         | API                   |
| **Transaction status checking**                | API or webhooks       |
| **Statement downloads**                        | API                   |
| **KYC document submission**                    | API                   |

## API authentication setup

To automate operations via API, you need:

| **Requirement**               | **Description**                                           |
| :---------------------------- | :-------------------------------------------------------- |
| **API user**                  | Dedicated user created in Dashboard (not for human login) |
| **API key**                   | Generated per user – only shown once                      |
| **IP whitelist**              | Allowed IP addresses that can use the key                 |
| **Two-factor authentication** | Required to generate and delete API keys                  |

### Step-by-step

| **Step**                  | **Action**                                                               |
| :------------------------ | :----------------------------------------------------------------------- |
| **1. Create user**        | Settings > Access Control > Create User (Moderator only)                 |
| **2. Assign permissions** | Select features the API can perform (charges, payments, statements, KYC) |
| **3. Generate API key**   | On user editing screen > API Key section > Create API Key                |
| **4. Enter IPs**          | At least one IP address required                                         |
| **5. Provide 2FA code**   | Required for security                                                    |
| **6. Copy and store**     | Key is only shown once – store securely                                  |

> 💡 Only IPs listed in the whitelist can make calls using the API key.

## Access control and permissions

The **Access Control** menu is only visible to users with **Moderator** permissions.

| **Role**      | **What it allows**                                                  |
| :------------ | :------------------------------------------------------------------ |
| **Moderator** | Full access – can create new users, edit access, manage permissions |
| **Write**     | Can create payments and charges, edit information                   |
| **View**      | Read-only – cannot create or edit                                   |

> 💡 The permissions available depend on the type of product you have purchased.

### API user permissions

When creating an API user, you can assign specific permissions such as:

| **Permission**               | **What it allows the API to do**            |
| :--------------------------- | :------------------------------------------ |
| **Create charges (payin)**   | Create PIX, boleto, and credit card charges |
| **Create payments (payout)** | Send payments to beneficiaries              |
| **View statement**           | Retrieve balance and transaction statements |
| **Insert KYC documents**     | Submit compliance documents                 |

## Webhook notifications

Webhooks are HTTP callbacks that send real-time event data to your endpoint when specific events occur.

### Common webhook events

| **Event**                    | **When triggered**            |
| :--------------------------- | :---------------------------- |
| **Payment confirmed**        | Payout successfully completed |
| **Charge received**          | Payin payment confirmed       |
| **Document requested**       | KYC/KYL documents needed      |
| **Document approved**        | Compliance documents approved |
| **Transaction under review** | Compliance review triggered   |

> 💡 Webhook configuration: Contact support for webhook endpoint setup and event subscription details.

## Automation best practices

| **Practice**                | **Why**                                 |
| :-------------------------- | :-------------------------------------- |
| **Use dedicated API user**  | Prevents access loss if employee leaves |
| **Minimize permissions**    | Grant only what the API needs           |
| **Store API keys securely** | Keys are only shown once                |
| **Implement retry logic**   | Handle transient failures gracefully    |
| **Monitor API usage**       | Detect unusual patterns                 |
| **Test in sandbox first**   | Validate before production              |

## Notifications configuration

In the **Notifications** menu, you can configure how you want to receive notifications about payment, collection, or compliance operations.

| **Configuration** | **Options**                                                    |
| :---------------- | :------------------------------------------------------------- |
| **Channel**       | Email, Dashboard, webhook                                      |
| **Events**        | Payment confirmation, charge received, document requests, etc. |
| **Recipients**    | Email addresses or Dashboard users                             |

> ⚠️ **Note:** Some notification options are not yet fully available. Contact support for current status.
