# Create a sweep config

Create a sweep config for a wallet.

To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) you'll need to specify the `/accounts/{accountID}/wallets.write` scope.

## POST

/accounts/{accountID}/sweep-configs

### Ask

```shell
curl -X POST "https://api.moov.io/accounts/{accountID}/sweep-configs" \
  -H "Authorization: Bearer {token}" \
  -H "X-Moov-Version: v2026.04.00" \
  -d '{
  "walletID": "01234567-89ab-cdef-0123-456789abcdef",
  "status": "enabled",
  "pushPaymentMethodID": "01234567-89ab-cdef-0123-456789abcdef",
  "pullPaymentMethodID": "01234567-89ab-cdef-0123-456789abcdef"
}'
```

### Ask

```go
mc, _ := moov.NewClient()

minBalance := "150.00"
mc.CreateSweepConfig(ctx, moov.CreateSweepConfig{
  AccountID:           "string",
  WalletID:            "string",
  Status:              moov.SweepConfigStatus_Enabled,
  PushPaymentMethodID: "string",
  PullPaymentMethodID: "string",
  MinimumBalance:      &minBalance,
})
```

### Ask

```typescript
import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.sweeps.createConfig({
    accountID: "cd0ec32e-bd84-418c-90d3-fffbc5465f8b",
    createSweepConfig: {
      walletID: "01234567-89ab-cdef-0123-456789abcdef",
      status: "enabled",
      pushPaymentMethodID: "01234567-89ab-cdef-0123-456789abcdef",
      pullPaymentMethodID: "01234567-89ab-cdef-0123-456789abcdef",
    },
  });

console.log(result);
}

run();
```

### Ask

```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$createSweepConfig = new Components\CreateSweepConfig(
    walletID: '01234567-89ab-cdef-0123-456789abcdef',
    status: Components\SweepConfigStatus::Enabled,
    pushPaymentMethodID: '01234567-89ab-cdef-0123-456789abcdef',
    pullPaymentMethodID: '01234567-89ab-cdef-0123-456789abcdef',
);

$response = $sdk->sweeps->createConfig(
    accountID: 'cd0ec32e-bd84-418c-90d3-fffbc5465f8b',
    createSweepConfig: $createSweepConfig
);

if ($response->sweepConfig !== null) {
    // handle response
}
```

### Ask

```java
package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.*;
import io.moov.sdk.models.errors.CreateSweepConfigError;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.operations.CreateSweepConfigResponse;
import java.lang.Exception;

public class Application {

public static void main(String[] args) throws GenericError, CreateSweepConfigError, Exception {

Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

CreateSweepConfigResponse res = sdk.sweeps().createConfig()
                .accountID("cd0ec32e-bd84-418c-90d3-fffbc5465f8b")
                .createSweepConfig(CreateSweepConfig.builder()
                    .walletID("01234567-89ab-cdef-0123-456789abcdef")
                    .status(SweepConfigStatus.ENABLED)
                    .pushPaymentMethodID("01234567-89ab-cdef-0123-456789abcdef")
                    .pullPaymentMethodID("01234567-89ab-cdef-0123-456789abcdef")
                    .build())
                .call();

if (res.sweepConfig().isPresent()) {
            System.out.println(res.sweepConfig().get());
        }
    }
}
```

### Ask

```python
from moovio_sdk import Moov
from moovio_sdk.models import components

with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

res = moov.sweeps.create_config(account_id="cd0ec32e-bd84-418c-90d3-fffbc5465f8b", wallet_id="01234567-89ab-cdef-0123-456789abcdef", status=components.SweepConfigStatus.ENABLED, push_payment_method_id="01234567-89ab-cdef-0123-456789abcdef", pull_payment_method_id="01234567-89ab-cdef-0123-456789abcdef")

# Handle response
    print(res)
```

### Ask

```ruby
require 'moov_ruby'

Models = ::Moov::Models
s = ::Moov::Client.new(
  security: Models::Components::Security.new(
    username: '',
    password: ''
  )
)
res = s.sweeps.create_config(account_id: '02c3d1d1-d847-4eb3-bef3-8caa32a5610b', create_sweep_config: Models::Components::CreateSweepConfig.new(
  wallet_id: '01234567-89ab-cdef-0123-456789abcdef',
  status: Models::Components::SweepConfigStatus::ENABLED,
  push_payment_method_id: '01234567-89ab-cdef-0123-456789abcdef',
  pull_payment_method_id: '01234567-89ab-cdef-0123-456789abcdef'
))

unless res.sweep_config.nil?
  # handle response
end
```

### Ask

```csharp
using Moov.Sdk;
using Moov.Sdk.Models.Components;

var sdk = new MoovClient(security: new Security() {
    Username = "",
    Password = "",
});

var res = await sdk.Sweeps.CreateConfigAsync(
    accountID: "02c3d1d1-d847-4eb3-bef3-8caa32a5610b",
    body: new CreateSweepConfig() {
        WalletID = "01234567-89ab-cdef-0123-456789abcdef",
        Status = SweepConfigStatus.Enabled,
        PushPaymentMethodID = "01234567-89ab-cdef-0123-456789abcdef",
        PullPaymentMethodID = "01234567-89ab-cdef-0123-456789abcdef",
    }
);

// handle response
```

### Response headers

A unique identifier used to trace requests.

### Error Responses

#### Invalid syntax
```json
{
  "error": "string"
}
```

#### Missing or expired authentication
```json
{
  "error": "string"
}
```

#### Unauthorized
```json
{
  "error": "string"
}
```

#### Resource not found
```json
{
  "error": "string"
}
```

#### Request conflict
```json
{
  "error": "string"
}
```

#### Validation error
```json
{
  "walletID": "string",
  "status": "string",
  "pushPaymentMethodID": "string",
  "pullPaymentMethodID": "string",
  "statementDescriptor": "string",
  "minimumBalance": "string"
}
```

#### Rate limiting
```json
{
  "error": "string"
}
```

#### Unexpected errors
```json
{
  "error": "string"
}
```

#### Downstream service failure
```json
{
  "error": "string"
}
```
