Percy Snapshots API

Snapshots are the individual visual comparisons within a build.

OpenAPI Specification

percy-snapshots-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Percy REST Builds Snapshots 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: Snapshots
  description: Snapshots are the individual visual comparisons within a build.
paths:
  /snapshots:
    get:
      operationId: listSnapshots
      tags:
      - Snapshots
      summary: List snapshots for a build
      description: Lists the snapshots that make up a build.
      security:
      - projectToken: []
      parameters:
      - name: build_id
        in: query
        required: true
        description: The ID of the build whose snapshots to list.
        schema:
          type: string
      - name: filter[review-state-reason][]
        in: query
        description: Filter by one or more review state reasons.
        schema:
          type: array
          items:
            type: string
      - name: filter[snapshot-ids][]
        in: query
        description: Filter by one or more snapshot IDs.
        schema:
          type: array
          items:
            type: string
      - name: filter[search]
        in: query
        description: Search snapshots by name.
        schema:
          type: string
      - name: page[limit]
        in: query
        description: Number of snapshots per page (default and max 30).
        schema:
          type: integer
          maximum: 30
      - name: page[cursor]
        in: query
        description: Pagination cursor for subsequent pages.
        schema:
          type: string
      responses:
        '200':
          description: A list of snapshots for the build.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnapshotListResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /snapshots/{snapshot_id}:
    get:
      operationId: getSnapshot
      tags:
      - Snapshots
      summary: Get snapshot details
      description: Fetches a single snapshot's details, including its review state and per-browser/width comparisons.
      security:
      - projectToken: []
      parameters:
      - name: snapshot_id
        in: path
        required: true
        description: The ID of the snapshot.
        schema:
          type: string
      responses:
        '200':
          description: The requested snapshot.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnapshotResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
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
    Snapshot:
      type: object
      description: A Percy snapshot - one visual comparison within a build.
      properties:
        id:
          type: string
        type:
          type: string
          example: snapshots
        attributes:
          type: object
          properties:
            name:
              type: string
            review-state:
              type: string
            review-state-reason:
              type: string
            fingerprint:
              type: string
    SnapshotResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Snapshot'
    SnapshotListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Snapshot'
  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.