Azure DevOps Queries API

Work item query execution

OpenAPI Specification

azure-devops-queries-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Azure DevOps Pipelines Fields Queries API
  description: The Azure DevOps Pipelines API provides REST endpoints for managing CI/CD build and release pipelines. APIs support pipeline creation, triggering builds, retrieving build results, managing release definitions, and automating deployment workflows across Azure DevOps organizations.
  version: '7.2'
  contact:
    name: Microsoft Azure DevOps
    url: https://learn.microsoft.com/en-us/rest/api/azure/devops/
servers:
- url: https://dev.azure.com/{organization}
  description: Azure DevOps Services
  variables:
    organization:
      description: Azure DevOps organization name
      default: my-org
security:
- personalAccessToken: []
- oauth2: []
tags:
- name: Queries
  description: Work item query execution
paths:
  /{project}/_apis/wit/wiql:
    post:
      operationId: queryWorkItemsByWiql
      summary: Query Work Items Using Wiql
      description: Executes a Work Item Query Language (WIQL) query to find work items matching the specified criteria.
      tags:
      - Queries
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
        example: example_value
      - name: project
        in: path
        required: true
        schema:
          type: string
        example: example_value
      - name: $top
        in: query
        description: Maximum number of results to return
        schema:
          type: integer
          maximum: 20000
        example: 10
      - name: api-version
        in: query
        required: true
        schema:
          type: string
          default: 7.2-preview.2
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - query
              properties:
                query:
                  type: string
                  description: WIQL query string
                  example: SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.State] = 'Active' ORDER BY [System.CreatedDate] DESC
            examples:
              QueryworkitemsbywiqlRequestExample:
                summary: Default queryWorkItemsByWiql request
                x-microcks-default: true
                value:
                  query: example_value
      responses:
        '200':
          description: Query results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WiqlResult'
              examples:
                Queryworkitemsbywiql200Example:
                  summary: Default queryWorkItemsByWiql 200 response
                  x-microcks-default: true
                  value:
                    queryType: flat
                    asOf: '2026-01-15T10:30:00Z'
                    workItems:
                    - id: abc123
                      url: https://www.example.com
                    workItemRelations:
                    - source:
                        id: abc123
                      target:
                        id: abc123
                      rel: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    WiqlResult:
      type: object
      properties:
        queryType:
          type: string
          enum:
          - flat
          - tree
          - oneHop
          example: flat
        asOf:
          type: string
          format: date-time
          example: '2026-01-15T10:30:00Z'
        workItems:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              url:
                type: string
          example: []
        workItemRelations:
          type: array
          items:
            type: object
            properties:
              source:
                type: object
                properties:
                  id:
                    type: integer
              target:
                type: object
                properties:
                  id:
                    type: integer
              rel:
                type: string
          example: []
  securitySchemes:
    personalAccessToken:
      type: http
      scheme: basic
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.vssps.visualstudio.com/oauth2/authorize
          tokenUrl: https://app.vssps.visualstudio.com/oauth2/token
          scopes:
            vso.build: Read build data
            vso.build_execute: Queue and manage builds