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

# Delete Records by Criteria

> You can delete records by criteria.

#### Recipes

<AccordionGroup>
  <Accordion title="Delete records by criteria with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {2} theme={null}
        curl -X DELETE \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -d 'score_value[gt]=5000&expert_mode=true' \
        https://api.quickblox.com/data/ScoreTable/by_criteria.json
        ```
      </Step>

      <Step title="2. As a result, the API returns the number of deleted records.">
        ```json theme={null}
        {
          "total_deleted": 2
        }
        ```
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

You can use all search operators listed below the request.

**Search operators**

The request can contain all, some or none of the next search operators:

| Operator | Description                                                                                                                                                                                                                                                                                               |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| lt       | **Less Than** operator  <br />  <br />Types: integer, float  <br />  <br />Example:  <br />score\_value\[lt]=1000                                                                                                                                                                                         |
| lte      | **Less Than or Equal to** operator  <br />  <br />Types: integer, float  <br />  <br />Example:  <br />score\_value\[lte]=850                                                                                                                                                                             |
| gt       | **Greater Than** operator  <br />  <br />Types: integer, float  <br />  <br />Example:  <br />bonus\_count\[gt]=2.45                                                                                                                                                                                      |
| gte      | **Greater Than or Equal to** operator  <br />  <br />Types: integer, float  <br />  <br />Example:  <br />bonus\_count\[gte]=56.443                                                                                                                                                                       |
| ne       | **Not Equal to** operator  <br />  <br />Types: integer, float, string, boolean  <br />  <br />Example:  <br />game\_mode\_name\[ne]=ctf                                                                                                                                                                  |
| in       | **Contained IN array** operator  <br />  <br />Types: integer, float, string  <br />  <br />Example:  <br />game\_mode\_name\[in]=deathmatch,rage                                                                                                                                                         |
| nin      | **Not contained IN array** operator  <br />  <br />Types: integer, float, string  <br />  <br />Example:  <br />game\_mode\_name\[nin]=survivor,crazy\_nightmare                                                                                                                                          |
| all      | **ALL contained IN array** operator  <br />  <br />Types: array  <br />  <br />Example:  <br />game\_modes\[all]=survivor,crazy                                                                                                                                                                           |
| or       | **OR** operator  <br />  <br />  <br />Types: integer, float, string  <br />  <br />Example:  <br />name\[or]=sam,tim  <br />name\[or]=sam\&lastname\[or]=johnson  <br />  <br />Will return records with name `sam` **or** `tim`.  <br />Will return records with name `sam` **or** last name `johnson`. |
| ctn      | **Contains** substring operator  <br />  <br />Types: string  <br />  <br />Example:  <br />username\[ctn]=son  <br />  <br />Will return all records where `username` field **contains** `son` substring.                                                                                                |
| near     | Types: location  <br />  <br />Example:  <br />mylocation\[near]=25.32,44.551;1000  <br />  <br />Search records in a specific radius with the current position in meters. Format: `{field_name}[near]=longitude,latitude;radius`.                                                                        |

#### Path Parameters

<ParamField path="class_name" type="string" required>
  Custom object class name.
</ParamField>

#### Body Parameters

<ParamField body="{custom_field_N}" type="string">
  Search records with the field that contains the specified value.
</ParamField>

<ParamField body="{custom_field_M}" type="object">
  <Expandable title="{custom_field_M} object">
    <ParamField body="{search_operator}" type="string">
      Search a record with the field that contains a value according to the specified value and operator.
    </ParamField>
  </Expandable>
</ParamField>

#### Headers

<ParamField header="QB-Token" type="string" required> A user or application session token. See [Authentication](/reference/authentication) page to learn more about session tokens. Must be used either QB-Token or Authorization. </ParamField>

<ParamField header="Authorization" type="string" default="ApiKey {your_api_key}">
  API key from Dashboard. Expected format: `ApiKey {your_api_key}`. Must be used
  either QB-Token or Authorization.
</ParamField>

<ParamField header="On-Behalf-Of" type="string">
  User ID. The user ID of the user on whose behalf the request is being made.
</ParamField>

#### Responses

<AccordionGroup>
  <Accordion title="200">
    A successful response

    <ResponseField name="total_deleted" type="integer" />
  </Accordion>

  <Accordion title="400">
    An error response
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE \
  -H "QB-Token: d9c91a69e552145f6fe24dbb40b50ac575012bba" \
  -d 'score_value[gt]=5000&expert_mode=true' \
  https://api.quickblox.com/data/ScoreTable/by_criteria.json
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "total_deleted": 2
  }
  ```

  ```json 400 theme={null}
  {}
  ```
</ResponseExample>
