---
title: "Results viewer: the other side of a match"
method: POST
path: "/check/viewer/counterpart"
tags: ["Results"]
---

# Results viewer: the other side of a match

`POST /check/viewer/counterpart`

## Request

- Base URL: `https://codequiry.com/api/v1`
- URL: `https://codequiry.com/api/v1/check/viewer/counterpart`
- Auth: API key in header `apikey`

The code a match was found against: the peer submission's file for a peer match, or the cached copy of the external source for a web match, with the line ranges on both sides so a client can draw the comparison. AI matches have no counterpart. A web entry flagged `is_legacy_web` carries an id from a different table; send `legacy: true` for those. 404 means the source's text is simply not stored, which is a normal state for older web sources.

## Request body

- object
  - `check_id` integer, required
  - `submission_id` integer, required
  - `match_id` integer, required: The `id` of an entry in `matches` or `web_files`.
  - `legacy` boolean: true when the entry's `is_legacy_web` is true.

## Response `200`

Counterpart text and line ranges

- ViewerCounterpart
  - `success` boolean
  - `file` object
    - `content` string
    - `filedir` string
  - `match` object
    - `line_start` integer
    - `line_end` integer
    - `line_matched_start` integer
    - `line_matched_end` integer
    - `similarity` number

## Other responses

- `401`: Missing or invalid API key. The API key is checked before any endpoint logic runs, so this is returned for every operation.
- `402`: Payment required. Either the account is suspended for an unpaid invoice (every endpoint answers this until it is paid), or results are paywalled on this account until it upgrades (the viewer endpoints only). `paywalled` tells the two apart; the request was not performed.
- `404`: Resource not found or not owned by this account.
- `422`: Request validation failed.
- `429`: Rate limit exceeded: more than 60 requests in one minute from this IP. Retry after the number of seconds in the Retry-After header. Successful responses carry X-RateLimit-Limit and X-RateLimit-Remaining too, so you can pace a client without waiting to be refused.

---

[API](https://skmtc.dev/codequiry/apis/codequiry-api.md) · [All operations](https://skmtc.dev/codequiry/apis/codequiry-api/llms.txt) · [OpenAPI document](https://skmtc.dev/codequiry/apis/codequiry-api/revisions/6297e91d9665?raw)
