> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CheckForSpam

# Package: forms

# Namespace: FormSpamSubmissionReportService

# Method link: https://dev.wix.com/docs/api-reference/crm/forms/spam-submissions/check-for-spam.md

## Permission Scopes:
View Forms: SCOPE.FORMS.VIEW-FORM

## Introduction

Checks whether a submission is spam.

Which checks run depends on the form's `spamFilterProtectionLevel` in the [Form Schemas API](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction.md).

This method returns the result only. It doesn't store a form spam submission report. To move a saved submission to spam, call [Report Spam Submission](https://dev.wix.com/docs/api-reference/crm/forms/spam-submissions/report-spam-submission.md). To store a spam submission that wasn't saved, call [Create Form Spam Submission Report](https://dev.wix.com/docs/api-reference/crm/forms/spam-submissions/create-form-spam-submission-report.md).

Supported only for forms in the Wix Forms namespace, `wix.form_app.form`. Calls for forms in other namespaces fail with a permission error.

---

## REST API

### Schema

```
 Method: checkForSpam
 Description: Checks whether a submission is spam.  Which checks run depends on the form's `spamFilterProtectionLevel` in the [Form Schemas API](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction.md).  This method returns the result only. It doesn't store a form spam submission report. To move a saved submission to spam, call [Report Spam Submission](https://dev.wix.com/docs/api-reference/crm/forms/spam-submissions/report-spam-submission.md). To store a spam submission that wasn't saved, call [Create Form Spam Submission Report](https://dev.wix.com/docs/api-reference/crm/forms/spam-submissions/create-form-spam-submission-report.md).  Supported only for forms in the Wix Forms namespace, `wix.form_app.form`. Calls for forms in other namespaces fail with a permission error.
 URL: https://www.wixapis.com/form-spam-submission-report-service/v4/form-spam-submission-reports/check-for-spam
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  submission, submission.formId
 Method parameters: 
   param name: submission | type: FormSubmission | description: Form submission that was created or retrieved. | required: true 
        - name: formId | type: string | description: GUID of the form which the submission belongs to. | required: true | validation: format GUID, immutable
        - name: status | type: SubmissionStatus | description: Status of the submission.  The status a submission is created with depends on the form's namespace and on whether the form collects payment, so read it from the response rather than assuming.  A submission for a form that collects payment starts as `PAYMENT_WAITING`. Otherwise, most namespaces record the submission immediately as `CONFIRMED`. Namespaces that need to complete another step first, such as taking payment for a pricing plan, create the submission as `PENDING` and confirm it later with Confirm Submission.  A `PENDING` submission isn't recorded yet, and is deleted automatically if it isn't confirmed in time.  
             - enum:
             -     PENDING: A submission is created, but has not yet been recorded in the Wix Forms collection.
             -     CONFIRMED: A submission is recorded in the Wix Forms collection.
             -     PAYMENT_WAITING: A form submission requiring payment is created.
             -     PAYMENT_CANCELED: An order of a form submission is canceled.
        - name: submissions | type: Map<string,Value> | description: Values the visitor submitted.  Each key is the `target` of a field in the form schema, which is the field's stable storage key rather than its GUID or label. Only keys matching a field target are accepted.  Each value's shape follows that field's `inputType`: `STRING` fields submit a string, `NUMBER` a number, `BOOLEAN` a boolean, and `ARRAY` an array of the selected option values. Date and time fields are strings. A choice field submits an option's `value`, not its GUID or its label.  3 input types submit structured values: `ADDRESS` submits an address object, `PAYMENT` an array holding 1 product object per item bought, and `SCHEDULING` an appointment object.  For the full mapping, see [About Submission Values](https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/about-submission-values.md).  | validation: format map
           - ONE-OF: 
              - name: nullValue | type:  | description:   
              - name: numberValue | type: number | description:   
              - name: stringValue | type: string | description:   
              - name: boolValue | type: boolean | description:   
              - name: structValue | type: object | description:   
              - name: listValue | type: ListValue | description:   
                 - name: values | type: array<Value> | description:   
        - name: createdDate | type: string | description: Date and time the form submission was created.  | validation: format date-time, immutable
        - name: seen | type: boolean | description: Whether a site owner marked a submission as "seen".  
        - name: extendedFields | type: ExtendedFields | description: Data extension object that holds users' and apps' fields.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
        - name: orderDetails | type: OrderDetails | description: Order details. <br> <b>Note</b>: This object is only applicable when submitting a form in the Wix Payments app.  
        - name: accessRestriction | type: string | description: Authorized viewer GUID.  | validation: format GUID, immutable
        - name: tags | type: PublicTags | description: Tag GUIDs collections associated with the current entity.  
           - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
              - name: tagIds | type: array<string> | description: List of tag GUIDs  | validation: maxItems 100, maxLength 5
        - name: appointmentDetails | type: AppointmentDetails | description: Appointment details. This object is only applicable when submitting a form that creates a booking appointment.  
           - name: staffMemberId | type: string | description: GUID of the staff member assigned to the appointment.  | validation: format GUID
           - name: staffMemberName | type: string | description: Name of the staff member assigned to the appointment.  | validation: minLength 1, maxLength 40
 Return type: CheckForSpamResponse
  - name: spam | type: boolean | description: Whether the submission is spam.  
  - name: spamReport | type: SpamReport | description: Spam details.  Returned only when `spam` is `true`.  
     - name: reportReason | type: ReportReason | description: Reason the submission was flagged as spam.  
         - enum:
         -     EMAIL_QUOTA_REACHED: Too many submissions with the same email address in a short time.
         -     IP_BLOCKLISTED: The submitter's IP address is blocklisted.
         -     EMAIL_BLOCKLISTED: An email address in the submission is blocklisted.
         -     AI_REPORTED: Flagged by an AI model that analyzes the submission text. Runs on forms with the `ADVANCED` spam protection level.
         -     MANUALLY_REPORTED: Reported as spam by a person, such as the site owner or a collaborator.
         -     MODERATION_SPI: Flagged by a spam moderation service plugin installed on the site.
         -     AI_REPORTED_LLM: Flagged by a large language model (LLM) that analyzes the submission text. Runs on forms with the `ADVANCED` spam protection level, after all other checks found no spam.
     - name: reportReasonDescription | type: string | description: Additional details about why the submission was flagged as spam.  Returned only when the submission was flagged by a spam moderation service plugin.  | validation: minLength 1, maxLength 255


```

### Examples

### Check a submission for spam
Checks a submission before it's saved. The response shows it's spam because the email address is blocklisted.

```curl
curl -X POST \
'https://www.wixapis.com/form-spam-submission-report-service/v4/form-spam-submission-reports/check-for-spam' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "submission": {
    "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
    "submissions": {
      "first_name_e7a1": "Alex",
      "email_3c9f": "alex.morgan@example.com",
      "long_answer_b42d": "Buy cheap followers now at bit.ly/xyz"
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.forms.formSpamSubmissionReports.checkForSpam(submission)
 Description: Checks whether a submission is spam.  Which checks run depends on the form's `spamFilterProtectionLevel` in the [Form Schemas API](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction.md).  This method returns the result only. It doesn't store a form spam submission report. To move a saved submission to spam, call [Report Spam Submission](https://dev.wix.com/docs/api-reference/crm/forms/spam-submissions/report-spam-submission.md). To store a spam submission that wasn't saved, call [Create Form Spam Submission Report](https://dev.wix.com/docs/api-reference/crm/forms/spam-submissions/create-form-spam-submission-report.md).  Supported only for forms in the Wix Forms namespace, `wix.form_app.form`. Calls for forms in other namespaces fail with a permission error.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  submission, submission.formId
 Method parameters: 
   param name: submission | type: FormSubmission | description: Form submission that was created or retrieved. | required: true 
        - name: formId | type: string | description: GUID of the form which the submission belongs to. | required: true | validation: format GUID, immutable
        - name: status | type: SubmissionStatus | description: Status of the submission.  The status a submission is created with depends on the form's namespace and on whether the form collects payment, so read it from the response rather than assuming.  A submission for a form that collects payment starts as `PAYMENT_WAITING`. Otherwise, most namespaces record the submission immediately as `CONFIRMED`. Namespaces that need to complete another step first, such as taking payment for a pricing plan, create the submission as `PENDING` and confirm it later with Confirm Submission.  A `PENDING` submission isn't recorded yet, and is deleted automatically if it isn't confirmed in time.  
             - enum:
             -     PENDING: A submission is created, but has not yet been recorded in the Wix Forms collection.
             -     CONFIRMED: A submission is recorded in the Wix Forms collection.
             -     PAYMENT_WAITING: A form submission requiring payment is created.
             -     PAYMENT_CANCELED: An order of a form submission is canceled.
        - name: submissions | type: Map<string,Value> | description: Values the visitor submitted.  Each key is the `target` of a field in the form schema, which is the field's stable storage key rather than its GUID or label. Only keys matching a field target are accepted.  Each value's shape follows that field's `inputType`: `STRING` fields submit a string, `NUMBER` a number, `BOOLEAN` a boolean, and `ARRAY` an array of the selected option values. Date and time fields are strings. A choice field submits an option's `value`, not its GUID or its label.  3 input types submit structured values: `ADDRESS` submits an address object, `PAYMENT` an array holding 1 product object per item bought, and `SCHEDULING` an appointment object.  For the full mapping, see [About Submission Values](https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/about-submission-values.md).  | validation: format map
           - ONE-OF: 
              - name: nullValue | type:  | description:   
              - name: numberValue | type: number | description:   
              - name: stringValue | type: string | description:   
              - name: boolValue | type: boolean | description:   
              - name: structValue | type: object | description:   
              - name: listValue | type: ListValue | description:   
                 - name: values | type: array<Value> | description:   
        - name: _createdDate | type: Date | description: Date and time the form submission was created.  | validation: immutable
        - name: seen | type: boolean | description: Whether a site owner marked a submission as "seen".  
        - name: extendedFields | type: ExtendedFields | description: Data extension object that holds users' and apps' fields.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
        - name: orderDetails | type: OrderDetails | description: Order details. <br> <b>Note</b>: This object is only applicable when submitting a form in the Wix Payments app.  
        - name: accessRestriction | type: string | description: Authorized viewer GUID.  | validation: format GUID, immutable
        - name: tags | type: PublicTags | description: Tag GUIDs collections associated with the current entity.  
           - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
              - name: tagIds | type: array<string> | description: List of tag GUIDs  | validation: maxItems 100, maxLength 5
        - name: appointmentDetails | type: AppointmentDetails | description: Appointment details. This object is only applicable when submitting a form that creates a booking appointment.  
           - name: staffMemberId | type: string | description: GUID of the staff member assigned to the appointment.  | validation: format GUID
           - name: staffMemberName | type: string | description: Name of the staff member assigned to the appointment.  | validation: minLength 1, maxLength 40
 Return type: PROMISE<CheckForSpamResponse>
  - name: spam | type: boolean | description: Whether the submission is spam.  
  - name: spamReport | type: SpamReport | description: Spam details.  Returned only when `spam` is `true`.  
     - name: reportReason | type: ReportReason | description: Reason the submission was flagged as spam.  
         - enum:
         -     EMAIL_QUOTA_REACHED: Too many submissions with the same email address in a short time.
         -     IP_BLOCKLISTED: The submitter's IP address is blocklisted.
         -     EMAIL_BLOCKLISTED: An email address in the submission is blocklisted.
         -     AI_REPORTED: Flagged by an AI model that analyzes the submission text. Runs on forms with the `ADVANCED` spam protection level.
         -     MANUALLY_REPORTED: Reported as spam by a person, such as the site owner or a collaborator.
         -     MODERATION_SPI: Flagged by a spam moderation service plugin installed on the site.
         -     AI_REPORTED_LLM: Flagged by a large language model (LLM) that analyzes the submission text. Runs on forms with the `ADVANCED` spam protection level, after all other checks found no spam.
     - name: reportReasonDescription | type: string | description: Additional details about why the submission was flagged as spam.  Returned only when the submission was flagged by a spam moderation service plugin.  | validation: minLength 1, maxLength 255


```

### Examples

### Check a submission for spam
The response shows it's spam because the email address is blocklisted.

```javascript
import { formSpamSubmissionReports } from "@wix/forms";

async function checkForSpam() {
  const response = await formSpamSubmissionReports.checkForSpam(
    {
      formId: "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
      submissions: {
        first_name_e7a1: "Alex",
        email_3c9f: "alex.morgan@example.com",
        long_answer_b42d: "Buy cheap followers now at bit.ly/xyz"
      }
    },
  );
}

/* Promise resolves to:
 * {
 *   "spam": true,
 *   "spamReport": {
 *     "reportReason": "EMAIL_BLOCKLISTED"
 *   }
 * }
 */

```

### checkForSpam (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { formSpamSubmissionReports } from '@wix/forms';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { formSpamSubmissionReports },
  // Include the auth strategy and host as relevant
});


async function checkForSpam(submission) {
  const response = await myWixClient.formSpamSubmissionReports.checkForSpam(submission);
};
```

---