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

# Create a saved view

POST https://api.cloudraker.com/spaces/{spaceId}/objects/{definitionId}/views
Content-Type: application/json

Creates a saved table view for a definition within a space. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (a caller without even `space:read` gets 404 first). Body: `name` (required), and optional `fields[]` (`{ fieldKey, isVisible, width, position }`), `filters[]` (`{ fieldKey, subField?, operand, value }`), `sorts[]` (`{ fieldKey, direction }`), `filterLogic`. Server sets `isDefault`/`spaceId`/`definitionId`. Invalid name/fields/operands → 422 `validation_failed`. Returns 201 with `{ view }`.

Reference: https://docs.cloudraker.com/api/cloud-raker-api/workspace/data-objects/create-object-view

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: CloudRaker API
  version: 1.0.0
paths:
  /spaces/{spaceId}/objects/{definitionId}/views:
    post:
      operationId: create-object-view
      summary: Create a saved view
      description: >-
        Creates a saved table view for a definition within a space.
        Authorization: requires `space:contribute` on `:spaceId` — lacking it
        gives **403** (a caller without even `space:read` gets 404 first). Body:
        `name` (required), and optional `fields[]` (`{ fieldKey, isVisible,
        width, position }`), `filters[]` (`{ fieldKey, subField?, operand, value
        }`), `sorts[]` (`{ fieldKey, direction }`), `filterLogic`. Server sets
        `isDefault`/`spaceId`/`definitionId`. Invalid name/fields/operands → 422
        `validation_failed`. Returns 201 with `{ view }`.
      tags:
        - dataObjects
      parameters:
        - name: spaceId
          in: path
          required: true
          schema:
            type: string
        - name: definitionId
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '201':
          description: The created view.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectViewEnvelope'
        '403':
          description: Missing `space:contribute`.
          content:
            application/json:
              schema:
                description: Any type
        '422':
          description: '`validation_failed` — invalid name/fields/filters/sorts.'
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        description: '`isDefault`, `spaceId` and `definitionId` are server-set.'
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                fields:
                  type: array
                  items:
                    $ref: >-
                      #/components/schemas/SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaFieldsItems
                filters:
                  type: array
                  items:
                    $ref: >-
                      #/components/schemas/SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaFiltersItems
                sorts:
                  type: array
                  items:
                    $ref: >-
                      #/components/schemas/SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaSortsItems
                filterLogic:
                  type: string
              required:
                - name
servers:
  - url: https://api.cloudraker.com
    description: Production
  - url: https://api.staging.raker.one
    description: Staging
  - url: https://api.dev.raker.one
    description: Development
components:
  schemas:
    SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaFieldsItems:
      type: object
      properties:
        fieldKey:
          type: string
        isVisible:
          type: boolean
        width:
          type: number
          format: double
        position:
          type: number
          format: double
      required:
        - fieldKey
      title: >-
        SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaFieldsItems
    SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaFiltersItems:
      type: object
      properties:
        fieldKey:
          type: string
        subField:
          type: string
        operand:
          type: string
          description: One of the 14 supported operands.
        value:
          description: Any type
      required:
        - fieldKey
        - operand
      title: >-
        SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaFiltersItems
    SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaSortsItemsDirection:
      type: string
      enum:
        - asc
        - desc
      title: >-
        SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaSortsItemsDirection
    SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaSortsItems:
      type: object
      properties:
        fieldKey:
          type: string
        subField:
          type: string
        direction:
          $ref: >-
            #/components/schemas/SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaSortsItemsDirection
      required:
        - fieldKey
        - direction
      title: >-
        SpacesSpaceIdObjectsDefinitionIdViewsPostRequestBodyContentApplicationJsonSchemaSortsItems
    ObjectViewFieldsItems:
      type: object
      properties:
        fieldKey:
          type: string
        isVisible:
          type: boolean
        width:
          type: number
          format: double
        position:
          type: number
          format: double
      required:
        - fieldKey
        - isVisible
        - width
        - position
      title: ObjectViewFieldsItems
    ObjectViewFiltersItems:
      type: object
      properties:
        fieldKey:
          type: string
        subField:
          type: string
        operand:
          type: string
          description: One of the 14 supported operands.
        value:
          description: Any type
      required:
        - fieldKey
        - operand
      title: ObjectViewFiltersItems
    ObjectViewSortsItemsDirection:
      type: string
      enum:
        - asc
        - desc
      title: ObjectViewSortsItemsDirection
    ObjectViewSortsItems:
      type: object
      properties:
        fieldKey:
          type: string
        subField:
          type: string
        direction:
          $ref: '#/components/schemas/ObjectViewSortsItemsDirection'
      required:
        - fieldKey
        - direction
      title: ObjectViewSortsItems
    ObjectView:
      type: object
      properties:
        _id:
          type: string
        spaceId:
          type: string
        definitionId:
          type: string
        name:
          type: string
        isDefault:
          type: boolean
          description: 'The seeded default view: never renamable, never deletable.'
        filterLogic:
          type: string
        fields:
          type: array
          items:
            $ref: '#/components/schemas/ObjectViewFieldsItems'
        filters:
          type: array
          items:
            $ref: '#/components/schemas/ObjectViewFiltersItems'
        sorts:
          type: array
          items:
            $ref: '#/components/schemas/ObjectViewSortsItems'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        createdBy:
          type: string
      required:
        - _id
        - spaceId
        - definitionId
        - name
        - isDefault
        - filterLogic
        - fields
        - filters
        - sorts
        - createdAt
        - updatedAt
        - createdBy
      title: ObjectView
    ObjectViewEnvelope:
      type: object
      properties:
        view:
          $ref: '#/components/schemas/ObjectView'
      required:
        - view
      title: ObjectViewEnvelope
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{
  "name": "Customer Overview"
}
```

**Response**

```json
{
  "view": {
    "_id": "a1b2c3d4e5f6789012345678",
    "spaceId": "space_987654321",
    "definitionId": "def_123456789",
    "name": "Customer Overview",
    "isDefault": false,
    "filterLogic": "(1 AND 2) OR 3",
    "fields": [
      {
        "fieldKey": "customerName",
        "isVisible": true,
        "width": 150,
        "position": 1
      }
    ],
    "filters": [
      {
        "fieldKey": "status",
        "operand": "equals",
        "subField": "value"
      }
    ],
    "sorts": [
      {
        "fieldKey": "createdDate",
        "direction": "asc",
        "subField": "timestamp"
      }
    ],
    "createdAt": "2024-01-15T09:30:00Z",
    "updatedAt": "2024-01-15T09:30:00Z",
    "createdBy": "user_123456"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.cloudraker.com/spaces/spaceId/objects/definitionId/views"

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

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

print(response.json())
```

```javascript
const url = 'https://api.cloudraker.com/spaces/spaceId/objects/definitionId/views';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"Customer Overview"}'
};

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 := "https://api.cloudraker.com/spaces/spaceId/objects/definitionId/views"

	payload := strings.NewReader("{\n  \"name\": \"Customer 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.cloudraker.com/spaces/spaceId/objects/definitionId/views")

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\": \"Customer 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.cloudraker.com/spaces/spaceId/objects/definitionId/views")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Customer Overview\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cloudraker.com/spaces/spaceId/objects/definitionId/views', [
  'body' => '{
  "name": "Customer Overview"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.cloudraker.com/spaces/spaceId/objects/definitionId/views");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Customer Overview\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cloudraker.com/spaces/spaceId/objects/definitionId/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()
```