{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-create-direct-debit-request-schema.json",
  "title": "CreateDirectDebitRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-direct-debits-api-openapi.yml#/components/schemas/CreateDirectDebitRequest",
  "type": "object",
  "properties": {
    "amount": {
      "$ref": "#/$defs/AmountInput"
    },
    "scheme": {
      "$ref": "#/$defs/DirectDebitSchemeType"
    },
    "schemeDetails": {
      "$ref": "#/$defs/SchemeDetailsInput"
    },
    "date": {
      "description": "Requested payment execution date. It is a local date from the source account's point-of-view. Cannot be set to before the current date, and not more than 60 days into the future.",
      "$ref": "#/$defs/Date"
    },
    "source": {
      "description": "A reference identifying the source account to collect money from. Can only be an external account.",
      "oneOf": [
        {
          "$ref": "#/$defs/ExternalAccountRef"
        }
      ]
    },
    "destination": {
      "$ref": "#/$defs/InternalAccountRef"
    },
    "reference": {
      "$ref": "#/$defs/PaymentReference"
    },
    "categoryPurpose": {
      "$ref": "#/$defs/CategoryPurpose"
    },
    "chargeBearer": {
      "$ref": "#/$defs/ChargeBearer"
    },
    "externalId": {
      "$ref": "#/$defs/ExternalID"
    },
    "metadata": {
      "$ref": "#/$defs/Metadata"
    },
    "paymentScheduleId": {
      "description": "ID of the payment schedule to associate with this direct debit. Defaults to the organization's default schedule.",
      "$ref": "#/$defs/ResourceID"
    }
  },
  "required": [
    "amount",
    "scheme",
    "date",
    "source",
    "destination",
    "reference"
  ],
  "$defs": {
    "AccountType": {
      "type": "string",
      "enum": [
        "ACCOUNT",
        "EXTERNAL_ACCOUNT",
        "INLINE"
      ],
      "description": "Account type specifier. `ACCOUNT` for internal _Account_ resources. `EXTERNAL_ACCOUNT` for _External Account_ resources."
    },
    "AmountInput": {
      "oneOf": [
        {
          "$ref": "#/$defs/AmountIntegerValueInput"
        },
        {
          "$ref": "#/$defs/AmountStringValueInput"
        }
      ]
    },
    "AmountIntegerValueInput": {
      "type": "object",
      "properties": {
        "currency": {
          "$ref": "#/$defs/CurrencyCode"
        },
        "value": {
          "description": "The amount value as an integer (int64) represented in currency minor units (e.g. 15.02 EUR is represented as the value 1502).",
          "type": "integer",
          "format": "int64"
        }
      },
      "required": [
        "currency",
        "value"
      ]
    },
    "AmountStringValueInput": {
      "type": "object",
      "properties": {
        "currency": {
          "$ref": "#/$defs/CurrencyCode"
        },
        "stringValue": {
          "description": "A string representation of the amount value, which will be a decimal number if the currency has decimals. The number is not formatted for display purposes (e.g. with thousand separator) and always contains the dot `.` character as decimal separator.",
          "type": "string"
        }
      },
      "required": [
        "currency",
        "stringValue"
      ]
    },
    "CategoryPurpose": {
      "type": "string",
      "description": "ISO 20022 Category Purpose Code (ExternalCategoryPurpose1Code)."
    },
    "ChargeBearer": {
      "type": "string",
      "description": "Charge bearer specifies which party should bear the charges of the transaction.",
      "enum": [
        "SHARED",
        "DEBTOR",
        "CREDITOR",
        "SERVICE_LEVEL"
      ]
    },
    "CitiWorldlinkInstrumentInput": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/InstrumentType"
        }
      },
      "required": [
        "type"
      ]
    },
    "CurrencyCode": {
      "type": "string",
      "description": "Three-letter ISO 4217 currency code.",
      "minLength": 3,
      "maxLength": 3,
      "pattern": "^[A-Z]{3,3}$"
    },
    "Date": {
      "type": "string",
      "format": "date",
      "description": "`full-date` notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `2017-07-21`."
    },
    "DirectDebitSchemeType": {
      "type": "string",
      "description": "Direct debit payment scheme. Choose among: <ul>\n  <li><code>SDD_CORE</code> (<a\nhref=\"https://www.europeanpaymentscouncil.eu/what-we-do/epc-payment-schemes/sepa-direct-debit/sepa-direct-debit-core-rulebook-and-implementation\">SEPA Direct Debit Core</a>)</li>\n  <li><code>SDD_B2B</code> (<a\nhref=\"https://www.europeanpaymentscouncil.eu/what-we-do/epc-payment-schemes/sepa-direct-debit/sepa-direct-debit-b2b-rulebook-and-implementation\">SEPA Direct Debit B2B</a>)</li>\n  <li><code>GB_DD_BACS</code> (UK <a href=\"https://www.bacs.co.uk\">BACS</a> Direct Debit)</li>\n  <li><code>AUTOGIRO</code> (Swedish <a href=\"https://www.bankgirot.se/autogiro\">Bg AutoGiro</a>)</li>\n  <li><code>CH_DD_LSV</code> (Swiss <a href=\"https://www.six-group.com/en/products-services/banking-services/billing-and-payments/direct-debits.html\">Direct Debit LSV+</a>)</li>\n  <li><code>CH_DD_BDD</code> (Swiss <a href=\"https://www.six-group.com/en/products-services/banking-services/billing-and-payments/direct-debits.html\">Direct Debit BDD</a>)</li>\n  <li><code>US_DD_ACH</code> (US ACH Direct Debit)</li>\n</ul>",
      "enum": [
        "SDD_CORE",
        "SDD_B2B",
        "GB_DD_BACS",
        "AUTOGIRO",
        "CH_DD_LSV",
        "CH_DD_BDD",
        "US_DD_ACH"
      ]
    },
    "ExternalAccountRef": {
      "type": "object",
      "description": "A reference to an External Account.",
      "properties": {
        "type": {
          "$ref": "#/$defs/AccountType"
        },
        "id": {
          "type": "string",
          "description": "ID or External ID of an External Account. Prefix External IDs with `external:`."
        }
      },
      "required": [
        "type",
        "id"
      ]
    },
    "ExternalID": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9._\\-+=]{1,64}$",
      "description": "External ID is optional to use, but if used, the Atlar platform will persist it, index it, as well as require it to be unique across all resources. It is possible to retrieve a resource using the external ID using the prefix `external:`.",
      "x-omitempty": true
    },
    "InstrumentInput": {
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/$defs/CitiWorldlinkInstrumentInput"
        }
      ]
    },
    "InstrumentType": {
      "type": "string",
      "description": "The type of the payment instrument.",
      "enum": [
        "US_ACH",
        "CITI_WORLDLINK"
      ]
    },
    "InternalAccountRef": {
      "type": "object",
      "description": "A reference to an (internal) Account.",
      "properties": {
        "type": {
          "$ref": "#/$defs/AccountType"
        },
        "id": {
          "type": "string",
          "description": "ID of an (internal) Account."
        }
      },
      "required": [
        "type",
        "id"
      ]
    },
    "Metadata": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "Metadata is a `string-string` key-value container that\ncan be used to store information known at the time of resource\ncreation. This can be retrieved later on, for instance when a\npayment or expected transaction is reconciled with the booked\ntransaction on the bank statement.\n\nMetadata can have at most 20 entries. Keys may have a\nmaximum length of 64 chars and values a maximum length of 512\nchars.\n\nBy default, this field is optional. It is possible to make it\nrequired in the Atlar Dashboard by visiting the [Metadata keys\npage](https://app.atlar.com/metadata-keys). Requirement rules\ncan be specified per API resource. Both the Dashboard and the\nAPI will then enforce these rules and give validation errors\nwhen the required fields are not set.",
      "maxProperties": 20,
      "x-omitempty": true
    },
    "PaymentReference": {
      "type": "string",
      "description": "This reference will be sent to the destination bank and recipient. (This type of reference is sometimes also referred to as remittance information.)",
      "maxLength": 140
    },
    "ResourceID": {
      "type": "string",
      "description": "Unique resource identifier.",
      "minLength": 32,
      "maxLength": 64
    },
    "SchemeDetailsInput": {
      "type": "object",
      "properties": {
        "instrument": {
          "$ref": "#/$defs/InstrumentInput"
        },
        "intraCompany": {
          "type": "boolean",
          "description": "Whether the payment is between companies within the same group."
        },
        "urgency": {
          "$ref": "#/$defs/SchemeDetailsUrgency"
        }
      }
    },
    "SchemeDetailsUrgency": {
      "type": "string",
      "description": "The urgency of the payment.",
      "enum": [
        "HIGH"
      ]
    }
  }
}