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

# Create view

POST http://localhost:8000/api/dm/views/
Content-Type: application/json

Create a view for a specific project.

Reference: https://api.labelstud.io/api-reference/api-reference/views/create

## Authentication

- `Authorization` header (required) (prefixed with ` Token   `) — The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: curl [https://label-studio-host/api/projects](https://label-studio-host/api/projects) -H "Authorization: Token \[your-token]"

## Request

### Body (application/json)

This endpoint expects a ViewRequestRequest.

- `data` (ViewDataRequestRequest, optional) — Established public view payload nested under ``data``.
- `project` (integer, optional) — Project ID

## Response

### 201

- `id` (integer, required)
- `locked_by` (ViewLockedBy, required, nullable)
- `project` (integer, required) — Project ID
- `data` (any, optional, nullable) — Custom view data
- `filter_group` (FilterGroup, optional)
- `is_locked` (boolean, optional, nullable) — Whether this data manager tab is locked against configuration changes
- `locked_at` (datetime, optional, nullable) — Time when this view was locked
- `order` (integer, optional, nullable) — Position of the tab, starting at the left in data manager and increasing as the tabs go left to right
- `ordering` (any, optional, nullable) — Ordering parameters
- `selected_items` (any, optional, nullable) — Selected items
- `user` (integer, optional, nullable) — User who made this view

## Types

### ViewDataRequestRequest

Established public view payload nested under ``data``.

- `filters` (PrepareParamsFiltersRequest, optional, nullable) — Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
- `ordering` (list of enum, optional, nullable) — List of fields to order by. Fields are similar to filters but without the `filter:` prefix. To reverse the order, add a minus sign before the field name, e.g. `-tasks:created_at`.
  - Allowed values: `tasks:agreement`, `tasks:annotations_results`, `tasks:annotators`, `tasks:cancelled_annotations`, `tasks:comments`, `tasks:completed_at`, `tasks:created_at`, `tasks:file_upload`, `tasks:ground_truth`, `tasks:id`, `tasks:inner_id`, `tasks:predictions_model_versions`, `tasks:predictions_results`, `tasks:predictions_score`, `tasks:reviewed`, `tasks:reviewers`, `tasks:reviews_accepted`, `tasks:reviews_rejected`, `tasks:total_annotations`, `tasks:total_predictions`, `tasks:unresolved_comment_count`, `tasks:updated_at`

### ViewLockedBy

- `email` (string, optional)
- `id` (integer, optional)
- `name` (string, optional)

### FilterGroup

- `conjunction` (string, required) — Type of conjunction
- `filters` (list of Filter, required)
- `id` (integer, required)

### PrepareParamsFiltersRequest

Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`

- `conjunction` (enum, required) — Logical conjunction for the filters. This conjunction (either "or" or "and") will be applied to all items in the filters list. It is not possible to combine "or" and "and" within one list of filters. All filters will be either combined with "or" or with "and", but not a mix of both.
  - Allowed values: `or`, `and`
- `items` (list of PrepareParamsFiltersRequestItemsItems, required) — List of filter items

### Filter

- `column` (string, required) — Field name
- `id` (integer, required)
- `operator` (string, required) — Filter operator
- `type` (string, required) — Field type
- `child_filters` (list of ChildFilter, optional)
- `index` (integer, optional, nullable) — Display order among root filters only
- `parent` (integer, optional, nullable) — Optional parent filter to create one-level hierarchy (child filters are AND-merged with parent)
- `value` (any, optional, nullable) — Filter value

### PrepareParamsFiltersRequestItemsItems

- `filter` (enum, required) — Filter identifier, it should start with `filter:tasks:` prefix, e.g. `filter:tasks:agreement`. For `task.data` fields it may look like `filter:tasks:data.field_name`. If you need more info about columns, check the Get data manager columns API endpoint. Possible values:`filter:tasks:agreement` (Number) Agreement for annotation results for a specific task (Enterprise only)`filter:tasks:annotations_results` (String) Annotation results for the tasks`filter:tasks:annotators` (List) Annotators that completed the task (Community). Can include assigned annotators (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer`filter:tasks:cancelled_annotations` (Number) Number of cancelled or skipped annotations for the task`filter:tasks:comments` (Number) Number of comments in a task`filter:tasks:completed_at` (Datetime) Latest annotation time, set once the task has all required annotations`filter:tasks:created_at` (Datetime) Time the task was created at`filter:tasks:file_upload` (String) Name of the file uploaded to create the tasks`filter:tasks:ground_truth` (Boolean) Ground truth status of the tasks`filter:tasks:id` (Number) Task ID`filter:tasks:inner_id` (Number) Task Inner ID, it starts from 1 for all projects`filter:tasks:predictions_model_versions` (String) Model version used for the predictions`filter:tasks:predictions_results` (String) Prediction results for the tasks`filter:tasks:predictions_score` (Number) Prediction score for the task`filter:tasks:reviewed` (Boolean) Whether the tasks have been reviewed (Enterprise only)`filter:tasks:reviewers` (String) Reviewers that reviewed the task, or assigned reviewers (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer`filter:tasks:reviews_accepted` (Number) Number of annotations accepted for a task in review (Enterprise only)`filter:tasks:reviews_rejected` (Number) Number of annotations rejected for a task in review (Enterprise only)`filter:tasks:total_annotations` (Number) Total number of annotations on a task`filter:tasks:total_predictions` (Number) Total number of predictions for the task`filter:tasks:unresolved_comment_count` (Number) Number of unresolved comments in a task`filter:tasks:updated_at` (Datetime) Time the task was updated at (e.g. new annotation was created, review added, etc)
  - Allowed values: `filter:tasks:agreement`, `filter:tasks:annotations_results`, `filter:tasks:annotators`, `filter:tasks:cancelled_annotations`, `filter:tasks:comments`, `filter:tasks:completed_at`, `filter:tasks:created_at`, `filter:tasks:file_upload`, `filter:tasks:ground_truth`, `filter:tasks:id`, `filter:tasks:inner_id`, `filter:tasks:predictions_model_versions`, `filter:tasks:predictions_results`, `filter:tasks:predictions_score`, `filter:tasks:reviewed`, `filter:tasks:reviewers`, `filter:tasks:reviews_accepted`, `filter:tasks:reviews_rejected`, `filter:tasks:total_annotations`, `filter:tasks:total_predictions`, `filter:tasks:unresolved_comment_count`, `filter:tasks:updated_at`
- `operator` (enum, required) — Filter operator. Possible values:`contains` Contains`ends_with` Ends with`equal` Equal to`exists` Exists`greater` Greater than`greater_or_equal` Greater than or equal to`in` Is between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}``in_list` Field value is one of the items in the supplied list. Value must be a JSON array of strings or numbers, e.g. `[1, 2, 3]` or `["a", "b"]`. Supported only for Task ID, Inner ID, and `task.data.*` fields.`less` Less than`less_or_equal` Less than or equal to`not_contains` Does not contain`not_equal` Not equal to`not_exists` Does not exist`not_in` Is not between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}``not_in_list` Field value is NOT in the supplied list. Value must be a JSON array of strings or numbers. Supported only for Task ID, Inner ID, and `task.data.*` fields.`starts_with` Starts with
  - Allowed values: `contains`, `ends_with`, `equal`, `exists`, `greater`, `greater_or_equal`, `in`, `in_list`, `less`, `less_or_equal`, `not_contains`, `not_equal`, `not_exists`, `not_in`, `not_in_list`, `starts_with`
- `type` (string, required) — Type of the filter value. Possible values:`Boolean` Boolean`Datetime` Datetime string in `strftime('%Y-%m-%dT%H:%M:%S.%fZ')` format`List` List of items`Number` Float or Integer`String` String`Unknown` Unknown is explicitly converted to string format
- `value` (PrepareParamsFiltersRequestItemsItemsValue, required) — Value to filter by
- `child_filters` (list of PrepareParamsFiltersRequestItemsItemsChildFiltersItems, optional) — Ordered child filters AND-merged with their parent. Child filters cannot be nested.

### ChildFilter

- `column` (string, required) — Field name
- `id` (integer, required)
- `operator` (string, required) — Filter operator
- `type` (string, required) — Field type
- `index` (integer, optional, nullable) — Display order among root filters only
- `parent` (integer, optional, nullable) — Optional parent filter to create one-level hierarchy (child filters are AND-merged with parent)
- `value` (any, optional, nullable) — Filter value

### PrepareParamsFiltersRequestItemsItemsValue

Value to filter by

- string
- integer
- float
- boolean
- map from string to any
- map from string to any

### PrepareParamsFiltersRequestItemsItemsChildFiltersItems

- `filter` (enum, required) — Filter identifier, it should start with `filter:tasks:` prefix, e.g. `filter:tasks:agreement`. For `task.data` fields it may look like `filter:tasks:data.field_name`. If you need more info about columns, check the Get data manager columns API endpoint. Possible values:`filter:tasks:agreement` (Number) Agreement for annotation results for a specific task (Enterprise only)`filter:tasks:annotations_results` (String) Annotation results for the tasks`filter:tasks:annotators` (List) Annotators that completed the task (Community). Can include assigned annotators (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer`filter:tasks:cancelled_annotations` (Number) Number of cancelled or skipped annotations for the task`filter:tasks:comments` (Number) Number of comments in a task`filter:tasks:completed_at` (Datetime) Latest annotation time, set once the task has all required annotations`filter:tasks:created_at` (Datetime) Time the task was created at`filter:tasks:file_upload` (String) Name of the file uploaded to create the tasks`filter:tasks:ground_truth` (Boolean) Ground truth status of the tasks`filter:tasks:id` (Number) Task ID`filter:tasks:inner_id` (Number) Task Inner ID, it starts from 1 for all projects`filter:tasks:predictions_model_versions` (String) Model version used for the predictions`filter:tasks:predictions_results` (String) Prediction results for the tasks`filter:tasks:predictions_score` (Number) Prediction score for the task`filter:tasks:reviewed` (Boolean) Whether the tasks have been reviewed (Enterprise only)`filter:tasks:reviewers` (String) Reviewers that reviewed the task, or assigned reviewers (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer`filter:tasks:reviews_accepted` (Number) Number of annotations accepted for a task in review (Enterprise only)`filter:tasks:reviews_rejected` (Number) Number of annotations rejected for a task in review (Enterprise only)`filter:tasks:total_annotations` (Number) Total number of annotations on a task`filter:tasks:total_predictions` (Number) Total number of predictions for the task`filter:tasks:unresolved_comment_count` (Number) Number of unresolved comments in a task`filter:tasks:updated_at` (Datetime) Time the task was updated at (e.g. new annotation was created, review added, etc)
  - Allowed values: `filter:tasks:agreement`, `filter:tasks:annotations_results`, `filter:tasks:annotators`, `filter:tasks:cancelled_annotations`, `filter:tasks:comments`, `filter:tasks:completed_at`, `filter:tasks:created_at`, `filter:tasks:file_upload`, `filter:tasks:ground_truth`, `filter:tasks:id`, `filter:tasks:inner_id`, `filter:tasks:predictions_model_versions`, `filter:tasks:predictions_results`, `filter:tasks:predictions_score`, `filter:tasks:reviewed`, `filter:tasks:reviewers`, `filter:tasks:reviews_accepted`, `filter:tasks:reviews_rejected`, `filter:tasks:total_annotations`, `filter:tasks:total_predictions`, `filter:tasks:unresolved_comment_count`, `filter:tasks:updated_at`
- `operator` (enum, required) — Filter operator. Possible values:`contains` Contains`ends_with` Ends with`equal` Equal to`exists` Exists`greater` Greater than`greater_or_equal` Greater than or equal to`in` Is between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}``in_list` Field value is one of the items in the supplied list. Value must be a JSON array of strings or numbers, e.g. `[1, 2, 3]` or `["a", "b"]`. Supported only for Task ID, Inner ID, and `task.data.*` fields.`less` Less than`less_or_equal` Less than or equal to`not_contains` Does not contain`not_equal` Not equal to`not_exists` Does not exist`not_in` Is not between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}``not_in_list` Field value is NOT in the supplied list. Value must be a JSON array of strings or numbers. Supported only for Task ID, Inner ID, and `task.data.*` fields.`starts_with` Starts with
  - Allowed values: `contains`, `ends_with`, `equal`, `exists`, `greater`, `greater_or_equal`, `in`, `in_list`, `less`, `less_or_equal`, `not_contains`, `not_equal`, `not_exists`, `not_in`, `not_in_list`, `starts_with`
- `type` (string, required) — Type of the filter value. Possible values:`Boolean` Boolean`Datetime` Datetime string in `strftime('%Y-%m-%dT%H:%M:%S.%fZ')` format`List` List of items`Number` Float or Integer`String` String`Unknown` Unknown is explicitly converted to string format
- `value` (PrepareParamsFiltersRequestItemsItemsChildFiltersItemsValue, required) — Value to filter by

### PrepareParamsFiltersRequestItemsItemsChildFiltersItemsValue

Value to filter by

- string
- integer
- float
- boolean
- map from string to any
- map from string to any

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": 1,
  "locked_by": {
    "email": "string",
    "id": 1,
    "name": "string"
  },
  "project": 1,
  "data": null,
  "filter_group": {
    "conjunction": "string",
    "filters": [
      {
        "column": "string",
        "id": 1,
        "operator": "string",
        "type": "string",
        "child_filters": [
          {
            "column": "string",
            "id": 1,
            "operator": "string",
            "type": "string",
            "index": 1,
            "parent": 1,
            "value": null
          }
        ],
        "index": 1,
        "parent": 1,
        "value": null
      }
    ],
    "id": 1
  },
  "is_locked": true,
  "locked_at": "2024-01-15T09:30:00Z",
  "order": 1,
  "ordering": null,
  "selected_items": null,
  "user": 1
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8000/api/dm/views/"

payload = {}
headers = {
    "Authorization": "Token  <api_key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'http://localhost:8000/api/dm/views/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Token  <api_key>', 'Content-Type': 'application/json'},
  body: '{}'
};

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

```go
package main

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

func main() {

	url := "http://localhost:8000/api/dm/views/"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Token  <api_key>")
	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("http://localhost:8000/api/dm/views/")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Token  <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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("http://localhost:8000/api/dm/views/")
  .header("Authorization", "Token  <api_key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8000/api/dm/views/', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Token  <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("http://localhost:8000/api/dm/views/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Token  <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Token  <api_key>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8000/api/dm/views/")! 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()
```