Eliminating Files from Pull Request in Azure DevOps

The feature enables users to manage pull requests and code reviews, as well as receive notifications about version control events through service hooks. For this version of the API, it is recommended to set it to ‘6.0-preview.1’. The API’s responses include a successful operation code 200 OK. The API uses OAuth2 for security authorization and access control with an access code flow. The authorization URL is https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion, and the token URL is https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer. Additionally, the vso.code_write scope is granted, which allows users to read, update, and delete source code, as well as access metadata about commits, changesets, branches, and other version control artifacts.

API Version:

Delete a pull request attachment.

DELETE https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/attachments/{fileName}?api-version=6.0-preview.1

URI Parameters

Name In Required Type Description
Document name and file. path True
  • string

The identifier of the attachment that needs to be removed.

path True
  • string

The title given to the organization in Azure DevOps.

Retrieve the identification number upon making a call for a specific request. path True The first item in the MSDT list is of the data type “int32”.

ID of the pull request.

The identifier for a repository. path True
  • string

The ID of the repository where the pull request is being merged.

  • string

Project ID or project name

query True
  • string

Specify the API version to utilize, by setting it to ‘6.0-preview.1’ for accessing this particular version of the API.


Name Type Description
200 OK

successful operation



Category: OAuth2
Method: AccessCode
URL for Authorization: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
URL for Token: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Name Description
vso.code_write This permission provides access to source code, enabling users to read, update, and delete it. Additionally, it allows access to metadata related to version control artifacts, such as commits, changesets, and branches. Users can also create and manage pull requests and code reviews, and receive notifications about version control events through service hooks.

Frequently Asked Questions