Sample - GitHub REST API
POST/orgs/{org}/projectsV2/{project_number}/views

Create a view for an organization-owned project

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

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 7 body fields
orgstringrequired
The organization name. The name is not case sensitive.
project_numberintegerrequired
The project's number.
namestringrequired
The name of the view.
layoutstringrequired
The layout of the view.
Allowed:tableboardroadmap
filterstringoptional
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_fieldsarray<integer>optional
`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_byarray<array>optional
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.
group_byarray<integer>optional
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_byarray<integer>optional
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.

7 status codes
201Response for creating a view in an organization-owned project.
idintegerrequired
The unique identifier of the view.
numberintegerrequired
The number of the view within the project.
namestringrequired
The name of the view.
layoutstringrequired
The layout of the view.
Allowed:tableboardroadmap
node_idstringrequired
The node ID of the view.
project_urlstringrequired
The API URL of the project that contains the view.
html_urlstringrequired
The web URL of the view.
creatorobjectrequired
created_atstringrequired
The time when the view was created.
updated_atstringrequired
The time when the view was last updated.
filterstringoptional
The filter query for the view.
visible_fieldsarray<integer>required
The list of field IDs that are visible in the view.
sort_byarray<array>required
The sorting configuration for the view. Each element is a tuple of [field_id, direction] where direction is "asc" or "desc".
group_byarray<integer>required
The list of field IDs used for horizontal grouping.
vertical_group_byarray<integer>required
The list of field IDs used for vertical grouping (board layout).
304Not modified
401Requires authentication
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional
503Service unavailable
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 401 is returned: Requires authentication. A 403 is returned: Forbidden. A 404 is returned: Resource not found. A 422 is returned: Validation failed, or the endpoint has been spammed. A 503 is returned: Service unavailable.