openapi: 3.0.0
servers:
  - url: https://crossbrowsertesting.com/api/v3
info:
  contact:
    x-twitter: xbrowsertesting
  description: |-
    What's in this version: 
     1. Compare two screenshots for layout differences 
     2. Compare a full screenshot test of browsers to a single baseline browser for layout differences. 
     3. Compare a screenshot test version to another test version - good for regression tests. 
     4. Get links to the Comparison UI for visual representation of layout differences
  title: Crossbrowsertesting.com Screenshot Comparisons API
  version: 3.0.0
  x-apisguru-categories:
    - developer_tools
  x-logo:
    url: https://twitter.com/xbrowsertesting/profile_image?size=original
  x-origin:
    - format: openapi
      url: https://crossbrowsertesting.com/apidocs/definitions/screenshot-comparisons.json
      version: "3.0"
  x-providerName: crossbrowsertesting.com
paths:
  "/screenshots/{target_screenshot_test_id}/{target_version_id}/comparison/parallel/{base_version_id}":
    get:
      description: Get comparison results for all browsers in target screenshot test against the same browser in the base screenshot test. This is a good method for regression testing. For example, you've run a screenshot test against a set of browsers that is "good". Then, after some changes, you run a new screenshot test against the same set of browsers. This method will compare each of the same browsers against each other. For example, IE9 will be compared to IE9 from an earlier test. This is a many-to-many comparison where the OS/Browser/Resolution must match between the two test versions in order for the comparison to return results. The two versions can be from the same screenshot_test_id or not.
      parameters:
        - description: test id of the target Screenshot Test
          in: path
          name: target_screenshot_test_id
          required: true
          schema:
            type: integer
        - description: version id of the target Screenshot Test
          in: path
          name: target_version_id
          required: true
          schema:
            type: integer
        - description: version id of the base Screenshot Test
          in: path
          name: base_version_id
          required: true
          schema:
            type: integer
        - description: The format of the returned data. Possible values are "json" or "jsonp".
          in: query
          name: format
          required: false
          schema:
            default: json
            type: string
        - description: Name of callback method for JSONP requests.
          in: query
          name: callback
          required: false
          schema:
            type: string
        - description: Used as the basis for detecting box model differences in element positioning and dimensions that should be flagged and reported back to the comparison results. The default is 30px which is a good basis for finding notable layout differences.
          in: query
          name: tolerance
          schema:
            default: 30
            format: integer 0-100
            type: number
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/single_comparison_test"
                type: array
          description: An array of Configuration objects. Within each configuration is an array of browsers
      security:
        - basicAuth: []
      summary: Compare Screenshot Test Versions
  "/screenshots/{target_screenshot_test_id}/{target_version_id}/comparison/{base_result_id}":
    get:
      description: Get comparison results for all browsers in target screenshot test against a base screenshot result. The base result can be from the same test or from another test run at an earlier time. This is a one-to-many comparison.
      parameters:
        - description: test id of the target Screenshot Test
          in: path
          name: target_screenshot_test_id
          required: true
          schema:
            type: integer
        - description: version id of the target Screenshot Test
          in: path
          name: target_version_id
          required: true
          schema:
            type: integer
        - description: result id of the base Screenshot Test
          in: path
          name: base_result_id
          required: true
          schema:
            type: integer
        - description: The format of the returned data. Possible values are "json" or "jsonp".
          in: query
          name: format
          required: false
          schema:
            default: json
            type: string
        - description: Name of callback method for JSONP requests.
          in: query
          name: callback
          required: false
          schema:
            type: string
        - description: Used as the basis for detecting box model differences in element positioning and dimensions that should be flagged and reported back to the comparison results. The default is 30px which is a good basis for finding notable layout differences.
          in: query
          name: tolerance
          schema:
            default: 30
            format: integer 0-100
            type: number
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/full_comparison_test"
          description: An array of Configuration objects. Within each configuration is an array of browsers
      security:
        - basicAuth: []
      summary: Compare Full Screenshot Test
  "/screenshots/{target_screenshot_test_id}/{target_version_id}/{target_result_id}/comparison/{base_result_id}":
    get:
      description: Get comparison results for a single target screenshot result against a base screenshot result. This is a one-to-one comparison.
      parameters:
        - description: test id of the target Screenshot Test
          in: path
          name: target_screenshot_test_id
          required: true
          schema:
            type: integer
        - description: version id of the target Screenshot Test
          in: path
          name: target_version_id
          required: true
          schema:
            type: integer
        - description: result id of the target Screenshot Test
          in: path
          name: target_result_id
          required: true
          schema:
            type: integer
        - description: result id of the base Screenshot Test
          in: path
          name: base_result_id
          required: true
          schema:
            type: integer
        - description: The format of the returned data. Possible values are "json" or "jsonp".
          in: query
          name: format
          required: false
          schema:
            default: json
            type: string
        - description: Name of callback method for JSONP requests.
          in: query
          name: callback
          required: false
          schema:
            type: string
        - description: Used as the basis for detecting box model differences in element positioning and dimensions that should be flagged and reported back to the comparison results. The default is 30px which is a good basis for finding notable layout differences.
          in: query
          name: tolerance
          schema:
            default: 30
            format: integer 0-100
            type: number
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/single_comparison_test"
          description: An array of Configuration objects. Within each configuration is an array of browsers
      security:
        - basicAuth: []
      summary: Compare Single Screenshot
components:
  schemas:
    comparison:
      properties:
        differences:
          type: integer
        elements:
          items:
            $ref: "#/components/schemas/element"
          type: array
        error:
          type: boolean
        message:
          type: string
        show_comparisons_public_url:
          type: string
        show_comparisons_web_url:
          type: string
        tolerance:
          type: integer
      type: object
    element:
      properties:
        difference:
          type: string
        full_path:
          type: string
        short_path:
          type: string
        show_difference_public_url:
          type: string
        show_difference_web_url:
          type: string
      type: object
    full_comparison_test:
      properties:
        base:
          properties:
            screenshot:
              $ref: "#/components/schemas/screenshot"
          type: object
        targets:
          items:
            $ref: "#/components/schemas/target"
          type: array
      type: object
    screenshot:
      properties:
        screenshot_id:
          type: integer
      type: object
    single_comparison_test:
      properties:
        base:
          properties:
            screenshot:
              $ref: "#/components/schemas/screenshot"
          type: object
        target:
          $ref: "#/components/schemas/target"
      type: object
    target:
      properties:
        comparison:
          $ref: "#/components/schemas/comparison"
        screenshot:
          $ref: "#/components/schemas/screenshot"
      type: object
  securitySchemes:
    basicAuth:
      description: HTTP Basic Authentication
      scheme: basic
      type: http
