Get branch merge preview

http
GET /projects/{project_reference}/branches/{branch_id}/merge-preview

Show the file-by-file changes a merge would apply, with conflict regions and contents. Requires project.read.

Servers

JSON
[  {    "url": "https://api.veryfront.com"  }]

Authentication

JSON
[  {    "bearerAuth": []  },  {    "apiKeyAuth": []  }]
JSON
{  "bearerAuth": {    "type": "http",    "scheme": "bearer",    "bearerFormat": "JWT or API Key",    "description": "Use a JWT bearer token or a Veryfront API key in the `Authorization` header."  },  "apiKeyAuth": {    "type": "apiKey",    "in": "header",    "name": "X-API-Key",    "description": "Alternative API key header for `vf_<prefix>_<secret>` tokens."  }}

Parameters

NameLocationRequiredDescription
project_referencepathYesProject slug, UUID, or domain that identifies the project.
branch_idpathYes
target_branch_idqueryNoTarget branch ID; omit for main.

Parameter contracts

JSON
[  {    "schema": {      "$ref": "#/components/schemas/ProjectReference"    },    "required": true,    "description": "Project slug, UUID, or domain that identifies the project.",    "name": "project_reference",    "in": "path"  },  {    "schema": {      "type": "string",      "format": "uuid",      "description": "Branch UUID belonging to the selected project. Missing or foreign branches return 404."    },    "required": true,    "name": "branch_id",    "in": "path"  },  {    "schema": {      "type": [        "string",        "null"      ],      "format": "uuid",      "description": "Target branch ID; omit for main."    },    "required": false,    "description": "Target branch ID; omit for main.",    "name": "target_branch_id",    "in": "query"  }]

Responses

200

Merge preview.

