Build API Documentation

Navigation: Home > API Reference > Build API

The Azure DevOps Build API provides a comprehensive set of methods for interacting with build pipelines in Azure DevOps. It enables developers to programmatically manage build pipelines, queue builds, monitor build status, and access build artifacts and logs. This documentation provides detailed information about the most commonly used methods in the Build API.

The Build API is designed to facilitate:

  • Creating new build pipelines
  • Updating existing pipeline configurations
  • Querying pipeline information
  • Managing pipeline settings and permissions
  • Queuing new builds
  • Monitoring build progress
  • Canceling running builds
  • Handling build triggers and schedules
  • Accessing build logs
  • Retrieving build artifacts
  • Analyzing test results
  • Evaluating build quality
  • Integrating builds with other systems
  • Creating custom build workflows
  • Implementing build approval processes
  • Setting up automated notifications
  • Collecting data on build performance
  • Tracking build success rates
  • Measuring build times
  • Analyzing build trends

The Build API is frequently used for:

Create and manage complex build and deployment pipelines that span multiple projects and repositories.

Build specialized dashboards that display build status, history, and performance metrics tailored to specific team needs.

Trigger builds automatically based on external events or system conditions beyond standard Azure DevOps triggers.

Coordinate builds across multiple projects to ensure consistent build processes and dependencies.

Track and analyze build performance metrics to identify bottlenecks and optimize build processes.

Create custom notification systems that alert teams about build status through various channels.

Connect Azure DevOps builds with external tools and services for enhanced functionality.

Automate the handling of build artifacts for deployment, archiving, or distribution.

This documentation covers:

To use the Build API, you'll need:

  • An Azure DevOps account with appropriate permissions
  • A Personal Access Token (PAT) or other authentication method with Build (Read, Execute) permissions
  • The Azure DevOps Node.js API client library

To start using the Build API, first establish a connection to your Azure DevOps organization:

import * as azdev from "azure-devops-node-api";

// Connection setup
const orgUrl = "https://dev.azure.com/yourorganization";
const token = "your-personal-access-token";

const authHandler = azdev.getPersonalAccessTokenHandler(token);
const connection = new azdev.WebApi(orgUrl, authHandler);

// Get Build API client
const buildApi = await connection.getBuildApi();

// Now you can use the Build API methods
// Example: Get all build pipelines
const buildDefinitions = await buildApi.getDefinitions("YourProject");
console.log(`Found ${buildDefinitions.length} build pipelines`);

The Build API is commonly used in conjunction with other Azure DevOps APIs to create comprehensive solutions:

Builds can be triggered by Git repository events and can operate on specific branches or commits.

Common integration patterns include:

  • Triggering builds on commit or pull request
  • Building specific branches
  • Reporting build status on pull requests

See Git + Build Integration for detailed examples.

Builds can be linked to work items to track which requirements are implemented in which builds.

Common integration patterns include:

  • Linking builds to work items
  • Updating work item status based on build results
  • Generating release notes from work items

See Work Item + Build Integration for detailed examples.

For complex scenarios involving Build, Git, and Work Item Tracking APIs together, see Cross-API Examples.

For a comprehensive view of how Build API methods relate to other APIs, see the API Cross-Reference Table.