NetSuite REST icon

NetSuite REST

Call NetSuite SuiteTalk REST operations.

Actions979

Coupon Code → Insert or update record

AI-generated

Summary

Update an existing or create a coupon code record via the NetSuite REST API.

Inputs

  • isDebugMode — Include full request and response information in the output.
  • id (required) — External or internal identifier used in the URL path (PUT /couponCode/{id}).
  • code — The coupon code string that customers enter on sales transactions.
  • dateSent — Timestamp when the coupon code was sent to the recipient.
  • externalId — External ID of the record, if applicable.
  • internalId — Internal ID of the record, if applicable.
  • Prefer — Set to 'respond-async' to execute the request asynchronously.
  • Promotion — Optional reference to a Promotion record – provide either internalId or externalId.
  • Recipient — Optional reference to a Recipient record – provide either internalId or externalId.
  • refName — Reference name for the coupon code record.
  • replace — Comma‑separated list of sublist names to replace entirely.
  • replaceSelectedFields — When true, all fields to delete must also be specified in the replace parameter.
  • used — Mark the coupon as used by the recipient.
  • useCount — Number of times the coupon has been used.
  • X-NetSuite-Idempotency-Key — UUID string to ensure asynchronous requests are processed only once.
  • X-NetSuite-PropertyNameValidation — Strictness level for property name validation: Error, Warning, or Ignore.
  • X-NetSuite-PropertyValueValidation — Strictness level for property value validation: Error, Warning, or Ignore.
  • customFields — One or more custom field entries, each specifying fieldName, fieldType, and the matching value (e.g., boolean, dateTime, multiSelect, number, select, string).

Output shape

a single coupon code record (JSON) representing the updated or created entry, optionally wrapped in a debug object when debug mode is enabled.

When Debug Mode is true, the output contains an object with fields request, response, and data. Without debug mode, only the updated record data is returned. The structure mirrors NetSuite’s REST response for the Coupon Code resource.

Examples

Example 1: Update the coupon code "SAVE10" for an existing record with external ID 123

Set operation to "Insert or update record", Resource "Coupon Code", isDebugMode: false, id: "123", code: "SAVE10".

Example 2: Create a new single‑use coupon code "NEWCODE" with external ID 456 and mark it unused

Set externalId to 456, code to "NEWCODE", used: false, isDebugMode: false, id: use the externalId or leave empty to let NetSuite assign.

Example 3: Generate full request/response logs for debugging the creation of a coupon

Enable isDebugMode: true, set id: "789", code: "DEBUGCODE", prefer: "respond-async", and any other desired fields.

Discussion