# Merge

`PUT /workspaces/:workspace/projects/:project_name/repository/pulls/:number/merge`

Merges a single pull request into its base branch

**Required Scopes:** `REPOSITORY_WRITE`

## URL Parameters

```typescript
interface URLParameters {
  /** The human-readable ID of the workspace */
  workspace: string; // Example: "my-company"
  /** The human-readable ID of the project */
  project_name: string; // Example: "my-project"
  /** The pull request number */
  number: number; // Example: 5
}
```

## Query Parameters

```typescript
interface QueryParameters {
  /** Squashes all commits of the pull request into a single one */
  squash?: boolean; // Example: true
  /** Deletes the head branch once the pull request is merged */
  delete_branch?: boolean; // Example: true
  /** The message of the merge commit. When omitted, it is generated from the pull request number, title and merged commits */
  commit_message?: string; // Example: "Fix login redirect (#5)"
}
```

## Response Body

```typescript
interface ResponseBody {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The pull request reference name (e.g., 'pull/5') */
  name?: string;
  /** The pull request number */
  number?: number;
  /** The HTML URL to the pull request on GitHub */
  github_html_url?: string;
  /** The state of the pull request (OPEN, CLOSED, MERGED) */
  state?: string;
  /** The title of the pull request */
  title?: string;
  /** The description of the pull request */
  description?: string;
  /** The name of the base branch (the branch the changes are merged into) */
  base?: string;
  /** The name of the head branch (the branch containing the changes) */
  head?: string;
  /** The revision of the last commit on the head branch */
  head_sha?: string;
  /** Indicates whether the pull request is a draft */
  draft?: boolean;
  /** Indicates whether the head branch can be merged into the base branch without conflicts (MERGEABLE, CONFLICTING, UNKNOWN) */
  mergeable?: string;
  /** The number of commits on the head branch that are not on the base branch; empty when unknown */
  ahead?: number;
  /** The number of commits on the base branch that are not on the head branch; empty when unknown */
  behind?: number;
  /** The date when the pull request was created */
  create_date?: string;
  /** The date when the pull request was last updated */
  last_update_date?: string;
  /** The date when the pull request was merged */
  merged_date?: string;
  /** The date when the pull request was closed */
  closed_date?: string;
  /** The labels assigned to the pull request */
  labels?: string[];
  /** The logins of the users assigned to the pull request */
  assignees?: string[];
  /** The logins of the users requested to review the pull request */
  reviewers?: string[];
  /** The provider of the pull request: BUDDY for pull requests in repositories hosted in Buddy, otherwise the integrated Git provider */
  origin?: "BUDDY" | "GITHUB" | "GITHUB_ENTERPRISE" | "GITLAB" | "GITLAB_ENTERPRISE" | "BITBUCKET" | "CUSTOM";
}
```

## Response Example

**Status:** `200 OK`


---
Original source: https://buddy.works/docs/api/version-control/pull-requests/merge