Get a Project ID
Use the REST API to get the entity ID of a project. You need this ID for requests that create issues or update project-specific settings.
Summary
To get the entity ID of a project, send a GET request to the /api/admin/projects endpoint. You can request the full list of available projects or use the query parameter to filter the list by project name or short name.
Step-by-Step
To get a project ID
Get a list of available projects.
curl -X GET \ 'https://example.youtrack.cloud/api/admin/projects?fields=id,name,shortName' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json'In the
fieldsrequest parameter, you instruct the server to return theid,name, andshortNameattributes of each project.For such request, you get response from the server with the following body:
[ { "shortName": "GRP", "name": "GRA Project", "id": "0-7", "$type": "Project" }, { "shortName": "RAP", "name": "Rest Api Project", "id": "0-2", "$type": "Project" }, { "shortName": "RP", "name": "Rest Project", "id": "0-6", "$type": "Project" }, { "shortName": "SP", "name": "Sample Project", "id": "0-0", "$type": "Project" }, { "shortName": "SNBX", "name": "Sandbox", "id": "0-3", "$type": "Project" } ]Optional. Filter the list of projects by the project
nameorshortName.Sample request with the filter by a project's
name:curl -X GET \ 'https://example.youtrack.cloud/api/admin/projects?fields=id,name,shortName&query=Sample+Project' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json'Sample request with the filter by a project's
shortName:curl -X GET \ 'https://example.youtrack.cloud/api/admin/projects?fields=id,name,shortName&query=sp' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json'To the sample request with the
queryparameter, the response body contains data only for the matching project:[ { "shortName": "SP", "name": "Sample Project", "id": "0-0", "$type": "Project" } ]In the response from the server, locate the
idof the target project.In this example, the project entity ID is
0-0.