> ## 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 access control

> Set who can open the form. `no` is open to everyone. `basic` needs a password. `email` allows only emails that match `allowed_keywords`. `session` needs a login. `invited` allows only invited emails.

> [!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}/access_control
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}/access_control:
    patch:
      tags:
        - Access Control
      summary: Update access control
      description: >-
        Set who can open the form. `no` is open to everyone. `basic` needs a
        password. `email` allows only emails that match `allowed_keywords`.
        `session` needs a login. `invited` allows only invited emails.
      parameters:
        - $ref: '#/components/parameters/api_key_header'
        - $ref: '#/components/parameters/form_id_param'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - access_control
              properties:
                access_control:
                  type: object
                  properties:
                    auth:
                      type: string
                      enum:
                        - 'no'
                        - basic
                        - email
                        - session
                        - invited
                      description: Type of access control.
                      example: basic
                    password:
                      type: string
                      minLength: 4
                      description: Password for the form. Required when `auth` is `basic`.
                    allowed_keywords:
                      type: array
                      items:
                        type: string
                      description: >-
                        Email addresses or domains that can open the form. Used
                        when `auth` is `email`.
                      example:
                        - '@example.com'
      responses:
        '200':
          description: OK - Access control updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/access_control_response'
        '400':
          $ref: '#/components/responses/response_missing_body'
        '404':
          $ref: '#/components/responses/response_form_not_found'
        '422':
          description: Unprocessable Entity - A value is not valid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_response'
              example:
                error: Password is too short (minimum is 4 characters)
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:
    access_control_response:
      type: object
      properties:
        access_control:
          $ref: '#/components/schemas/access_control'
    error_response:
      type: object
      properties:
        error:
          type: string
    access_control:
      type: object
      properties:
        auth:
          type: string
          enum:
            - 'no'
            - basic
            - email
            - session
            - invited
          example: basic
        has_password:
          type: boolean
          description: Whether a password is set. The password is never returned.
          example: true
        allowed_keywords:
          type: array
          items:
            type: string
          example: []
        invitations_count:
          type: integer
          example: 0
  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.