Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
API Reference – Happo
[go: Go Back, main page]

API Reference

Happo exposes a public, REST-like, API that you can use to create or enhance custom integrations. The API resides at https://happo.io, and all endpoints use the /api namespace.

OpenAPI spec for the public Happo API

Want to use Happo from Claude, ChatGPT, Cursor, or another AI assistant? Happo also runs an MCP server with OAuth so AI agents can list comparisons, inspect diffs, and approve, reject, or report flakes for them.

Authentication

All API endpoints are auth protected. To successfully issue a command, you need to provide an authentication header with your request. There are two ways to authenticate. JWT authentication is more secure but can be a little tricky to set up. HTTP Basic authentication is a less secure alternative, but is a good option if you want a simpler setup.

Basic authentication

With Basic authentication, you provide an Authorization: Basic <token> header where the token is a base64 encoded string of your apiKey:apiSecret tokens.

JWT authentication

This auth token is a JSON web token generated based on your API key and API secret. Pass { key: <your API key> } as the payload of the JWT call and the API secret as the secret, and set a kid header equal to the API key. Pass the resulting token as a Authorization: Bearer <generated token> header in all API requests.

An example of how to construct the JWT token can be found in the source code for the happo.io client.

Endpoints

Here's a full list of API paths you can call. All endpoints speak JSON. Body params are sent as a JSON blob in the body of the request. Responses are sent as JSON in the body of the HTTP response.

Reports

Create report

POST /api/reports/:sha

URL params

  • :shaString

Body params

  • snapsArray<Snapshot>
  • projectoptional String
  • linkoptional String
  • messageoptional String
  • partialoptional Boolean

Response

Error responses

  • 400
  • 401

Get report

GET /api/reports/:sha

URL params

  • :shaString

Query params

  • projectoptional String

Response

Error responses

  • 401
  • 404

Get report status

GET /api/reports/:sha/status

URL params

  • :shaString

Query params

  • projectoptional String
  • projectsoptional String

Response

Error responses

  • 400
  • 401
  • 404

Complete a report

POST /api/reports/:sha/complete

URL params

  • :shaString

Body params

  • projectoptional String
  • projectsoptional Array<String>

Response

Error responses

  • 400
  • 401
  • 404

Clone report

POST /api/reports/:fromSha/clone/:toSha

URL params

  • :fromShaString
  • :toShaString

Body params

  • projectoptional String
  • linkoptional String
  • messageoptional String

Response

Error responses

  • 401
  • 404

POST /api/skip/:sha

URL params

  • :shaString

Body params

  • projectoptional String
  • labeloptional String

Error responses

  • 401
  • 404

Comparisons

Compare reports

POST /api/reports/:sha1/compare/:sha2

URL params

  • :sha1String
  • :sha2String

Body params

  • projectoptional String
  • projectsoptional Array<String>
  • linkoptional String
  • messageoptional String
  • notifyoptional String
  • isAsyncoptional Boolean
  • fallbackShasoptional Array<String>
  • deepCompareoptional DeepCompareSettings

Response

Error responses

  • 400
  • 401

Get comparison status

GET /api/reports/:sha1/compare/:sha2/status

URL params

  • :sha1String
  • :sha2String

Query params

  • projectoptional String

Response

Error responses

  • 401
  • 404

Get comparison statuses

GET /api/reports/:sha/comparison-statuses

URL params

  • :shaString

Query params

  • projectoptional String

Response

Error responses

  • 401

Get comparison results

GET /api/reports/:sha1/compare/:sha2/results

URL params

  • :sha1String
  • :sha2String

Query params

  • projectoptional String

Response

Error responses

  • 401
  • 404

Get comparisons

GET /api/comparisons

Query params

  • fromoptional Date
  • tooptional Date
  • limitoptional Number
  • projectoptional String

Response

Error responses

  • 401

Jobs

Create job

POST /api/jobs/:sha1/:sha2

URL params

  • :sha1String
  • :sha2String

Body params

  • projectoptional String
  • projectsoptional Array<String>
  • linkoptional String
  • messageoptional String

Response

Error responses

  • 401

Create orchestration job

POST /api/jobs/:sha1/:sha2/orchestrate

URL params

  • :sha1String
  • :sha2String

Body params

  • projectsArray<String>
  • linkoptional String
  • messageoptional String

Response

Error responses

  • 400
  • 401