JSON
{  "description": "Merge preview.",  "content": {    "application/json": {      "schema": {        "type": "object",        "properties": {          "source_branch": {            "type": "object",            "properties": {              "id": {                "type": "string",                "format": "uuid",                "description": "Branch ID."              },              "name": {                "type": "string",                "description": "Branch name, unique in the project."              },              "project_id": {                "type": "string",                "format": "uuid",                "description": "Project that owns the branch."              },              "base_branch_id": {                "type": [                  "string",                  "null"                ],                "format": "uuid",                "description": "Branch this branch was created from, or null for the root branch."              },              "status": {                "type": "string",                "enum": [                  "active",                  "merged",                  "closed"                ],                "description": "Lifecycle state; closed is distinct from merged."              },              "description": {                "type": [                  "string",                  "null"                ],                "description": "Branch description, or null."              },              "auto_delete_on_merge": {                "type": "boolean",                "description": "Whether the branch is deleted after it merges."              },              "version": {                "type": "integer",                "minimum": 0,                "description": "Version to pass as expected_version when merging."              },              "created_at": {                "type": "string",                "description": "Creation time."              },              "created_by": {                "type": [                  "string",                  "null"                ],                "format": "uuid",                "description": "User who created the branch, or null."              },              "updated_at": {                "type": [                  "string",                  "null"                ],                "description": "Last update time, or null."              },              "merged_at": {                "type": [                  "string",                  "null"                ],                "description": "Merge time, or null before a merge."              },              "merged_by": {                "type": [                  "string",                  "null"                ],                "format": "uuid",                "description": "User who merged the branch, or null."              }            },            "required": [              "id",              "name",              "project_id",              "base_branch_id",              "status",              "description",              "auto_delete_on_merge",              "version",              "created_at",              "created_by",              "updated_at",              "merged_at",              "merged_by"            ],            "description": "Branch to merge."          },          "target_branch_id": {            "type": [              "string",              "null"            ],            "format": "uuid",            "description": "Branch that receives the merge, or null for main."          },          "target_branch_name": {            "type": "string",            "description": "Name of the branch that receives the merge."          },          "can_merge": {            "type": "boolean",            "description": "True only when blocked_reason is null, merge policies pass and no file has conflicts. Advisory: the merge checks these conditions again."          },          "blocked_reason": {            "type": [              "string",              "null"            ],            "description": "Precondition that blocks the merge, such as a merged or closed branch, or a target that is the source branch or is closed; null when none does. A target that is missing or in another project is a not found error."          },          "has_conflicts": {            "type": "boolean",            "description": "Whether at least one file has conflicts."          },          "diffs": {            "type": "array",            "items": {              "type": "object",              "properties": {                "file_path": {                  "type": "string",                  "description": "File path; the file ID when neither side has a path."                },                "file_type": {                  "type": "string",                  "description": "File type."                },                "file_id": {                  "type": [                    "string",                    "null"                  ],                  "description": "File ID, or null."                },                "has_conflicts": {                  "type": "boolean",                  "description": "Whether the file has conflicts that block an automatic merge."                },                "conflict_count": {                  "type": "integer",                  "minimum": 0,                  "description": "Number of conflict regions."                },                "conflict_regions": {                  "type": "array",                  "items": {                    "type": "object",                    "properties": {                      "id": {                        "type": "string",                        "description": "Region ID, stable within one preview; conflict resolutions are keyed by it."                      },                      "type": {                        "type": "string",                        "enum": [                          "conflict"                        ],                        "description": "Region kind."                      },                      "base_start": {                        "type": "integer",                        "description": "First line in the common base."                      },                      "base_end": {                        "type": "integer",                        "description": "Last line in the common base."                      },                      "target_start": {                        "type": "integer",                        "description": "First line in the target branch."                      },                      "target_end": {                        "type": "integer",                        "description": "Last line in the target branch."                      },                      "source_start": {                        "type": "integer",                        "description": "First line in the source branch."                      },                      "source_end": {                        "type": "integer",                        "description": "Last line in the source branch."                      },                      "base_lines": {                        "type": "string",                        "description": "Conflicting text in the common base."                      },                      "target_lines": {                        "type": "string",                        "description": "Conflicting text in the target branch."                      },                      "source_lines": {                        "type": "string",                        "description": "Conflicting text in the source branch."                      }                    },                    "required": [                      "id",                      "type",                      "base_start",                      "base_end",                      "target_start",                      "target_end",                      "source_start",                      "source_end",                      "base_lines",                      "target_lines",                      "source_lines"                    ]                  },                  "description": "Conflicting line ranges."                },                "is_new": {                  "type": "boolean",                  "description": "The merge adds the file to the target."                },                "is_deleted": {                  "type": "boolean",                  "description": "The merge deletes the file from the target."                },                "is_modified": {                  "type": "boolean",                  "description": "The merge changes the file in the target."                },                "base_changed": {                  "type": "boolean",                  "description": "The target changed the file since the branch was created."                },                "branch_changed": {                  "type": "boolean",                  "description": "The branch changed the file."                },                "base_content": {                  "type": [                    "string",                    "null"                  ],                  "description": "Content at the common base, or null."                },                "target_content": {                  "type": [                    "string",                    "null"                  ],                  "description": "Content in the target branch, or null."                },                "source_content": {                  "type": [                    "string",                    "null"                  ],                  "description": "Content in the source branch, or null."                }              },              "required": [                "file_path",                "file_type",                "file_id",                "has_conflicts",                "conflict_count",                "conflict_regions",                "is_new",                "is_deleted",                "is_modified",                "base_changed",                "branch_changed",                "base_content",                "target_content",                "source_content"              ]            },            "description": "File-by-file changes the merge applies."          }        },        "required": [          "source_branch",          "target_branch_id",          "target_branch_name",          "can_merge",          "blocked_reason",          "has_conflicts",          "diffs"        ]      },      "example": {        "source_branch": {          "id": "0f6d3c1e-2a4b-4c8d-9e7f-1a2b3c4d5e6f",          "name": "feature-header",          "project_id": "3b9e2c7a-5d41-4f8e-9a6b-2c1d0e9f8a7b",          "base_branch_id": "7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",          "created_at": "2026-10-10T12:00:00.000Z",          "created_by": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",          "merged_at": null,          "merged_by": null,          "status": "active",          "updated_at": "2026-10-10T12:00:00.000Z",          "version": 4,          "description": null,          "auto_delete_on_merge": false        },        "target_branch_id": null,        "target_branch_name": "main",        "can_merge": false,        "blocked_reason": null,        "has_conflicts": false,        "diffs": [          {            "file_id": "4f5e6d7c-8b9a-4c0d-9e1f-2a3b4c5d6e7f",            "file_path": "pages/index.tsx",            "file_type": "page",            "has_conflicts": false,            "conflict_count": 0,            "conflict_regions": [],            "is_new": false,            "is_deleted": false,            "is_modified": true,            "base_changed": false,            "branch_changed": true,            "base_content": "export default 1",            "target_content": "export default 1",            "source_content": "export default 2"          }        ]      }    }  }}

400

Bad request

JSON
{  "description": "Bad request",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

401

Unauthorized

JSON
{  "description": "Unauthorized",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

403

Forbidden

JSON
{  "description": "Forbidden",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

404

Not found

JSON
{  "description": "Not found",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

500

Server error

JSON
{  "description": "Server error",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

503

internal: authentication state is temporarily unavailable and the request was not processed; retry shortly.

JSON
{  "description": "internal: authentication state is temporarily unavailable and the request was not processed; retry shortly.",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

Referenced contracts

components/parameters/ProjectReference

JSON
{  "schema": {    "$ref": "#/components/schemas/ProjectReference"  },  "required": true,  "description": "Project slug, UUID, or domain that identifies the project.",  "name": "project_reference",  "in": "path"}

components/schemas/ProjectReference

JSON
{  "type": "string"}

components/schemas/Problem

JSON
{  "type": "object",  "properties": {    "cause": {      "type": "string",      "enum": [        "schedule_concurrency_forbidden",        "schedule_fire_in_progress",        "schedule_run_limit_reached"      ],      "description": "Schedule admission refusal."    },    "idempotency": {      "type": "object",      "properties": {        "state": {          "type": "string",          "enum": [            "in_progress",            "payload_mismatch",            "outcome_unknown"          ]        },        "operation": {          "type": "string",          "minLength": 1        },        "retryable": {          "type": "boolean"        },        "retry_after_seconds": {          "type": [            "integer",            "null"          ],          "minimum": 0        },        "expires_at": {          "type": [            "string",            "null"          ]        },        "recovery": {          "type": "object",          "properties": {            "available": {              "type": "boolean"            },            "description": {              "type": "string"            },            "resource_url": {              "type": "string"            }          },          "required": [            "available",            "description"          ]        }      },      "required": [        "state",        "operation",        "retryable",        "retry_after_seconds",        "expires_at"      ],      "description": "Replay status, retry timing, and recovery lookup."    },    "type": {      "type": "string",      "description": "URI reference identifying the problem type",      "example": "https://api.veryfront.com/errors/validation-failed"    },    "title": {      "type": "string",      "description": "Short human-readable summary of the problem",      "example": "Validation Failed"    },    "status": {      "type": "integer",      "minimum": 100,      "maximum": 599,      "description": "HTTP status code",      "example": 400    },    "code": {      "type": "string",      "description": "Stable machine-readable error code",      "example": "RUN_INVALID_INPUT"    },    "detail": {      "type": "string",      "description": "Human-readable explanation specific to this occurrence",      "example": "The 'email' field must be a valid email address"    },    "instance": {      "type": "string",      "description": "URI reference identifying the specific occurrence",      "example": "/projects/my-project/members"    },    "slug": {      "type": "string",      "description": "Stable identifier for the problem type",      "example": "validation-failed"    },    "category": {      "type": "string",      "enum": [        "AUTH",        "RESOURCE",        "VALIDATION",        "DATABASE",        "SUBSCRIPTION",        "INTEGRATION",        "INTERNAL"      ],      "description": "API error category",      "example": "VALIDATION"    },    "suggestion": {      "type": "string",      "description": "Suggested action to resolve the problem",      "example": "Check the request body and query parameters against the API documentation."    },    "errors": {      "type": "array",      "items": {        "type": "object",        "properties": {          "field": {            "type": "string",            "description": "Field path that caused the error",            "example": "email"          },          "message": {            "type": "string",            "description": "Error message for this field",            "example": "Invalid email format"          },          "code": {            "type": "string",            "description": "Error code for this field",            "example": "INVALID_FORMAT"          }        },        "required": [          "field",          "message"        ]      },      "description": "Detailed field-level errors for validation failures"    }  },  "required": [    "type",    "title",    "status"  ]}

Operation contract

JSON
{  "operationId": "getBranchMergePreview",  "tags": [    "projects/Branches/Branch Merges"  ],  "summary": "Get branch merge preview",  "description": "Show the file-by-file changes a merge would apply, with conflict regions and contents. Requires project.read.",  "parameters": [    {      "$ref": "#/components/parameters/ProjectReference"    },    {      "schema": {        "type": "string",        "format": "uuid",        "description": "Branch UUID belonging to the selected project. Missing or foreign branches return 404."      },      "required": true,      "name": "branch_id",      "in": "path"    },    {      "schema": {        "type": [          "string",          "null"        ],        "format": "uuid",        "description": "Target branch ID; omit for main."      },      "required": false,      "description": "Target branch ID; omit for main.",      "name": "target_branch_id",      "in": "query"    }  ],  "responses": {    "200": {      "description": "Merge preview.",      "content": {        "application/json": {          "schema": {            "type": "object",            "properties": {              "source_branch": {                "type": "object",                "properties": {                  "id": {                    "type": "string",                    "format": "uuid",                    "description": "Branch ID."                  },                  "name": {                    "type": "string",                    "description": "Branch name, unique in the project."                  },                  "project_id": {                    "type": "string",                    "format": "uuid",                    "description": "Project that owns the branch."                  },                  "base_branch_id": {                    "type": [                      "string",                      "null"                    ],                    "format": "uuid",                    "description": "Branch this branch was created from, or null for the root branch."                  },                  "status": {                    "type": "string",                    "enum": [                      "active",                      "merged",                      "closed"                    ],                    "description": "Lifecycle state; closed is distinct from merged."                  },                  "description": {                    "type": [                      "string",                      "null"                    ],                    "description": "Branch description, or null."                  },                  "auto_delete_on_merge": {                    "type": "boolean",                    "description": "Whether the branch is deleted after it merges."                  },                  "version": {                    "type": "integer",                    "minimum": 0,                    "description": "Version to pass as expected_version when merging."                  },                  "created_at": {                    "type": "string",                    "description": "Creation time."                  },                  "created_by": {                    "type": [                      "string",                      "null"                    ],                    "format": "uuid",                    "description": "User who created the branch, or null."                  },                  "updated_at": {                    "type": [                      "string",                      "null"                    ],                    "description": "Last update time, or null."                  },                  "merged_at": {                    "type": [                      "string",                      "null"                    ],                    "description": "Merge time, or null before a merge."                  },                  "merged_by": {                    "type": [                      "string",                      "null"                    ],                    "format": "uuid",                    "description": "User who merged the branch, or null."                  }                },                "required": [                  "id",                  "name",                  "project_id",                  "base_branch_id",                  "status",                  "description",                  "auto_delete_on_merge",                  "version",                  "created_at",                  "created_by",                  "updated_at",                  "merged_at",                  "merged_by"                ],                "description": "Branch to merge."              },              "target_branch_id": {                "type": [                  "string",                  "null"                ],                "format": "uuid",                "description": "Branch that receives the merge, or null for main."              },              "target_branch_name": {                "type": "string",                "description": "Name of the branch that receives the merge."              },              "can_merge": {                "type": "boolean",                "description": "True only when blocked_reason is null, merge policies pass and no file has conflicts. Advisory: the merge checks these conditions again."              },              "blocked_reason": {                "type": [                  "string",                  "null"                ],                "description": "Precondition that blocks the merge, such as a merged or closed branch, or a target that is the source branch or is closed; null when none does. A target that is missing or in another project is a not found error."              },              "has_conflicts": {                "type": "boolean",                "description": "Whether at least one file has conflicts."              },              "diffs": {                "type": "array",                "items": {                  "type": "object",                  "properties": {                    "file_path": {                      "type": "string",                      "description": "File path; the file ID when neither side has a path."                    },                    "file_type": {                      "type": "string",                      "description": "File type."                    },                    "file_id": {                      "type": [                        "string",                        "null"                      ],                      "description": "File ID, or null."                    },                    "has_conflicts": {                      "type": "boolean",                      "description": "Whether the file has conflicts that block an automatic merge."                    },                    "conflict_count": {                      "type": "integer",                      "minimum": 0,                      "description": "Number of conflict regions."                    },                    "conflict_regions": {                      "type": "array",                      "items": {                        "type": "object",                        "properties": {                          "id": {                            "type": "string",                            "description": "Region ID, stable within one preview; conflict resolutions are keyed by it."                          },                          "type": {                            "type": "string",                            "enum": [                              "conflict"                            ],                            "description": "Region kind."                          },                          "base_start": {                            "type": "integer",                            "description": "First line in the common base."                          },                          "base_end": {                            "type": "integer",                            "description": "Last line in the common base."                          },                          "target_start": {                            "type": "integer",                            "description": "First line in the target branch."                          },                          "target_end": {                            "type": "integer",                            "description": "Last line in the target branch."                          },                          "source_start": {                            "type": "integer",                            "description": "First line in the source branch."                          },                          "source_end": {                            "type": "integer",                            "description": "Last line in the source branch."                          },                          "base_lines": {                            "type": "string",                            "description": "Conflicting text in the common base."                          },                          "target_lines": {                            "type": "string",                            "description": "Conflicting text in the target branch."                          },                          "source_lines": {                            "type": "string",                            "description": "Conflicting text in the source branch."                          }                        },                        "required": [                          "id",                          "type",                          "base_start",                          "base_end",                          "target_start",                          "target_end",                          "source_start",                          "source_end",                          "base_lines",                          "target_lines",                          "source_lines"                        ]                      },                      "description": "Conflicting line ranges."                    },                    "is_new": {                      "type": "boolean",                      "description": "The merge adds the file to the target."                    },                    "is_deleted": {                      "type": "boolean",                      "description": "The merge deletes the file from the target."                    },                    "is_modified": {                      "type": "boolean",                      "description": "The merge changes the file in the target."                    },                    "base_changed": {                      "type": "boolean",                      "description": "The target changed the file since the branch was created."                    },                    "branch_changed": {                      "type": "boolean",                      "description": "The branch changed the file."                    },                    "base_content": {                      "type": [                        "string",                        "null"                      ],                      "description": "Content at the common base, or null."                    },                    "target_content": {                      "type": [                        "string",                        "null"                      ],                      "description": "Content in the target branch, or null."                    },                    "source_content": {                      "type": [                        "string",                        "null"                      ],                      "description": "Content in the source branch, or null."                    }                  },                  "required": [                    "file_path",                    "file_type",                    "file_id",                    "has_conflicts",                    "conflict_count",                    "conflict_regions",                    "is_new",                    "is_deleted",                    "is_modified",                    "base_changed",                    "branch_changed",                    "base_content",                    "target_content",                    "source_content"                  ]                },                "description": "File-by-file changes the merge applies."              }            },            "required": [              "source_branch",              "target_branch_id",              "target_branch_name",              "can_merge",              "blocked_reason",              "has_conflicts",              "diffs"            ]          },          "example": {            "source_branch": {              "id": "0f6d3c1e-2a4b-4c8d-9e7f-1a2b3c4d5e6f",              "name": "feature-header",              "project_id": "3b9e2c7a-5d41-4f8e-9a6b-2c1d0e9f8a7b",              "base_branch_id": "7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",              "created_at": "2026-10-10T12:00:00.000Z",              "created_by": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",              "merged_at": null,              "merged_by": null,              "status": "active",              "updated_at": "2026-10-10T12:00:00.000Z",              "version": 4,              "description": null,              "auto_delete_on_merge": false            },            "target_branch_id": null,            "target_branch_name": "main",            "can_merge": false,            "blocked_reason": null,            "has_conflicts": false,            "diffs": [              {                "file_id": "4f5e6d7c-8b9a-4c0d-9e1f-2a3b4c5d6e7f",                "file_path": "pages/index.tsx",                "file_type": "page",                "has_conflicts": false,                "conflict_count": 0,                "conflict_regions": [],                "is_new": false,                "is_deleted": false,                "is_modified": true,                "base_changed": false,                "branch_changed": true,                "base_content": "export default 1",                "target_content": "export default 1",                "source_content": "export default 2"              }            ]          }        }      }    },    "400": {      "description": "Bad request",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "401": {      "description": "Unauthorized",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "403": {      "description": "Forbidden",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "404": {      "description": "Not found",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "500": {      "description": "Server error",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "503": {      "description": "internal: authentication state is temporarily unavailable and the request was not processed; retry shortly.",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    }  },  "x-documentation-source-tag": "Branches",  "x-canonical-documentation": {    "domain": "projects",    "resource": "Branches",    "subgroup": "Branch Merges",    "name": "Get branch merge preview",    "description": "Show the file-by-file changes a merge would apply, with conflict regions and contents. Requires project.read.",    "operationId": "getBranchMergePreview"  },  "x-mint": {    "href": "/cloud/rest/api-reference/projects-branches-branch-merges/get-branch-merge-preview"  }}