> For a complete page index, fetch https://developer.close.com/llms.txt

# List Smart Views

GET https://api.close.com/api/v1/saved_search/

Accepts:

- A `type` filter that accepts either `lead` or `contact`. Defaults to `lead`.
- A `type__in` filter that can be used to select multiple comma-separated types: `lead,contact`.

Reference: https://developer.close.com/api/resources/smart-views/list

## Authentication

- `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty.
- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `_limit` (integer, optional, default: 100) — Number of results to return.
- `_skip` (integer, optional, default: 0) — Number of results to skip before returning, for pagination.
- `type` (enum, optional, nullable)
  - Allowed values: `lead`, `contact`, `opportunity`, `call`, `email`, `sms`, `meeting`, `note`, `whatsapp_message`, `custom_activity`, `form_submission`
- `type__in` (list of enum, optional)
  - Allowed values: `lead`, `contact`, `opportunity`, `call`, `email`, `sms`, `meeting`, `note`, `whatsapp_message`, `custom_activity`, `form_submission`

## Response

### 200

Successful response

- `data` (list of SavedSearch, required) — The results on this page.
- `has_more` (boolean, required) — Whether more results exist after this page.

## Errors

### 400 Bad Request Error

Bad request, such as a validation error.

- `Smart_views_listRequestBadRequestError`
  - ErrorMessage: ErrorMessage
  - ValidationErrors: ValidationErrors
  - NestedValidationErrors: NestedValidationErrors

### 401 Unauthorized Error

Authentication is missing or invalid.

- `error` (string, required) — Error message.

### 403 Forbidden Error

Forbidden. Also returned when the API key lacks the required scope (`error_code` is `insufficient_scope`) or is inactive (`error_code` is `inactive_api_key`).

- `Smart_views_listRequestForbiddenError`
  - ErrorMessage: ErrorMessage
  - ApiKeyError: ApiKeyError

### 429 Too Many Requests Error

Too many requests. The global API rate limiter returns an empty body. Other rate and operation limits return a `RateLimitError` body. Wait for the number of seconds in the `retry-after` header before retrying.

- `error` (RateLimitErrorError, required)

## Types

### SavedSearch

- `date_created` (datetime, required)
- `date_updated` (datetime, required)
- `description` (string, required, nullable)
- `id` (string, required)
- `is_shared` (boolean, required)
- `is_user_dependent` (boolean, required, nullable)
- `name` (string, required)
- `organization_id` (string, required)
- `query` (string, required, nullable)
- `s_query` (map from string to any, required, nullable)
- `type` (enum, required)
  - Allowed values: `lead`, `contact`, `opportunity`, `call`, `email`, `sms`, `meeting`, `note`, `whatsapp_message`, `custom_activity`, `form_submission`
- `user_id` (string, required, nullable)
- `selected_fields` (list of map from string to any, optional, nullable)
- `shared_with` (list of string, optional, nullable)
- `sharing_settings` (SharingSettingsEmbeddedResponse, optional, nullable)

### ErrorMessage

Error with a message.

- `error` (string, required) — Error message.

### ValidationErrors

Validation errors with the path of each invalid field.

- `errors` (list of ValidationErrorsErrorsItems, required)

### NestedValidationErrors

Validation errors nested by field. Some endpoints return only `errors` or only `field-errors`.

- `errors` (list of string, optional) — Errors that don't apply to a single field.
- `field-errors` (map from string to any, optional) — Errors keyed by field name. Each value is a message, a list of messages, or a nested object of the same shape for nested fields.

### ApiKeyError

The API key lacks the scope the request requires, or is inactive.

- `error` (string, required)
- `error_code` (enum, required)
  - Allowed values: `insufficient_scope`, `inactive_api_key`
- `required_scope` (string, optional) — API key scope the request requires. Present when `error_code` is `insufficient_scope`.

### RateLimitErrorError

- `message` (string, required, nullable)
- `rate_reset` (string, required) — Number of seconds until the rate limit resets.
- `allowed_limit` (integer, optional) — Maximum number of bulk actions allowed. Present when the bulk action limit was hit.
- `bulk_action_count` (integer, optional) — Number of bulk actions running. Present when the bulk action limit was hit.

### SharingSettingsEmbeddedResponse

- `created_at` (datetime, required, nullable)
- `created_by_id` (string, required, nullable)
- `group_ids` (list of string, required)
- `updated_at` (datetime, required, nullable)
- `updated_by_id` (string, required, nullable)
- `user_ids` (list of string, required)
- `whole_org` (boolean, required)

### ValidationErrorsErrorsItems

- `field` (list of ValidationErrorsErrorsItemsFieldItems, required) — Path of the invalid field. Empty for errors that don't apply to a field.
- `msg` (string, required)

### ValidationErrorsErrorsItemsFieldItems

- integer
- string

## Examples

**Response**

```json
{
  "data": [
    {
      "date_created": "2021-05-20T18:37:35.936000+00:00",
      "date_updated": "2021-05-20T18:37:35.936000+00:00",
      "description": "",
      "id": "save_cxgvcccaFJh6uGE3S6x8YYt61TLTd6MG4JiYLD1Eaja",
      "is_shared": true,
      "is_user_dependent": false,
      "name": "All Leads",
      "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH",
      "query": null,
      "s_query": {
        "query": {
          "negate": false,
          "type": "match_all"
        },
        "results_limit": null,
        "sort": []
      },
      "type": "lead",
      "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
    },
    {
      "date_created": "2021-05-20T18:42:47.015000+00:00",
      "date_updated": "2021-05-20T18:42:47.015000+00:00",
      "description": "",
      "id": "save_fV7sewhM4FOCFs1m677k2OuxV8RuzUKMHxH8OQEEUjU",
      "is_shared": false,
      "is_user_dependent": false,
      "name": "All Contacts",
      "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH",
      "query": null,
      "s_query": {
        "query": {
          "negate": false,
          "type": "match_all"
        },
        "results_limit": null,
        "sort": []
      },
      "type": "contact",
      "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
    }
  ],
  "has_more": false
}
```

**SDK Code**

```python smart_views_list_example
import requests

url = "https://api.close.com/api/v1/saved_search/"

response = requests.get(url, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript smart_views_list_example
const url = 'https://api.close.com/api/v1/saved_search/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go smart_views_list_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.close.com/api/v1/saved_search/"

	req, _ := http.NewRequest("GET", url, nil)

	req.SetBasicAuth("<CLOSE_API_KEY>", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby smart_views_list_example
require 'uri'
require 'net/http'

url = URI("https://api.close.com/api/v1/saved_search/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request.basic_auth("<CLOSE_API_KEY>", "")

response = http.request(request)
puts response.read_body
```

```java smart_views_list_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.close.com/api/v1/saved_search/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .asString();
```

```php smart_views_list_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.close.com/api/v1/saved_search/', [
  'headers' => [
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

echo $response->getBody();
```

```csharp smart_views_list_example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/saved_search/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.GET);

IRestResponse response = client.Execute(request);
```