Skip to content

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.

API method documentation

user_id
required
string

The unique identifier of the user.

project_number
required
integer

The project’s number.

Media type application/json
object
name
required

The name of the view.

string
layout
required

The layout of the view.

string
Allowed values: table board roadmap
filter

The filter query for the view. See Filtering projects for more information.

string
visible_fields

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.

Array<integer>
Examples

Create a table view

{
"name": "All Issues",
"layout": "table",
"filter": "is:issue",
"visible_fields": [
123,
456,
789
]
}

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

Media type application/json
Projects v2 View

A view inside a projects v2 project

object
id
required

The unique identifier of the view.

integer
number
required

The number of the view within the project.

integer
name
required

The name of the view.

string
layout
required

The layout of the view.

string
Allowed values: table board roadmap
node_id
required

The node ID of the view.

string
project_url
required

The API URL of the project that contains the view.

string
html_url
required

The web URL of the view.

string format: uri
creator
required
object
name
string
nullable
email
string
nullable
login
required
string
id
required
integer format: int64
node_id
required
string
avatar_url
required
string format: uri
gravatar_id
required
string
nullable
url
required
string format: uri
html_url
required
string format: uri
followers_url
required
string format: uri
following_url
required
string
gists_url
required
string
starred_url
required
string
subscriptions_url
required
string format: uri
organizations_url
required
string format: uri
repos_url
required
string format: uri
events_url
required
string
received_events_url
required
string format: uri
type
required
string
site_admin
required
boolean
starred_at
string
user_view_type
string
created_at
required

The time when the view was created.

string format: date-time
updated_at
required

The time when the view was last updated.

string format: date-time
filter

The filter query for the view.

string
nullable
visible_fields
required

The list of field IDs that are visible in the view.

Array<integer>
sort_by
required

The sorting configuration for the view. Each element is a tuple of [field_id, direction] where direction is “asc” or “desc”.

Array<Array>
group_by
required

The list of field IDs used for horizontal grouping.

Array<integer>
vertical_group_by
required

The list of field IDs used for vertical grouping (board layout).

Array<integer>
Examples

Response for creating a table view

{
"value": {
"id": 1,
"number": 1,
"name": "Sprint Board",
"layout": "board",
"node_id": "PVTV_lADOANN5s84ACbL0zgBueEI",
"project_url": "https://api.github.com/orgs/octocat/projectsV2/1",
"html_url": "https://github.com/orgs/octocat/projects/1/views/1",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2022-04-28T12:00:00Z",
"updated_at": "2022-04-28T12:00:00Z",
"filter": "is:issue is:open",
"visible_fields": [
123,
456,
789
],
"sort_by": [
[
123,
"asc"
],
[
456,
"desc"
]
],
"group_by": [
123
],
"vertical_group_by": [
456
]
}
}

Not modified

Requires authentication

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Forbidden

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Resource not found

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}

Service unavailable

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}