Cancel job

POST /api/jobs/:sha1/:sha2/cancel

URL params

  • :sha1String
  • :sha2String

Body params

  • projectoptional String
  • statusoptional String
  • linkoptional String
  • messageoptional String

Error responses

  • 401
  • 404
  • 409

Get jobs

GET /api/jobs

Query params

  • fromoptional Date
  • tooptional Date
  • limitoptional Number

Response

Error responses

  • 401

Get job

GET /api/jobs/:id

URL params

  • :idNumber

Response

Error responses

  • 401
  • 404

Miscellaneous

Get flakes

GET /api/flake

Query params

  • projectoptional String
  • limitoptional Number
  • pageoptional Number
  • componentoptional String
  • variantoptional String
  • targetoptional String
  • shaoptional String

Response

Error responses

  • 401

Ignore diff

POST /api/ignored-diffs

Body params

  • snapshot1IdString
  • snapshot2IdString
  • projectoptional String

Response

  • jsonObject

Error responses

  • 401
  • 404

Delete ignored diff

DELETE /api/ignored-diffs

Body params

  • snapshot1IdString
  • snapshot2IdString

Error responses

  • 401
  • 404

Add component subscriptions

POST /api/subscriptions/:component

URL params

  • :componentString

Body params

  • emailAddressesArray<String>

Error responses

  • 400
  • 401

Remove component subscriptions

DELETE /api/subscriptions/:component

URL params

  • :componentString

Body params

  • emailAddressesArray<String>

Error responses

  • 401

Get snapshot
Experimental

GET /api/components/:component/:variant/:target

URL params

  • :componentString
  • :variantString
  • :targetString

Query params

  • projectoptional String

Response

Error responses

  • 401
  • 404

Get diff counts

GET /api/diff-counts

Query params

  • projectoptional String
  • fromoptional Date
  • tooptional Date

Response

  • jsonArray

Error responses

  • 400
  • 401

Get current usage

GET /api/billing/current-usage

Response

Error responses

  • 401
  • 404

Get projects

GET /api/projects

Response

Error responses

  • 401

Objects

These are the domain objects you can come across while communicating with the API.

Snapshot

An object describing a screenshot of a certain component variant

  • urlString
  • variantString
  • targetString
  • componentString
  • widthNumber
  • heightNumber
  • idString

SnapshotInfo

An object with information about a screenshot image.

  • urlString
  • widthNumber
  • heightNumber

ReportStatus

An object with useful properties for a report.

  • urlString
  • completedAtDate
  • createdAtDate
  • snapshotCountNumber

IgnoredDiffDetails

An object with details about why a diff was ignored.

  • byNameString
  • byEmailString
  • createdAtDate
  • dataHappoHideoptional Boolean
  • sourceComparisonoptional Object

Comparison

An object with useful properties describing the differences between two reports.

ComparisonStatus

An object with information about the status of a comparison.

  • sha1String
  • sha2String
  • statusString
  • urlString
  • createdAtDate
  • diffsNumber
  • unchangedNumber
  • addedNumber
  • deletedNumber
  • linkString
  • messageString
  • projectString

Flake

An object describing a reported flake.

  • projectString
  • componentString
  • variantString
  • targetString
  • snapshotsArray<SnapshotInfo>
  • comparisonComparisonStatus
  • userObject
  • createdAtDate
  • occurrenceCountNumber

Job

A small object with basic properties for a job.

  • urlString
  • idNumber

Usage

Snapshots usage information

  • totalNumber
  • quotaNumber
  • startDate
  • endDate

ProjectInfo

A small object with basic properties for a project.

  • idNumber
  • nameString

JobDetails

An object with useful properties for a job.

  • idNumber
  • createdAtDate
  • finishedAtDate
  • sha1String
  • sha2String
  • descriptionString
  • statusString
  • linkoptional String
  • messageoptional String
  • urlString
  • projectsArray<ProjectInfo>

DeepCompareSettings

An object with settings for deep compare.

  • diffAlgorithmString
  • compareThresholdNumber
  • ignoreThresholdNumber
  • ignoreWhitespaceBoolean
  • applyBlurBoolean

AsyncComparison

An object returned when a comparison is created with `isAsync: true`. The comparison will be completed asynchronously in the background.

  • idNumber
  • statusImageUrlString
  • compareUrlString

Need help?