---
title: Create Payment Rule
slug: create-payment-rule
docTags: 
createdAt: 2026-08-25T19:28:59.170Z
---

{
  "id": "DdFvCnzaVTufkQ1edYqtS",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/billing/payment-rules",
    "servers": [
      {
        "url": "https://api.nue.io/billing/payment-rules",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/billing/payment-rules",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Create Payment Rule",
    "description": "Create a new payment rule with the provided details.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "*/*",
            "application/json"
          ],
          "default": "*/*"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "The request to create a payment rule.",
          "customType": "PaymentRuleRequest",
          "schema": [
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "The name of the payment rule"
            },
            {
              "name": "startDate",
              "kind": "required",
              "type": "string<date>",
              "description": "<p>The start date of the payment rule, example = '2024-10-10</p>",
              "format": "date"
            },
            {
              "name": "endDate",
              "kind": "optional",
              "type": "string<date>",
              "description": "<p>The end date of the payment rule, example = '2024-10-10</p>",
              "format": "date"
            },
            {
              "name": "status",
              "kind": "optional",
              "type": "string<Draft | Active>",
              "description": "The status of the payment rule",
              "enum": [
                "Draft",
                "Active"
              ]
            },
            {
              "name": "conditions",
              "kind": "optional",
              "type": "array",
              "description": "The conditions of the payment rule",
              "modelRef": "#/components/schemas/PaymentRuleCondition",
              "customType": "PaymentRuleCondition[]",
              "schema": [
                {
                  "name": "id",
                  "kind": "optional",
                  "type": "string<uuid>",
                  "description": "",
                  "format": "uuid"
                },
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "description": ""
                },
                {
                  "name": "action",
                  "kind": "optional",
                  "type": "string",
                  "description": ""
                },
                {
                  "name": "externalSystemType",
                  "kind": "optional",
                  "type": "string",
                  "description": ""
                },
                {
                  "name": "externalSystemId",
                  "kind": "optional",
                  "type": "string",
                  "description": ""
                },
                {
                  "name": "filters",
                  "kind": "optional",
                  "type": "array",
                  "description": "",
                  "modelRef": "#/components/schemas/PaymentRuleFilter",
                  "customType": "PaymentRuleFilter[]",
                  "schema": [
                    {
                      "name": "apiName",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    },
                    {
                      "name": "name",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    },
                    {
                      "name": "operand",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    },
                    {
                      "name": "operator",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    },
                    {
                      "name": "type",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    },
                    {
                      "name": "value",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    },
                    {
                      "name": "nestedApiName",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    },
                    {
                      "name": "nestedType",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    }
                  ]
                }
              ]
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "The description of the payment rule"
            }
          ],
          "modelRef": "#/components/schemas/PaymentRuleRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Created",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "title",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "hKYGg-bIDsbAl0d8wtHZa",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/billing/payment-rules \\\n     --header 'accept: */*' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"name\": \"\",\n     \"startDate\": \"\"\n     }'"
        },
        {
          "id": "DBq8WEurUQXsoxu62d6mD",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"*/*\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"name\": \"\",\n   \"startDate\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/billing/payment-rules\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "jkd5J1giNveKpggMSY-xU",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/billing/payment-rules\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"*/*\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"name\": \"\",\n   \"startDate\": \"\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "at29jfscODMkMkRMOs9Ku",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/billing/payment-rules\"\n\npayload = json.dumps({\n   \"name\": \"\",\n   \"startDate\": \"\"\n})\nheaders = {\n   'accept': '*/*',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "hKYGg-bIDsbAl0d8wtHZa"
    },
    "results": {
      "languages": [
        {
          "id": "OHSsqr3Sm45WUc1d7orsG",
          "language": "201",
          "code": "// Created\n"
        },
        {
          "id": "b_puC3olCARz_U7Na6lYj",
          "language": "400",
          "code": "// Bad Request\n{\n  \"title\": \"\",\n  \"message\": \"\",\n  \"errorCode\": \"\"\n}"
        },
        {
          "id": "BgQ-sSMiiG6DKeBN14gCd",
          "language": "404",
          "code": "// Not Found\n"
        }
      ],
      "selectedLanguageId": "OHSsqr3Sm45WUc1d7orsG"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}