Percy Visual Git API

Branchline sync and merge of approved snapshots across branch lines.

OpenAPI Specification

percy-visual-git-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Percy REST Builds Visual Git API
  description: 'Percy is a visual testing and review platform, part of BrowserStack. Snapshots are captured and uploaded during a build by the open-source Percy CLI and SDKs (@percy/cli, @percy/core, @percy/client); that upload path is SDK-internal and is not part of this public REST reference. This document models the documented, publicly referenced Percy REST API under https://percy.io/api/v1 for reading and managing Projects, Builds, and Snapshots, plus Visual Git (branchline) sync and merge.

    Two authentication schemes are used. Read operations (list/get on projects, builds, snapshots, and all Visual Git calls) authenticate with a per-project token passed as `Authorization: Token token=<PROJECT_TOKEN>`. Write and review operations (approve/reject a build, fail or delete a build, create or update a project) authenticate with BrowserStack HTTP Basic auth using your BrowserStack username and access key.

    Request and response bodies here are honestly modeled from the public API reference. Field-level schemas are illustrative; consult the BrowserStack Percy API reference for authoritative payloads.'
  version: '1.0'
  contact:
    name: Percy by BrowserStack
    url: https://www.browserstack.com/docs/percy
servers:
- url: https://percy.io/api/v1
  description: Percy REST API
security:
- projectToken: []
tags:
- name: Visual Git
  description: Branchline sync and merge of approved snapshots across branch lines.
paths:
  /branchline/sync:
    post:
      operationId: syncBranchline
      tags:
      - Visual Git
      summary: Sync snapshots to a branchline
      description: Syncs a project's snapshots with the branch specified in target_branch_filter.
      security:
      - projectToken: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BranchlineSyncInput'
      responses:
        '200':
          description: The sync operation was started.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchlineSyncResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /branchline/sync/{sync_id}:
    get:
      operationId: getBranchlineSync
      tags:
      - Visual Git
      summary: Check sync status
      description: Retrieves the current status of a branchline sync operation.
      security:
      - projectToken: []
      parameters:
      - name: sync_id
        in: path
        required: true
        description: The ID of the sync operation.
        schema:
          type: string
      responses:
        '200':
          description: The sync operation status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchlineSyncResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /branchline/merge:
    post:
      operationId: mergeBranchline
      tags:
      - Visual Git
      summary: Merge snapshots into the master branchline
      description: Merges approved snapshots from a feature branch into the master branchline.
      security:
      - projectToken: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BranchlineMergeInput'
      responses:
        '200':
          description: The merge operation was applied.
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication failed or the token is missing/invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              status:
                type: string
              detail:
                type: string
    BranchlineSyncInput:
      type: object
      description: Request to sync a project's snapshots with a target branch. Provide either project_id or the project_slug + organization_slug pair.
      properties:
        project_id:
          type: string
        project_slug:
          type: string
        organization_slug:
          type: string
        target_branch_filter:
          type: string
        snapshot_name_list:
          type: array
          items:
            type: string
      required:
      - target_branch_filter
    BranchlineSyncResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
              example: branchline-syncs
            attributes:
              type: object
              properties:
                status:
                  type: string
    BranchlineMergeInput:
      type: object
      description: Request to merge approved snapshots from a feature branch into the master branchline.
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              example: branchline-merges
            relationships:
              type: object
              properties:
                build:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          example: builds
                        id:
                          type: string
  securitySchemes:
    projectToken:
      type: apiKey
      in: header
      name: Authorization
      description: 'Per-project token passed in the Authorization header using Percy''s token scheme - literally `Authorization: Token token=<PROJECT_TOKEN>`. Because the value is prefixed with `Token token=`, model this as a custom header value rather than a plain bearer token.'
    browserstackBasic:
      type: http
      scheme: basic
      description: BrowserStack HTTP Basic auth (base64 of username:accesskey). Required for review actions and for creating or updating projects.