Create Contract API Endpoint Unclear "inputfields" Requirements

Create Contract API Endpoint Unclear "inputfields" Requirements

Hello,

I'm trying to create a Deluge function that accepts inputs from a form in Zoho Creator and creates a barebones contract of a given type. See below for the current code, cleaned of authentication information.
  1. // Fetch form data
  2. // Hidden field
  3. client_name = input.Client_Name;
  4. if(client_name == null || client_name == "")
  5. {
  6. client_name = "Testing Client";
  7. }
  8. // Dropdown field
  9. contract_type = input.Contract_Type;
  10. // Single line field
  11. title = input.Title;
  12. // Multi-line field
  13. description = input.Description;
  14. // Dropdown field
  15. signer_name = input.Signer_Name;
  16. //
  17. // Define the access token and refresh token
  18. accessToken = "ACCESS_TOKEN";
  19. refreshToken = "REFRESH_TOKEN";
  20. //
  21. // Define headers for token refresh request
  22. tokenRefreshHeaders = Map();
  23. tokenRefreshHeaders.put("Content-Type","application/x-www-form-urlencoded");
  24. tokenRefreshParameters = Map();
  25. tokenRefreshParameters.put("grant_type","refresh_token");
  26. tokenRefreshParameters.put("client_id","CLIENT_ID");
  27. tokenRefreshParameters.put("client_secret","CLIENT_SECRET");
  28. tokenRefreshParameters.put("refresh_token",refreshToken);
  29. //
  30. // Refresh the access token
  31. response = invokeurl
  32. [
  33. url :"https://accounts.zoho.com/oauth/v2/token"
  34. type :POST
  35. parameters:tokenRefreshParameters
  36. headers:tokenRefreshHeaders
  37. ];
  38. if(response.get("access_token") != null)
  39. {
  40. accessToken = response.get("access_token");
  41. }
  42. //
  43. // Define headers for Zoho Contracts API request
  44. contractsHeaders = Map();
  45. contractsHeaders.put("Authorization","Zoho-oauthtoken " + accessToken);
  46. contractsHeaders.put("Content-Type","application/json");
  47. //
  48. // Prepare contract data
  49. contract_type = lower(replaceAll(contract_type," ","-"));
  50. client_name = lower(replaceAll(client_name," ","-"));
  51. signerNameContainsTitle = signer_name.containsIgnoreCase(". ");
  52. signerFirstSpace = signer_name.find(" ");
  53. if(signerNameContainsTitle)
  54. {
  55. signerTitle = signer_name.left(signerFirstSpace);
  56. signerFullName = signer_name.remove(signerTitle).trim();
  57. signerFirstSpace = signerFullName.find(" ");
  58. signerFirstName = signerFullName.left(signerFirstSpace);
  59. signerLastName = signerFullName.remove(signerFirstName).trim();
  60. }
  61. else
  62. {
  63. signerFirstName = signer_name.left(signerFirstSpace);
  64. signerLastName = signer_name.remove(signerFirstName).trim();
  65. }
  66. signer_record = zoho.crm.searchRecords("Contacts","(First_Name:equals:" + signerFirstName + ") and (Last_Name:equals:" + signerLastName + ")");
  67. signer_email = signer_record.get(0).get("Email");
  68. //
  69. // Create nested maps/lists in the structure of the contracts API JSON
  70. contractDataMap = Map();
  71. contractDataMap.put("source",1);
  72. inputFieldsList = List();
  73. contractTypeInputFieldMap = Map();
  74. contractTypeInputFieldMap.put("metaApiName","contract-type");
  75. contractTypeInputsList = List();
  76. contractTypeInput = Map();
  77. contractTypeInput.put("inputApiName","contract-type");
  78. contractTypeInput.put("inputValue","non-disclosure-agreement");
  79. contractTypeInputsList.add(contractTypeInput);
  80. contractTypeInputFieldMap.put("inputs",contractTypeInputsList);
  81. inputFieldsList.add(contractTypeInputFieldMap);
  82. titleInputFieldMap = Map();
  83. titleInputFieldMap.put("metaApiName","title");
  84. titleInputsList = List();
  85. titleInput = Map();
  86. titleInput.put("inputApiName","title");
  87. titleInput.put("inputValue",title);
  88. titleInputsList.add(titleInput);
  89. titleInputFieldMap.put("inputs",titleInputsList);
  90. inputFieldsList.add(titleInputFieldMap);
  91. descriptionInputFieldMap = Map();
  92. descriptionInputFieldMap.put("metaApiName","description");
  93. descriptionInputsList = List();
  94. descriptionInput = Map();
  95. descriptionInput.put("inputApiName","description");
  96. descriptionInput.put("inputValue",description);
  97. descriptionInputsList.add(descriptionInput);
  98. descriptionInputFieldMap.put("inputs",descriptionInputsList);
  99. inputFieldsList.add(descriptionInputFieldMap);
  100. requesterNameInputFieldMap = Map();
  101. requesterNameInputFieldMap.put("metaApiName","requester-name");
  102. requesterNameInputsList = List();
  103. requesterNameInput = Map();
  104. requesterNameInput.put("inputApiName","requester-name");
  105. requesterNameInput.put("inputValue","Tom Rismeyer");
  106. requesterNameInputsList.add(requesterNameInput);
  107. requesterNameInputFieldMap.put("inputs",requesterNameInputsList);
  108. inputFieldsList.add(requesterNameInputFieldMap);
  109. requesterDepartmentInputFieldMap = Map();
  110. requesterDepartmentInputFieldMap.put("metaApiName","requester-department");
  111. requesterDepartmentInputsList = List();
  112. requesterDepartmentInput = Map();
  113. requesterDepartmentInput.put("inputApiName","requester-department");
  114. requesterDepartmentInput.put("inputValue","sales");
  115. requesterDepartmentInputsList.add(requesterDepartmentInput);
  116. requesterDepartmentInputFieldMap.put("inputs",requesterDepartmentInputsList);
  117. inputFieldsList.add(requesterDepartmentInputFieldMap);
  118. partyBNameInputFieldMap = Map();
  119. partyBNameInputFieldMap.put("metaApiName","party-b-name");
  120. partyBNameInputsList = List();
  121. partyBNameInput = Map();
  122. partyBNameInput.put("inputApiName","party-b-name");
  123. partyBNameInput.put("inputValue","guy-mcnobody);
  124. partyBNameInputsList.add(partyBNameInput);
  125. partyBNameInputFieldMap.put("inputs",partyBNameInputsList);
  126. inputFieldsList.add(partyBNameInputFieldMap);
  127. counterpartyPrimaryContactInputFieldMap = Map();
  128. counterpartyPrimaryContactInputFieldMap.put("metaApiName","counterparty-primary-contact");
  129. counterpartyPrimaryContactInputsList = List();
  130. counterpartyPrimaryContactInput = Map();
  131. counterpartyPrimaryContactInput.put("inputApiName","party-b-primary-contact-name");
  132. counterpartyPrimaryContactInput.put("inputValue",signer_email);
  133. counterpartyPrimaryContactInputsList.add(counterpartyPrimaryContactInput);
  134. counterpartyPrimaryContactInputFieldMap.put("inputs",counterpartyPrimaryContactInputsList);
  135. inputFieldsList.add(counterpartyPrimaryContactInputFieldMap);
  136. contractTermInputFieldMap = Map();
  137. contractTermInputFieldMap.put("metaApiName","contract-term");
  138. contractTermInputsList = List();
  139. contractTermInput = Map();
  140. contractTermInput.put("inputApiName","contract-term");
  141. contractTermInput.put("inputValue",false);
  142. contractTermInputsList.add(contractTermInput);
  143. contractTermInputFieldMap.put("inputs",contractTermInputsList);
  144. inputFieldsList.add(contractTermInputFieldMap);
  145. contractEffectiveDateInputFieldMap = Map();
  146. contractEffectiveDateInputFieldMap.put("metaApiName","contract-effective-date");
  147. contractEffectiveDateInputsList = List();
  148. contractEffectiveDateInput = Map();
  149. contractEffectiveDateInput.put("inputApiName","contract-effective-date");
  150. contractEffectiveDateInput.put("inputValue",1);
  151. contractEffectiveDateInputsList.add(contractEffectiveDateInput);
  152. contractEffectiveDateInputFieldMap.put("inputs",contractEffectiveDateInputsList);
  153. inputFieldsList.add(contractEffectiveDateInputFieldMap);
  154. renewalTypeInputFieldMap = Map();
  155. renewalTypeInputFieldMap.put("metaApiName","renewal-type");
  156. renewalTypeInputsList = List();
  157. renewalTypeInput = Map();
  158. renewalTypeInput.put("inputApiName","renewal-type");
  159. renewalTypeInput.put("inputValue",1);
  160. renewalTypeInputsList.add(renewalTypeInput);
  161. renewalTypeInputFieldMap.put("inputs",renewalTypeInputsList);
  162. inputFieldsList.add(renewalTypeInputFieldMap);
  163. contractDataMap.put("inputfields",inputFieldsList);
  164. //
  165. // Create the contract in Zoho Contracts
  166. response = invokeurl
  167. [
  168. url :"https://contracts.zoho.com/api/v1/contracts"
  169. type :POST
  170. parameters:contractDataMap
  171. headers:contractsHeaders
  172. ];
  173. if(response.get("code") == 201)
  174. {
  175. alert "Contract created successfully";
  176. }
  177. else
  178. {
  179. alert "Error in creating contract: " + response.toString();
  180. cancel submit;
  181. }

Here is the resulting JSON per logging:
  1. {
  2.   "source": 1,
  3.   "inputfields": [
  4.     {
  5.       "metaApiName": "contract-type",
  6.       "inputs": [
  7.         {
  8.           "inputApiName": "contract-type",
  9.           "inputValue": "non-disclosure-agreement"
  10.         }
  11.       ]
  12.     },
  13.     {
  14.       "metaApiName": "title",
  15.       "inputs": [
  16.         {
  17.           "inputApiName": "title",
  18.           "inputValue": "Test title"
  19.         }
  20.       ]
  21.     },
  22.     {
  23.       "metaApiName": "description",
  24.       "inputs": [
  25.         {
  26.           "inputApiName": "description",
  27.           "inputValue": ""
  28.         }
  29.       ]
  30.     },
  31.     {
  32.       "metaApiName": "requester-name",
  33.       "inputs": [
  34.         {
  35.           "inputApiName": "requester-name",
  36.           "inputValue": "Tom Rismeyer"
  37.         }
  38.       ]
  39.     },
  40.     {
  41.       "metaApiName": "requester-department",
  42.       "inputs": [
  43.         {
  44.           "inputApiName": "requester-department",
  45.           "inputValue": "sales"
  46.         }
  47.       ]
  48.     },
  49.     {
  50.       "metaApiName": "party-b-name",
  51.       "inputs": [
  52.         {
  53.           "inputApiName": "party-b-name",
  54.           "inputValue": "guy-mcnobody"
  55.         }
  56.       ]
  57.     },
  58.     {
  59.       "metaApiName": "counterparty-primary-contact",
  60.       "inputs": [
  61.         {
  62.           "inputApiName": "party-b-primary-contact-name",
  63.           "inputValue": "contact@mail.com"
  64.         }
  65.       ]
  66.     },
  67.     {
  68.       "metaApiName": "contract-term",
  69.       "inputs": [
  70.         {
  71.           "inputApiName": "contract-term",
  72.           "inputValue": false
  73.         }
  74.       ]
  75.     },
  76.     {
  77.       "metaApiName": "contract-effective-date",
  78.       "inputs": [
  79.         {
  80.           "inputApiName": "contract-effective-date",
  81.           "inputValue": 1
  82.         }
  83.       ]
  84.     },
  85.     {
  86.       "metaApiName": "renewal-type",
  87.       "inputs": [
  88.         {
  89.           "inputApiName": "renewal-type",
  90.           "inputValue": 1
  91.         }
  92.       ]
  93.     }
  94.   ]
  95. }

I'm getting this error when I submit the form, triggering the deluge function:
  1. Error in creating contract: {"Errors":{"ErrorCode":"ZSEC-JSON_PARSE_ERROR","ErrorMessage":"Sorry, unable to complete your action due to an unknown error. Please try again.","APIErrorMessage":"JSON_PARSE_ERROR"}}

The error message is not very helpful, as it does not specify where it has an issue when parsing the JSON. The API documentation does not specify which fields are required for the Create Contract Endpoint, so I'm either left posting here to request more info, or to just tinker with different combinations of fields included and excluded, so I'm posting here. Can anybody help determine exactly which fields I'm missing, using incorrectly, or other issues with the JSON?


        • Recent Topics

        • Zoho Books | Product updates | October 2025

          Hello users, We’ve rolled out new features and enhancements in Zoho Books. From iOS 26 updates to viewing reports as charts, explore the updates designed to enhance your bookkeeping experience. Zoho Books Updates for Apple Devices At WWDC 2025, Apple
        • Need Inactive accounts to be visible in Reports in Zoho Books

          I N=need Inactive accounts to be visible in Reports in Zoho Books to do recons of the accounts but when i see the same they are not visible in the Accountant - Account Transactions report
        • Edit item custom fields

          Getting this error : Transactions have been created with the custom field. Hence it cannot be deleted. Not trying to delete it, just trying to change which modules to show in or to not show at all in transactions !
        • Zoho Books - How to Invoke a Custom Function in Schedulers

          We have multiple schedulers that send emails to customers in batches. Currently, we are maintaining the same code across several schedulers. Is it possible to use a custom function inside a scheduler script? If yes, how can we invoke the custom function
        • Use Zoho Books to bill for work done in Zoho Desk??

          I'm trying to see if something is possible (and if yes, how). We use Zoho One to manage our business. We have a lot of clients that will put in a ticket (via portal) to have work done. Out techs will pick up the ticket, do the work, and then log the time
        • Zoho Finance Suite - Customer Custom Tabs - Dynamic Link

          Hi Finance Suite team, When creating a Custom Tab for a Client Portal, there is no option to add dynamic parameters. This would be very helpful for adding Zoho Analytics dashboards which can be dynamically filtered through the URL to only show information
        • Modular Permission Levels

          We need more modular Permissions per module in Books we have 2 use cases that are creating problems We need per module export permission we have a use case where users should be able to view the sales orders but not export it, but they can export other
        • Blueprint or Validation Rules for Invoices in Zoho Books

          Can I implement Blueprint or Validation Rules for Invoices in Zoho Books? Example, use case could be, Agent confirms from client that payment is done, but bank only syncs transactions tomorrow. in this case, Agent can update invoice status to done, and
        • When using "locations" in zoho books, can you keep the two locations totally separate from each other?

          I am looking to add a location but I don't want to intermingle the banking or other accounts. I want that to be like two separate independent branches that use different banking accounts, accounts payable, and accounts receivable. The people who are in
        • Feature Enhancement Request – Text Formatting Options in Item Description (Zoho Books/Quotes Module)

          Dear Zoho Development Team, Greetings from Radiant360 Integrated Technical Services LLC. We would like to bring to your attention a functional limitation we've encountered within the Item Table / Quote Description section of Zoho Books (and Zoho CRM Quotes).
        • Add Option to Mass Dispatch by User

          Hello! We are using the dispatch console to dispatch service appointments to our service ressources. Right now, the process is our dispatcher verifies each ressource's route for the day and dispatches it after validation. Sadly, there doesn't seem to
        • Bank Receipt Catagorization

          Hi, how can I match a bank deposit to multiple customer's invoices ? For e.g. A single person paid to us on behalf of different five customers. I need to keep the separated invoices for each customer
        • Per Level Approval for admins

          We need Process admins like Zoho CRM in Zoho Books for per stage approval Currently in books, admins only have the option for Final Approval But for example, in cases like when an employee is on leave, we can't just approval one level we only have option
        • Payment on a past due balance

          Scenario: Customer is past due on their account for 4 months. We suspend their billing in Zoho books. Customer finally logs into the portal and enters a new credit card. We associate that cardwith their subscription, which will permit the card to be used
        • How to export all line-item descriptions for a specific item in Zoho Books?

          I am trying to audit a specific item (“Item X”) that has been invoiced multiple times with different line-level descriptions. Here’s the situation: I am using Zoho Books (Professional). Each invoice may contain the same item but with different descriptions
        • List of hidden features

          Hi Friends, I had another support chat today and low and behold the feature that I wanted just simply needed to be "enabled". I thought I'd share, and maybe see if others had some similar experiences. 1. This one is from 5 ish years ago. I asked if there
        • How to change a BAS that has been filed

          I have discovered that a group of expense transactions were accidentally placed in a asset account rather than an expense account. As a result I need to adjust the transaction and consequently most of my BAS to correct the error. Because the BAS have
        • Standard Payment Term is not pulled from account to quotation

          Hey Team There seems to be something off. I do have "Net 30" as my default payment term in Zoho Books for my customers. If, from the customer overview or quote section, I create a new Quotation, the payment terms field stays blank and doesn't get the
        • How to Export PDF with a custom Template

          I need to export Sales Order with a Custom Template I have created How can I do it? I see an API to export the PDF but how can I choose which template to choose to generate the PDF
        • Updating an Invoice Line Item's Discount Account via API Call / Deluge Custom Function

          I need help updating an invoice line item's discount account via API. Below is a screenshot of the line item field I am referring to. Now the field to the left of the highlighted field (discount account) is the sales income account. I am able to modify
        • Create custom rollup summary fields in Zoho CRM

          Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
        • Associate email with a potential or project.

          I have a pivotal requirement to associate emails from various suppliers (contacts) with different potentials or projects, on an email by email basis as they come in. This question appears to have been raised before but I cannot find a definitive yes "it can be done". Could anyone please tell me, yes or no.  If the later I can stop wasting time and look at alternative crm systems. I would love not to have to do this. Thanks in advance.
        • MTA - BAD IP reputation by outlook/hotmail

          Messages to Microsoft email servers are bouncing back due to poor reputation. Message: 4.7.650 The mail server [136.143.188.206] has been temporarily rate limited due to IP reputation. For e-mail delivery information see https://postmaster.live.com (S775)
        • Function with Search Records was working until a few weeks ago, around when "Connected Records" was released

          I have a custom function that has been running for nearly a year now, which suddenly stopped working around the time Zoho released the "Connected Records" update. The function is no longer finding the record using the searchRecords function. I've changed
        • Is CRM On Premise available

          Hi Zoho team, Can you please let me know that CRM Zoho is available for On Premise as well? Thanks, Devashish
        • How to sync from Zoho Projects into an existing Sprint in Zoho Sprints?

          Hi I have managed to integrate Zoho Projects with Zoho Sprints and I can see that the integration works as a project was created in Zoho Sprints. But, what I would like to do is to sync into an existing Zoho Sprints project. Is there a way to make that
        • Online Assessment or any aptitude test

          This video is really helpful! I have one question — if I share an assessment form link (through email or with the application form on my career page), how does Zoho Recruit evaluate it? Can a candidate use Google or external help while taking the test,
        • How Zoho Desk contributes to the art of savings

          Remember the first time your grandmother gave you cash for a birthday or New Year's gift, Christmas gift, or any special day? You probably tucked that money safely into a piggy bank, waiting for the day you could buy something precious or something you
        • Editing the Ticket Properties column

          This is going to sound like a dumb question, but I cannot figure out how to configure/edit the sections (and their fields) in this column: For example, we have a custom "Resolution" field, which parked itself in the "Ticket Information" section of this
        • Need a way to secure Prefill URLs in Zoho Forms (hide or encrypt prefilled values)

          Hi everyone, I often use Zoho Forms with prefilled URLs to simplify the user experience — for example: https://forms.zohopublic.com/.../form?Name=David&Amount=300 However, the problem is that all prefilled values are visible and editable in the link.
        • Incoming Threads Report

          From data to decisions: A deep dive into ticketing system reports Customers raise questions and issues through multiple channels, such as email, chat, or tickets. To monitor the number of queries received on a specific day from each channel, leads can
        • Conditional layouts - support for multi-select picklists

          Hi, The documentation for conditional layouts says the following: "Layout Rules cannot be used on the following field types: Auto Number Lookup Multi Select Lookup User Lookup Formula File Upload Multi Line" I have a custom module with a multi-pick list
        • How to apply customized Zoho Crm Home Page to all users?

          I have tried to study manuals and play with Zoho CRM but haven't found a way how to apply customized Zoho CRM Home Page as a (default) home page for other CRM users.. How that can be done, if possible? - kipi Moderation Update: Currently, each user has
        • Cloudflare Turnstile is now available in Zoho Forms!

          Hello form builders! We have added a new layer of protection to help you keep your forms free from bots. Instead of forcing users to prove they are human, Cloudflare Turnstile quietly checks browser signals in the background. Your real users glide through,
        • Power of Automation :: Unique Task & Issue Prefix Format and Sequencing Rule

          Hello Everyone, A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate
        • 【Zoho CRM】キャンバス機能のアップデート

          ユーザーの皆さま、こんにちは。コミュニティチームの藤澤です。 今回は「Zoho CRM アップデート情報」の中から、キャンバス機能のアップデートをご紹介します。 目次 グリッドについて フォーム表示のタブについて 1. グリッドについて ビジュアルデザインは細部の調整に手間がかかりますが、キャンバスのグリッドを使えば要素を整理し、バランスよく配置できます。 画像やデータなどの要素をグループ化せずに簡単に配置できます。 余白を調整することで、要素間の視覚的なバランスを保つのに役立ちます。 「表示切り替え基準の幅」を設定すると、デザインをレスポンシブに調整できます。
        • Deleting unwanted ticket replies

          Hello, In a Zoho Desk Ticket thread, sometimes one of the recipients has auto-reply activated. This creates a new message in the Ticket thread that not only pollutes the thread, but most importantly cannot be replied properly because usually auto-reply e-mails don't do "reply all", so the other recipients are not included. I want to delete such a message in the Ticket thread. I searched the help of Zoho Desk, but only found a way to mark as Spam (https://help.zoho.com/portal/kb/articles/marking-support-tickets-as-spam)
        • Issue: Ticket Export Does Not Include Ticket Threads

          Dear Zoho Desk Support Team, I hope you’re doing well. I wanted to bring to your attention that the current ticket export feature in Zoho Desk does not seem to include the ticket threads or conversation history. When exporting tickets, only the summary
        • Ability to Set Client Name During Portal Invitation

          Hi Zoho Team, We would like to suggest an important enhancement to the Zoho Creator Client Portal functionality. Zoho Creator recently introduced the option to set a client’s display name in the Client Portal settings, which is very helpful for creating
        • スマホでキャンペンメールを見ると正しく表示されない

          キャンペーンのメール(HTML)を作成しましたが、スマホ表示に切り替えると正しく表示されません(添付参照)過去に作成したキャンペーンでは特に意識してませんでしたが、問題なく表示されていたようです。うまく表示される場合とされない場合の違いは何でしょうか?
        • Next Page