{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pluggy/json-schema/pluggy-create-smart-transfer-preauthorization-schema.json",
  "title": "CreateSmartTransferPreauthorization",
  "description": "Create smart transfer preauthorization request data",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pluggy-smart-transfer-api-openapi.yml#/components/schemas/CreateSmartTransferPreauthorization",
  "properties": {
    "connectorId": {
      "type": "number",
      "description": "Primary identifier of the connector"
    },
    "parameters": {
      "$ref": "#/$defs/SmartTransferPreauthorizationParameter"
    },
    "recipientIds": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "Primary identifier of the payment recipient"
      }
    },
    "callbackUrls": {
      "$ref": "#/$defs/SmartTransferCallbackUrls"
    },
    "clientPreauthorizationId": {
      "type": "string",
      "description": "Client preauthorization identifier"
    },
    "configuration": {
      "$ref": "#/$defs/SmartTransferPreauthorizationConfiguration"
    },
    "linkedJourney": {
      "type": "boolean",
      "default": false,
      "description": "When true, the user is also asked, in the same approval at the bank, for a permission to read the source account balance. Check `dataConsent` on the preauthorization and use the balance endpoint once it is `AUTHORISED`."
    }
  },
  "required": [
    "connectorId",
    "parameters",
    "recipientIds"
  ],
  "$defs": {
    "SmartTransferCallbackUrls": {
      "description": "Redirect urls after the preauthorization flow was completed or ended in error status",
      "properties": {
        "success": {
          "type": "string",
          "description": "Url to be redirected after the preauthorization was completed"
        },
        "error": {
          "type": "string",
          "description": "Url to be redirected after the preauthorization ended in error status"
        }
      },
      "type": "object"
    },
    "SmartTransferPreauthorizationConfiguration": {
      "description": "Smart transfer preauthorization configuration",
      "properties": {
        "totalAllowedAmount": {
          "type": "number",
          "description": "Maximum amount to be reached by the sum of all transactions that use the consent authorized by the customer."
        },
        "transactionLimit": {
          "type": "number",
          "description": "Maximum amount for each payment transaction associated with this consent."
        },
        "periodicLimits": {
          "$ref": "#/$defs/SmartTransferPreauthorizationConfigurationPeriodicLimits"
        }
      },
      "type": "object"
    },
    "SmartTransferPreauthorizationConfigurationPeriodicLimit": {
      "description": "Transactional limit per period. If sent, at least one of the fields (quantityLimit or transactionLimit) must be filled in.",
      "properties": {
        "quantityLimit": {
          "type": "number",
          "description": "Maximum number of transactions allowed to occur in the period."
        },
        "transactionLimit": {
          "type": "number",
          "description": "Maximum amount to be transacted in the period."
        }
      }
    },
    "SmartTransferPreauthorizationConfigurationPeriodicLimits": {
      "description": "Transactional limits per period as determined by the paying user.",
      "properties": {
        "day": {
          "description": "Daily transactional limit.",
          "$ref": "#/$defs/SmartTransferPreauthorizationConfigurationPeriodicLimit"
        },
        "week": {
          "description": "Weekly transactional limit.",
          "$ref": "#/$defs/SmartTransferPreauthorizationConfigurationPeriodicLimit"
        },
        "month": {
          "description": "Monthly transactional limit.",
          "$ref": "#/$defs/SmartTransferPreauthorizationConfigurationPeriodicLimit"
        },
        "year": {
          "description": "Yearly transactional limit.",
          "$ref": "#/$defs/SmartTransferPreauthorizationConfigurationPeriodicLimit"
        }
      }
    },
    "SmartTransferPreauthorizationParameter": {
      "description": "Credentials neccesary to create a smart transfer preauthorization",
      "properties": {
        "cpf": {
          "type": "string",
          "description": "CPF of the payer"
        },
        "cnpj": {
          "type": "string",
          "description": "CNPJ of the payer"
        }
      },
      "type": "object",
      "required": [
        "cpf"
      ]
    }
  }
}