Open Context Protocol is live! 🚀 Read the launch post
projectsCreateViewForUser

projectsCreateViewForUser

Create a view for a user-owned project

POST /users/{user_id}/projectsV2/{project_number}/views HTTP/1.1

Parameters

{
  "user_id": {
    "description": "The unique identifier of the user.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "project_number": {
    "description": "The project's number.",
    "required": true,
    "location": "path",
    "type": "integer"
  },
  "name": {
    "description": "The name of the view.",
    "required": true,
    "location": "body",
    "type": "string"
  },
  "layout": {
    "description": "The layout of the view.",
    "required": true,
    "location": "body",
    "type": "string",
    "enum": [
      "table",
      "board",
      "roadmap"
    ]
  },
  "filter": {
    "description": "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.",
    "required": false,
    "location": "body",
    "type": "string"
  },
  "visible_fields": {
    "description": "`visible_fields` is not applicable to `roadmap` layout views.\nFor `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.",
    "required": false,
    "location": "body",
    "type": "array"
  }
}

Response Schema

{
  "title": "Projects v2 View",
  "description": "A view inside a projects v2 project",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "The unique identifier of the view."
    },
    "number": {
      "type": "integer",
      "description": "The number of the view within the project."
    },
    "name": {
      "type": "string",
      "description": "The name of the view."
    },
    "layout": {
      "type": "string",
      "description": "The layout of the view.",
      "enum": [
        "table",
        "board",
        "roadmap"
      ]
    },
    "node_id": {
      "type": "string",
      "description": "The node ID of the view."
    },
    "project_url": {
      "type": "string",
      "description": "The API URL of the project that contains the view.",
      "example": "https://api.github.com/orgs/octocat/projectsV2/1"
    },
    "html_url": {
      "type": "string",
      "format": "uri",
      "description": "The web URL of the view.",
      "example": "https://github.com/orgs/octocat/projects/1/views/1"
    },
    "creator": {
      "allOf": [
        {
          "title": "Simple User",
          "description": "A GitHub user.",
          "type": "object",
          "properties": {
            "name": {
              "nullable": true,
              "type": "string"
            },
            "email": {
              "nullable": true,
              "type": "string"
            },
            "login": {
              "type": "string",
              "example": "octocat"
            },
            "id": {
              "type": "integer",
              "format": "int64",
              "example": 1
            },
            "node_id": {
              "type": "string",
              "example": "MDQ6VXNlcjE="
            },
            "avatar_url": {
              "type": "string",
              "format": "uri",
              "example": "https://github.com/images/error/octocat_happy.gif"
            },
            "gravatar_id": {
              "type": "string",
              "example": "41d064eb2195891e12d0413f63227ea7",
              "nullable": true
            },
            "url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat"
            },
            "html_url": {
              "type": "string",
              "format": "uri",
              "example": "https://github.com/octocat"
            },
            "followers_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/followers"
            },
            "following_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/following{/other_user}"
            },
            "gists_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/gists{/gist_id}"
            },
            "starred_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
            },
            "subscriptions_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/subscriptions"
            },
            "organizations_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/orgs"
            },
            "repos_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/repos"
            },
            "events_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/events{/privacy}"
            },
            "received_events_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/received_events"
            },
            "type": {
              "type": "string",
              "example": "User"
            },
            "site_admin": {
              "type": "boolean"
            },
            "starred_at": {
              "type": "string",
              "example": "\"2020-07-09T00:17:55Z\""
            },
            "user_view_type": {
              "type": "string",
              "example": "public"
            }
          },
          "required": [
            "avatar_url",
            "events_url",
            "followers_url",
            "following_url",
            "gists_url",
            "gravatar_id",
            "html_url",
            "id",
            "node_id",
            "login",
            "organizations_url",
            "received_events_url",
            "repos_url",
            "site_admin",
            "starred_url",
            "subscriptions_url",
            "type",
            "url"
          ]
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "example": "2022-04-28T12:00:00Z",
      "description": "The time when the view was created."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "example": "2022-04-28T12:00:00Z",
      "description": "The time when the view was last updated."
    },
    "filter": {
      "type": "string",
      "nullable": true,
      "description": "The filter query for the view.",
      "example": "is:issue is:open"
    },
    "visible_fields": {
      "type": "array",
      "description": "The list of field IDs that are visible in the view.",
      "items": {
        "type": "integer"
      }
    },
    "sort_by": {
      "type": "array",
      "description": "The sorting configuration for the view. Each element is a tuple of [field_id, direction] where direction is \"asc\" or \"desc\".",
      "items": {
        "type": "array",
        "minItems": 2,
        "maxItems": 2,
        "items": {
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ]
        }
      }
    },
    "group_by": {
      "type": "array",
      "description": "The list of field IDs used for horizontal grouping.",
      "items": {
        "type": "integer"
      }
    },
    "vertical_group_by": {
      "type": "array",
      "description": "The list of field IDs used for vertical grouping (board layout).",
      "items": {
        "type": "integer"
      }
    }
  },
  "required": [
    "id",
    "number",
    "name",
    "layout",
    "node_id",
    "project_url",
    "html_url",
    "creator",
    "created_at",
    "updated_at",
    "visible_fields",
    "sort_by",
    "group_by",
    "vertical_group_by"
  ]
}