{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-pipelines/json-schema/microsoft-azure-pipelines-build-schema.json",
  "title": "Build",
  "description": "Data representation of a build execution in Azure DevOps including its status, result, timing, source information, and associated definition.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-pipelines-builds-api-openapi.yml#/components/schemas/Build",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "Unique numeric identifier of the build"
    },
    "buildNumber": {
      "type": "string",
      "description": "Build number or name assigned to this build"
    },
    "buildNumberRevision": {
      "type": "integer",
      "description": "Build number revision counter"
    },
    "status": {
      "type": "string",
      "description": "Current status of the build",
      "enum": [
        "none",
        "inProgress",
        "completed",
        "cancelling",
        "postponed",
        "notStarted",
        "all"
      ]
    },
    "result": {
      "type": [
        "string",
        "null"
      ],
      "description": "Final result of the build when completed",
      "enum": [
        "none",
        "succeeded",
        "partiallySucceeded",
        "failed",
        "canceled"
      ]
    },
    "queueTime": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the build was queued"
    },
    "startTime": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the build started executing"
    },
    "finishTime": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Timestamp when the build completed"
    },
    "definition": {
      "$ref": "#/$defs/BuildDefinitionReference"
    },
    "project": {
      "$ref": "#/$defs/TeamProjectReference"
    },
    "sourceBranch": {
      "type": "string",
      "description": "Source branch that was built"
    },
    "sourceVersion": {
      "type": "string",
      "description": "Source commit SHA that was built"
    },
    "reason": {
      "type": "string",
      "description": "Reason the build was created",
      "enum": [
        "none",
        "manual",
        "individualCI",
        "batchedCI",
        "schedule",
        "scheduleForced",
        "userCreated",
        "validateShelveset",
        "checkInShelveset",
        "pullRequest",
        "buildCompletion",
        "resourceTrigger",
        "triggered",
        "all"
      ]
    },
    "priority": {
      "type": "string",
      "description": "Build queue priority",
      "enum": [
        "low",
        "belowNormal",
        "normal",
        "aboveNormal",
        "high"
      ]
    },
    "requestedBy": {
      "$ref": "#/$defs/IdentityRef"
    },
    "requestedFor": {
      "$ref": "#/$defs/IdentityRef"
    },
    "lastChangedBy": {
      "$ref": "#/$defs/IdentityRef"
    },
    "lastChangedDate": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp of the last change to this build"
    },
    "repository": {
      "$ref": "#/$defs/BuildRepository"
    },
    "parameters": {
      "type": "string",
      "description": "JSON string of build parameters"
    },
    "tags": {
      "type": "array",
      "description": "Tags associated with this build",
      "items": {
        "type": "string"
      }
    },
    "templateParameters": {
      "type": "object",
      "description": "Template expression parameters",
      "additionalProperties": {
        "type": "string"
      }
    },
    "deleted": {
      "type": "boolean",
      "description": "Whether the build has been deleted"
    },
    "retainedByRelease": {
      "type": "boolean",
      "description": "Whether the build is retained by a release"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "REST API URL of the build"
    },
    "uri": {
      "type": "string",
      "description": "The URI of the build"
    },
    "logs": {
      "type": "object",
      "description": "Reference to build logs",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Log ID"
        },
        "type": {
          "type": "string",
          "description": "Log location type"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "URL to the log resource"
        }
      }
    },
    "_links": {
      "type": "object",
      "description": "HAL links for related resources",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  },
  "$defs": {
    "BuildDefinitionReference": {
      "type": "object",
      "description": "Reference to a build definition containing its identification, folder path, queue status, and type.",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Build definition ID"
        },
        "name": {
          "type": "string",
          "description": "Build definition name"
        },
        "path": {
          "type": "string",
          "description": "Folder path of the definition"
        },
        "revision": {
          "type": "integer",
          "description": "Current revision number"
        },
        "type": {
          "type": "string",
          "description": "Definition type",
          "enum": [
            "xaml",
            "build"
          ]
        },
        "queueStatus": {
          "type": "string",
          "description": "Whether builds can be queued against this definition",
          "enum": [
            "enabled",
            "paused",
            "disabled"
          ]
        },
        "createdDate": {
          "type": "string",
          "format": "date-time",
          "description": "Date the definition was created"
        },
        "project": {
          "$ref": "#/$defs/TeamProjectReference"
        },
        "uri": {
          "type": "string",
          "description": "Definition URI"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for this definition"
        }
      }
    },
    "BuildRepository": {
      "type": "object",
      "description": "Repository used by a build definition",
      "properties": {
        "id": {
          "type": "string",
          "description": "Repository ID"
        },
        "name": {
          "type": "string",
          "description": "Repository name"
        },
        "type": {
          "type": "string",
          "description": "Repository type"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Repository URL"
        },
        "defaultBranch": {
          "type": "string",
          "description": "Default branch name"
        },
        "clean": {
          "type": "string",
          "description": "Clean option for the workspace"
        },
        "checkoutSubmodules": {
          "type": "boolean",
          "description": "Whether to checkout submodules"
        }
      }
    },
    "IdentityRef": {
      "type": "object",
      "description": "Reference to an Azure DevOps identity",
      "properties": {
        "id": {
          "type": "string",
          "description": "Identity GUID"
        },
        "displayName": {
          "type": "string",
          "description": "Display name of the identity"
        },
        "uniqueName": {
          "type": "string",
          "description": "Unique name (email) of the identity"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "URL to the identity resource"
        },
        "imageUrl": {
          "type": "string",
          "format": "uri",
          "description": "URL to the identity avatar image"
        }
      }
    },
    "TeamProjectReference": {
      "type": "object",
      "description": "Shallow reference to a team project",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Project GUID identifier"
        },
        "name": {
          "type": "string",
          "description": "Project name"
        },
        "description": {
          "type": "string",
          "description": "Project description"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for the project"
        },
        "state": {
          "type": "string",
          "description": "Project state",
          "enum": [
            "deleting",
            "new",
            "wellFormed",
            "createPending",
            "all",
            "unchanged",
            "deleted"
          ]
        },
        "visibility": {
          "type": "string",
          "description": "Project visibility",
          "enum": [
            "private",
            "public"
          ]
        }
      }
    }
  }
}