# Company search available fields

> Discover the filters accepted by the Company Search endpoint.

## Introduction

This endpoint returns metadata describing every filter accepted by [Company search](https://docs.reversecontact.com/endpoints/search-companies). It lets integrations (for example Clay) discover available inputs dynamically instead of hardcoding the filter list, so new search capabilities surface automatically as we release them.

Like [Usage](https://docs.reversecontact.com/endpoints/usage), this route uses `GET`, takes no request body, and **costs 0 credits**.

> Looking for people filters? See [People search available fields](https://docs.reversecontact.com/endpoints/search-people-available-fields).

## Endpoint

| Method | URL                                     | Describes      |
| ------ | --------------------------------------- | -------------- |
| `GET`  | `/v2/search/companies/available-fields` | Company Search |

## Authorization

| Name     | Type   | Required | Description                                                                                         |
| -------- | ------ | -------- | --------------------------------------------------------------------------------------------------- |
| `apikey` | string | Yes      | Your API key from the developer dashboard. Pass it via `Authorization: Bearer YOUR_API_KEY` header. |

## Response structure

| Field     | Type    | Description                                      |
| --------- | ------- | ------------------------------------------------ |
| `success` | boolean | `true` if the request was processed successfully |
| `error`   | `null`  | Always `null` on success                         |

**data** (SearchFields): Container for the discovered fields

| Field    | Type     | Description                                       |
| -------- | -------- | ------------------------------------------------- |
| `object` | string   | Always `"search_fields"`                          |
| `entity` | string   | Always `"company"` for this endpoint              |
| `fields` | `Field[]` | List of accepted filters (see field shape below)  |

**fields** (Field): One accepted search filter

| Field          | Type      | Description                                                                       |
| -------------- | --------- | --------------------------------------------------------------------------------- |
| `name`         | string    | Filter name, used as a key in the search request body                             |
| `type`         | string    | `string`, `boolean`, `number`, `range`, `location`, `date-time`, or `string \| string[]` |
| `required`     | boolean   | Whether the filter is mandatory (always `false` today; all filters are optional)  |
| `description`  | string    | Human-readable explanation of the filter                                          |
| `example`      | unknown   | Example value, when helpful (optional)                                            |
| `allowedValues`| `unknown[]` | Closed set of accepted values, when applicable (e.g. `[true, false]`) (optional) |
| `properties`   | object    | Sub-field shapes for `range` and `location` filters (optional)                    |

## Code examples

**Code Examples**

```bash [cURL]
curl https://api.reversecontact.com/v2/search/companies/available-fields \
  -H "Authorization: Bearer YOUR_API_KEY"
```
```javascript [JavaScript]
const response = await fetch(
  "https://api.reversecontact.com/v2/search/companies/available-fields",
  {
    headers: {
      "Authorization": "Bearer YOUR_API_KEY"
    }
  }
);

const data = await response.json();
console.log(data.data.fields.map((f) => f.name));
```
```python [Python]
import requests

response = requests.get(
    "https://api.reversecontact.com/v2/search/companies/available-fields",
    headers={
        "Authorization": "Bearer YOUR_API_KEY"
    }
)

data = response.json()
print([f["name"] for f in data["data"]["fields"]])
```

## Example response

**Example Response**

```json [200 - Success]
{
  "success": true,
  "data": {
    "object": "search_fields",
    "entity": "company",
    "fields": [
      {
        "name": "companyName",
        "type": "string",
        "required": false,
        "description": "Filter by company name"
      },
      {
        "name": "industry",
        "type": "string | string[]",
        "required": false,
        "description": "Industry name or array of industries"
      },
      {
        "name": "employeeCountRange",
        "type": "range",
        "required": false,
        "description": "Filter by employee count range. Both bounds are optional and inclusive (range 0 - 1,000,000,000).",
        "properties": {
          "min": { "type": "number", "description": "Minimum value, inclusive" },
          "max": { "type": "number", "description": "Maximum value, inclusive" }
        }
      }
    ]
  },
  "error": null,
  "quotas": {
    "creditsConsumed": 0,
    "workspace": {
      "id": "ws_abc123",
      "credits": { "total": 10000, "used": 4521, "left": 5479 }
    }
  },
  "metadata": {
    "requestId": "req_f1e2l3d4s5",
    "executionTimeMs": 3
  }
}
```
