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

# Managing Debit Authorization

> Enable and manage autopay limits through the SynchPay API using the Debit Auth endpoints.

## Overview

To enable seamless payments through SynchPay, you can allow users to authorize recurring charges up to a defined limit. This is managed through the Debit Auth API endpoints, which allow you to check, set, and update the user's authorized debit limit.

## How It Works

<Steps>
  <Step title="Obtain an Access Token">
    Before calling any Debit Auth endpoints, secure an access token by making a `POST` request to `/auth/token` using your `ClientId` and `ClientSecret`.
  </Step>

  <Step title="Check Current Limit">
    Use the `GET /user/{registrationId}/debitauth` endpoint to retrieve the current auto-debit authorization status and the active limit, if any.
  </Step>

  <Step title="Set Initial Limit">
    If the user has not authorized any auto-debits yet, initiate the setup by sending a `POST` request to `/user/{registrationId}/debitauth` with the desired limit.
  </Step>
</Steps>

## Check Current Debit Authorization

### Endpoint

* **URL**: `https://api.synchpay.com/user/{registrationId}/debitauth`
* **Method**: `GET`
* **Authorization**: `Bearer <AccessToken>`

### Query Parameters

| Parameter        | Type   | Description                               | Required |
| ---------------- | ------ | ----------------------------------------- | -------- |
| `RegistrationId` | string | Unique identifier for the registered user | Yes      |
| `CompanyId`      | string | Unique identifier for the Company         | Yes      |

### Example Request

```http theme={null}
GET /user/bc1dcbac-226a-41cb-bc91-8e94e701cbba/debitauth?CompanyId=6e8d9257-bd5f-45cf-8f29-6d0ae8a6d991
Authorization: Bearer eyJhbGciOi...
```

### Example Response

```json theme={null}
{
  "Enabled": true,
  "Limit": 10000
}
```

```json theme={null}
{
  "Enabled": false,
  "Limit": 0
}
```

## Set a New Debit Authorization Limit

### Endpoint

* **URL**: `https://api.synchpay.com/user/{registrationId}/debitauth`
* **Method**: `POST`
* **Authorization**: `Bearer <AccessToken>`

### Path Parameters

| Parameter        | Type   | Description                               | Required |
| :--------------- | :----- | :---------------------------------------- | :------- |
| `registrationId` | string | Unique identifier for the registered user | Yes      |

### Request Body

| Parameter   | Type    | Description                                                                                                              | Required |
| :---------- | :------ | :----------------------------------------------------------------------------------------------------------------------- | :------- |
| `CompanyId` | string  | Unique identifier for the company                                                                                        | Yes      |
| `Enabled`   | boolean | When used with `true` value then notifications is sent to the user, `false` will disable the DebitAuth. Default: `false` | No       |
| `Limit`     | integer | Maximum auto-debit amount in cents (e.g. 10000 = \$100.00)                                                               | Yes      |

### Example Request

```json theme={null}
{
  "RegistrationId": "bc1dcbac-226a-41cb-bc91-8e94e701cbba",
  "Enabled": true,
  "Limit": 10000
}
```
