> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://ref.scoutos.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://ref.scoutos.com/_mcp/server.

# Get view state for a collection.

GET https://api.scoutos.com/v2/collections/{collection_id}/views

Reference: https://ref.scoutos.com/api-sdk/endpoints/collections/get-views

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `collection_id` (string, required)

## Response

### 200

Successful Response

- `success` (boolean, required)
- `data` (CollectionViewState-Output, optional, nullable) — Complete view state for a collection
- `error` (string, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### CollectionViewState-Output

Complete view state for a collection

- `organization_id` (string, required)
- `collection_id` (string, required)
- `views` (map from string to CollectionViewStateOutputViews, optional)
- `view_ids` (list of string, optional)
- `active_view_id` (string, optional, nullable)
- `active_table_id` (string, optional, nullable)
- `display_settings` (map from string to any, optional)
- `last_synced_at` (datetime, optional, nullable)
- `created_at` (datetime, optional)
- `updated_at` (datetime, optional)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### CollectionViewStateOutputViews

- TableView: TableView-Output
- KanbanView: KanbanView-Output

### ValidationErrorLocItems

- string
- integer

### TableView-Output

- `id` (string, required)
- `name` (string, required)
- `collection_id` (string, required)
- `settings` (TableViewSettings-Output, required)
- `emoji` (string, optional, nullable)
- `table_id` (string, optional, nullable)
- `created_at` (datetime, optional, nullable)
- `updated_at` (datetime, optional, nullable)
- `created_by` (string, optional, nullable)
- `last_updated_by` (string, optional, nullable)
- `visibility` (enum, optional)
  - Allowed values: `personal`, `shared`, `public`
- `shared_with` (list of string, optional)
- `filters` (list of ViewFilter, optional)
- `query` (ViewQuery-Output, optional)
- `type` ("table", optional)

### KanbanView-Output

- `id` (string, required)
- `name` (string, required)
- `collection_id` (string, required)
- `settings` (KanbanViewSettings-Output, required)
- `emoji` (string, optional, nullable)
- `table_id` (string, optional, nullable)
- `created_at` (datetime, optional, nullable)
- `updated_at` (datetime, optional, nullable)
- `created_by` (string, optional, nullable)
- `last_updated_by` (string, optional, nullable)
- `visibility` (enum, optional)
  - Allowed values: `personal`, `shared`, `public`
- `shared_with` (list of string, optional)
- `filters` (list of ViewFilter, optional)
- `query` (ViewQuery-Output, optional)
- `type` ("kanban", optional)

### TableViewSettings-Output

- `column_visibility` (map from string to boolean, optional)
- `column_order` (list of string, optional)
- `column_widths` (map from string to integer, optional)
- `column_pinned_count` (integer, optional, default: 0)
- `type` ("table", optional)
- `row_height` (enum, optional, default: medium)
  - Allowed values: `compact`, `medium`, `tall`
- `show_row_numbers` (boolean, optional, default: false)
- `wrap_text` (boolean, optional, default: false)
- `filters` (list of ViewFilter, optional)

### ViewFilter

- `column_id` (string, required)
- `value` (any, required)
- `id` (string, optional)
- `operator` (enum, optional)
  - Allowed values: `equals`, `not_equals`, `contains`, `not_contains`, `starts_with`, `ends_with`, `is_empty`, `is_not_empty`, `greater_than`, `less_than`, `greater_than_or_equal`, `less_than_or_equal`, `between`, `in`, `not_in`, `date_is`, `date_before`, `date_after`, `date_between`, `date_is_empty`, `date_is_not_empty`, `is_true`, `is_false`
- `enabled` (boolean, optional, nullable, default: true)
- `created_at` (datetime, optional)

### ViewQuery-Output

- `global_search` (string, optional, nullable)
- `sort_by` (list of QuerySort, optional)
- `limit` (integer, optional, nullable)
- `offset` (integer, optional, nullable)

### KanbanViewSettings-Output

- `grouping_column` (string, required)
- `column_visibility` (map from string to boolean, optional)
- `column_order` (list of string, optional)
- `column_widths` (map from string to integer, optional)
- `column_pinned_count` (integer, optional, default: 0)
- `type` ("kanban", optional)
- `group_visibility` (map from string to boolean, optional)
- `group_order` (list of string, optional)
- `card_display_fields` (list of CardDisplayField, optional)
- `card_compact_mode` (boolean, optional, default: false)
- `card_image_field` (string, optional, nullable)
- `filters` (list of ViewFilter, optional)

### QuerySort

- `column_id` (string, required)
- `direction` (enum, required)
  - Allowed values: `asc`, `desc`

### CardDisplayField

- `column_id` (string, required)
- `type` (string, optional, nullable)
- `visible` (boolean, optional, default: true)

## Examples

**Response**

```json
{
  "success": true,
  "data": {
    "organization_id": "org_987654321",
    "collection_id": "col_123456789",
    "views": {
      "view_01": {
        "id": "view_01",
        "name": "All Items",
        "type": "grid",
        "filters": [
          {
            "field": "status",
            "operator": "equals",
            "value": "active"
          }
        ],
        "sort": [
          {
            "field": "created_at",
            "direction": "desc"
          }
        ]
      },
      "view_02": {
        "id": "view_02",
        "name": "Completed Tasks",
        "type": "kanban",
        "filters": [
          {
            "field": "status",
            "operator": "equals",
            "value": "completed"
          }
        ],
        "sort": [
          {
            "field": "due_date",
            "direction": "asc"
          }
        ]
      }
    },
    "view_ids": [
      "view_01",
      "view_02"
    ],
    "active_view_id": "view_01",
    "active_table_id": "table_12345",
    "display_settings": {
      "theme": "light",
      "show_row_numbers": true,
      "page_size": 50
    },
    "last_synced_at": "2024-01-15T09:30:00Z",
    "created_at": "2023-11-20T08:15:00Z",
    "updated_at": "2024-01-10T16:45:00Z"
  },
  "error": ""
}
```

**SDK Code**

```python
import requests

url = "https://api.scoutos.com/v2/collections/collection_id/views"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```typescript
import { ScoutClient } from "scoutos";

const client = new ScoutClient({ apiKey: "YOUR_API_KEY" });
await client.collections.getViews("collection_id");

```

```go
package main

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

func main() {

	url := "https://api.scoutos.com/v2/collections/collection_id/views"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://api.scoutos.com/v2/collections/collection_id/views")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.get("https://api.scoutos.com/v2/collections/collection_id/views")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.scoutos.com/v2/collections/collection_id/views', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.scoutos.com/v2/collections/collection_id/views");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.scoutos.com/v2/collections/collection_id/views")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```