> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.neetoform.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update discount codes of a form

> Set the discount codes that the form accepts. The list you send replaces the current list. Send an empty list to remove all codes.

> [!NOTE]
>
> Replace `{your-subdomain}` with your workspace’s subdomain. \
> Learn how to find your subdomain in [Workspace subdomain](https://apidocs.neetoform.com/api/workspace-subdomain.md).


## OpenAPI

````yaml bundled/form-settings.yaml PATCH /forms/{form_id}/discount_codes
openapi: 3.0.3
info:
  title: NeetoForm Form Settings APIs
  version: 2.0.0
servers:
  - description: NeetoForm APIs
    url: https://{your-subdomain}.neetoform.com/api/external/v2
    variables:
      your-subdomain:
        default: spinkart
        description: >-
          Replace **spinkart** with your [workspace's
          subdomain](/api/workspace-subdomain).
security: []
paths:
  /forms/{form_id}/discount_codes:
    patch:
      tags:
        - Form Discount Codes
      summary: Update discount codes of a form
      description: >-
        Set the discount codes that the form accepts. The list you send replaces
        the current list. Send an empty list to remove all codes.
      parameters:
        - $ref: '#/components/parameters/api_key_header'
        - $ref: '#/components/parameters/form_id_param'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - discount_codes
              properties:
                discount_codes:
                  type: object
                  properties:
                    ids:
                      type: array
                      maxItems: 100
                      items:
                        type: string
                      description: >-
                        IDs of the discount codes to enable. Get them from the
                        [List discount codes of a
                        form](/api/form-settings/list-discount-codes) API.
                      example:
                        - 1f2e5a52-7a0e-4f2b-9d57-3d6a1a2f9c11
      responses:
        '200':
          description: OK - Discount codes updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/enabled_discount_codes_response'
        '400':
          $ref: '#/components/responses/response_missing_body'
        '404':
          $ref: '#/components/responses/response_form_not_found'
        '422':
          description: >-
            Unprocessable Entity - A fixed-amount code does not match the
            currency of the form
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_response'
              example:
                error: >-
                  A fixed-amount code can only be enabled on a form whose
                  payment currency matches the code's currency.
components:
  parameters:
    api_key_header:
      in: header
      name: X-Api-Key
      description: >-
        Use the X-Api-Key header to provide your workspace API key. Refer to
        [Authentication](/api/authentication) for more information.
      required: true
      schema:
        type: string
        default: your-api-key
    form_id_param:
      in: path
      name: form_id
      description: >-
        Unique ID of the form. Refer to [Getting the Form
        ID](/api/getting-form-id) for detailed instructions.
      required: true
      schema:
        type: string
  schemas:
    enabled_discount_codes_response:
      type: object
      properties:
        enabled_discount_code_ids:
          type: array
          items:
            type: string
          example:
            - 1f2e5a52-7a0e-4f2b-9d57-3d6a1a2f9c11
    error_response:
      type: object
      properties:
        error:
          type: string
  responses:
    response_missing_body:
      description: Bad Request - The request body is missing its root key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_response'
    response_form_not_found:
      description: Not Found - The form does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_response'
          example:
            error: Form does not exist.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.