> 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.

# Create an individual view.

POST https://api.scoutos.com/v2/collections/{collection_id}/views/create
Content-Type: application/json

Reference: https://ref.scoutos.com/api-sdk/endpoints/collections/create-view

## 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)

### Body (application/json)

This endpoint expects a CreateViewRequest.

- `name` (string, required)
- `type` (enum, optional, default: table)
  - Allowed values: `table`, `kanban`
- `emoji` (string, optional, nullable)
- `table_id` (string, optional, nullable)
- `settings` (CreateViewRequestSettings, optional, nullable)
- `visibility` (enum, optional)
  - Allowed values: `personal`, `shared`, `public`
- `shared_with` (list of string, optional)

## Response

### 200

Successful Response

- `success` (boolean, required)
- `data` (ViewResponseData, optional, nullable)
- `error` (string, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### CreateViewRequestSettings

- TableViewSettings: TableViewSettings-Input
- KanbanViewSettings: KanbanViewSettings-Input

### ViewResponseData

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

### ValidationError

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

### TableViewSettings-Input

- `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)

### KanbanViewSettings-Input

- `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)

### 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)

### ValidationErrorLocItems

- string
- integer

### 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)

### CardDisplayField

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

### 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)

### 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`

## Examples

**Request**

```json
{
  "name": "Monthly Sales Overview"
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-ab12-cd34ef567890",
    "name": "Monthly Sales Overview",
    "emoji": "📊",
    "table_id": "tbl_9876543210abcdef",
    "collection_id": "col_1234567890abcdef",
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "created_by": "user_00123",
    "last_updated_by": "user_00456",
    "visibility": "personal",
    "shared_with": [
      "user_00789"
    ],
    "filters": [
      {
        "id": "flt_abc123def456",
        "column_id": "col_sales_region",
        "operator": "equals",
        "value": null,
        "enabled": true,
        "created_at": "2024-01-15T09:30:00Z"
      }
    ],
    "query": {
      "global_search": "Q1 revenue",
      "sort_by": [
        {
          "column_id": "col_revenue",
          "direction": "asc"
        }
      ],
      "limit": 50,
      "offset": 0
    },
    "type": "table",
    "settings": {
      "column_visibility": {},
      "column_order": [
        "col_date",
        "col_sales_region",
        "col_revenue"
      ],
      "column_widths": {},
      "type": "table",
      "row_height": "medium",
      "show_row_numbers": true,
      "wrap_text": true,
      "filters": [
        {
          "id": "flt_abc123def456",
          "column_id": "col_sales_region",
          "operator": "equals",
          "value": null,
          "enabled": true,
          "created_at": "2024-01-15T09:30:00Z"
        }
      ]
    }
  },
  "error": ""
}
```

**SDK Code**

```python
import requests

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

payload = { "name": "Monthly Sales Overview" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

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

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

```

```go
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"name\": \"Monthly Sales Overview\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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/create")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Monthly Sales Overview\"\n}"

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.post("https://api.scoutos.com/v2/collections/collection_id/views/create")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Monthly Sales Overview\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.scoutos.com/v2/collections/collection_id/views/create', [
  'body' => '{
  "name": "Monthly Sales Overview"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.scoutos.com/v2/collections/collection_id/views/create");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Monthly Sales Overview\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["name": "Monthly Sales Overview"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```