Project collections

Last Update: 12/13/2016

api-version = 1.0-preview.2

This API in preview. Learn more

Project collections contain team projects that have source code, work items, and other resources.

If you haven't already, look at the information on getting started with these APIs.

Get a project collection

GET https://{instance}/_apis/projectcollections/{collection}?api-version={version}
Parameter Type Notes
instance string VS Team Services account ({account} or TFS server ({server:port}).
collection string Name or ID of the project collection.
api-version string Version of the API to use.

Sample request


Sample response

Status code: 200
  "id": "d81542e4-cdfa-4333-b082-1ae2d6c3ad16",
  "name": "DefaultCollection",
  "url": "",
  "state": "Started",
  "_links": {
    "self": {
      "href": ""
    "web": {
      "href": ""

Sample code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;


public void GetProjectCollection()
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));

   string _collectionId = "A1FC9B53-C370-48E3-98EA-D743B56D7B87"; //collection id

   //use the httpclient        
   using (var client = new HttpClient())
       //set our headers
       client.BaseAddress = new Uri("");
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       //send the request and content
       HttpResponseMessage response = client.GetAsync("_apis/projectCollections/" + _collectionId + "?api-version=2.2").Result;

       if (response.IsSuccessStatusCode)
           var result = response.Content.ReadAsStringAsync().Result;       
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;


public GetProjectCollection()
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);

   string _collectionId = "A1FC9B53-C370-48E3-98EA-D743B56D7B87"; //collection id

   using (ProjectCollectionHttpClient projectCollectionHttpClient = new ProjectCollectionHttpClient(_uri, _credentials))
       TeamProjectCollectionReference teamProjectCollectionReference = projectCollectionHttpClient.GetProjectCollection(_collectionId).Result;