---
title: Calculate Term
slug: calculate-term
docTags: 
createdAt: 2026-08-25T19:28:59.170Z
---

{
  "id": "mBEjy2qrc0p4SV-rhZ68k",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/pricing/terms/calculateTerm",
    "servers": [
      {
        "url": "https://api.nue.io/pricing/terms/calculateTerm",
        "description": "**Production Environment** - Live production server for all customer-facing operations. Use this for production integrations with real customer data and transactions."
      },
      {
        "url": "https://api.sandbox.nue.io/pricing/terms/calculateTerm",
        "description": "**Sandbox Environment** - Safe testing environment with sample data for development and integration testing. No rate limits apply. Data is reset weekly. Perfect for prototyping and QA testing."
      }
    ],
    "name": "Calculate Term",
    "description": "<p>Given a subscription start date and end date, calculates the term length in the requested dimension (for example, the number of months between the two dates). This is the same calculation the order engine runs internally when it derives a term.</p>\n<p><strong>Why this matters for order creation:</strong> when you create an order, each termed subscription line must specify <code>subscriptionTerm</code> (or <code>coTermAsset</code>) — a raw end date is not accepted and is recalculated from start + term. If your system only knows the start and end dates a customer wants, call this endpoint first to convert those dates into the <code>subscriptionTerm</code> value the order payload requires.</p>\n<p>The endpoint is <strong>batch</strong>: send one or more calculations in the <code>requests</code> array and receive a <code>results</code> array in the same order.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "schema": [
            {
              "name": "requests",
              "kind": "required",
              "type": "array",
              "description": "<p>One or more term calculations to perform. Must be non-empty.</p>",
              "example": "",
              "itemType": "object",
              "customType": "object[]",
              "schema": [
                {
                  "name": "startDate",
                  "kind": "required",
                  "type": "string<date>",
                  "description": "<p>Subscription start date (ISO 8601, e.g. '2026-01-01').</p>",
                  "format": "date"
                },
                {
                  "name": "endDate",
                  "kind": "required",
                  "type": "string<date>",
                  "description": "<p>Subscription end date (ISO 8601, e.g. '2026-12-31').</p>",
                  "format": "date"
                },
                {
                  "name": "termType",
                  "kind": "optional",
                  "type": "string<year | month | quarter | semi-annual | week>",
                  "description": "<p>Optional. Dimension the calculated term is expressed in. Case-insensitive (one of: year, month, quarter, semi-annual, week). Defaults to 'month' when omitted. For order creation, set this to match the product's term dimension so the resulting term lines up with the order line.</p>",
                  "enum": [
                    "year",
                    "month",
                    "quarter",
                    "semi-annual",
                    "week"
                  ]
                },
                {
                  "name": "termBasis",
                  "kind": "optional",
                  "type": "string<30/360 | eu30/360 | actual/actual | actual/360 | actual/365>",
                  "description": "<p>Optional. Day-count convention used to measure the period. Case-insensitive. Defaults to 'eu30/360' when omitted. Most subscription products use '30/360', so pass it explicitly unless you specifically want EU 30/360.</p>",
                  "enum": [
                    "30/360",
                    "eu30/360",
                    "actual/actual",
                    "actual/360",
                    "actual/365"
                  ]
                }
              ]
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Term(s) calculated successfully.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "GENERATED",
            "code": "// Term(s) calculated successfully.\n{\n  \"results\": [\n    {\n      \"term\": 0,\n      \"termType\": \"\",\n      \"termBasis\": \"\"\n    }\n  ]\n}"
          },
          {
            "label": "twelveMonths",
            "code": "// Twelve months\n{\n  \"results\": [\n    {\n      \"term\": 12,\n      \"termType\": \"Month\",\n      \"termBasis\": \"30/360\"\n    }\n  ]\n}"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "results",
                "kind": "optional",
                "type": "array",
                "description": "<p>Calculated terms, in the same order as the requests.</p>",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "term",
                    "kind": "optional",
                    "type": "number",
                    "description": "<p>Calculated term length, expressed in 'termType' units.</p>"
                  },
                  {
                    "name": "termType",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Dimension the term is expressed in (e.g. 'Month').</p>"
                  },
                  {
                    "name": "termBasis",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Day-count convention applied.</p>"
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Validation error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ValidationError",
            "schema": [
              {
                "name": "status",
                "kind": "optional",
                "type": "string<FAILURE>",
                "description": "",
                "enum": [
                  "FAILURE"
                ]
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": "Specific validation error code"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Detailed validation error message"
              }
            ],
            "modelRef": "#/components/schemas/ValidationError",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "GDL57ra0CcU7tjDzFMUvk",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/pricing/terms/calculateTerm \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"requests\": [\n     {\n     \"startDate\": \"\",\n     \"endDate\": \"\"\n     }\n     ]\n     }'"
        },
        {
          "id": "CExgJPc3Nxy08ISlvCgGL",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"requests\": [\n      {\n         \"startDate\": \"\",\n         \"endDate\": \"\"\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/pricing/terms/calculateTerm\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "JP5WSzBSH332ys4AEMkTX",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/pricing/terms/calculateTerm\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"requests\": [\n      {\n         \"startDate\": \"\",\n         \"endDate\": \"\"\n      }\n   ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "016yO2k2gGs0mTAU5y8Bi",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/pricing/terms/calculateTerm\"\n\npayload = json.dumps({\n   \"requests\": [\n      {\n         \"startDate\": \"\",\n         \"endDate\": \"\"\n      }\n   ]\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "GDL57ra0CcU7tjDzFMUvk"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Term(s) calculated successfully.\n{\n  \"results\": [\n    {\n      \"term\": 0,\n      \"termType\": \"\",\n      \"termBasis\": \"\"\n    }\n  ]\n}",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// Term(s) calculated successfully.\n{\n  \"results\": [\n    {\n      \"term\": 0,\n      \"termType\": \"\",\n      \"termBasis\": \"\"\n    }\n  ]\n}"
            },
            {
              "label": "twelveMonths",
              "code": "// Twelve months\n{\n  \"results\": [\n    {\n      \"term\": 12,\n      \"termType\": \"Month\",\n      \"termBasis\": \"30/360\"\n    }\n  ]\n}"
            }
          ]
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Validation error\n{\n  \"status\": \"\",\n  \"errorCode\": \"\",\n  \"message\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}