---
title: "Create a view for a user-owned project"
method: POST
path: "/users/{user_id}/projectsV2/{project_number}/views"
tags: ["projects"]
---

# Create a view for a user-owned project

`POST /users/{user_id}/projectsV2/{project_number}/views`

Create a new view in a user-owned project. Views allow you to customize how items in a project are displayed and filtered.

## Path parameters

- `user_id` string, required
- `project_number` integer, required

## Request body

- object
  - `name` string, required — The name of the view.
  - `layout` 'table' | 'board' | 'roadmap', required — The layout of the view.
  - `filter` string — The filter query for the view. See [Filtering projects](https://docs.github.com/issues/planning-and-tracking-with-projects/customizing-views-in-your-project/filtering-projects) for more information.
  - `visible_fields` integer[] — `visible_fields` is not applicable to `roadmap` layout views. For `table` and `board` layouts, this represents the field IDs that should be visible in the view. If not provided, the default visible fields will be used.
  - `sort_by` array[] — Sorting configuration for the view. Each element is a two-element array of `[field_id, direction]` where `direction` is `"asc"` or `"desc"`. Supports multiple sort criteria applied in order.
    - union[]
      - union
        - integer
        - string
  - `group_by` integer[] — The field IDs to group items by (horizontal grouping). Supports a single field. The field must support grouping; fields such as `Title`, `Reviewers`, `Linked pull requests`, `Sub-issues progress`, `Tracked by`, and `Tracks` cannot be grouped on.
  - `vertical_group_by` integer[] — The field IDs to use as columns in `board` layout (vertical grouping). Supports a single field. The field must support grouping; fields such as `Title`, `Reviewers`, `Linked pull requests`, `Sub-issues progress`, `Tracked by`, and `Tracks` cannot be grouped on.

## Response `201`

Response for creating a view in a user-owned project.

- ProjectsV2View — A view inside a projects v2 project
  - `id` integer, required — The unique identifier of the view.
  - `number` integer, required — The number of the view within the project.
  - `name` string, required — The name of the view.
  - `layout` 'table' | 'board' | 'roadmap', required — The layout of the view.
  - `node_id` string, required — The node ID of the view.
  - `project_url` string, required — The API URL of the project that contains the view.
  - `html_url` string, uri, required — The web URL of the view.
  - `creator` SimpleUser, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
    - `user_view_type` string
  - `created_at` string, date-time, required — The time when the view was created.
  - `updated_at` string, date-time, required — The time when the view was last updated.
  - `filter` string, nullable — The filter query for the view.
  - `visible_fields` integer[], required — The list of field IDs that are visible in the view.
  - `sort_by` array[], required — The sorting configuration for the view. Each element is a tuple of [field_id, direction] where direction is "asc" or "desc".
    - union[]
      - union
        - integer
        - string
  - `group_by` integer[], required — The list of field IDs used for horizontal grouping.
  - `vertical_group_by` integer[], required — The list of field IDs used for vertical grouping (board layout).

## Other responses

- `304` — Not modified
- `401` — Requires authentication
- `403` — Forbidden
- `404` — Resource not found
- `422` — Validation failed, or the endpoint has been spammed.
- `503` — Service unavailable

---

[API](https://skmtc.net/github/apis/github-v3-rest-api.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api/versions/a367f7028301/schema)
