# Cid canonical check

`cid-canonical-check` · version 1.0.0 · Numbers & math · free, no key needed

Check canonical CID text or binary representation and return a stable verdict.

**Use when you need to: check canonical cid text · check canonical cid binary · verify cid representation.**

## Decide before calling

Read the [versioned contract](/v1/tools/cid-canonical-check/versions/1.0.0) and the supported scope below. Reuse `cid-canonical-check@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `cid-canonical-check@1.0.0` for check canonical cid text. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- check canonical cid text
- check canonical cid binary
- verify cid representation
- detect noncanonical cid base
- audit cid varint encoding
- validate normalized cid form

## Not supported

- computing a CID from content
- verifying content bytes against a multihash

## Behavior

- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.
- Canonical CIDv0 text is its legacy base58btc form; canonical CIDv1 text is lowercase unpadded base32.
- Canonical binary uses minimally encoded unsigned varints; a well-formed mismatch returns canonical false.

## Input

- `cid` (string, required): max length 512
- `input_encoding` (one of "text", "hex", optional): default `"text"`

## Output

- `valid` (boolean, required)
- `canonical` (boolean, required)
- `version` (integer, required)
- `canonical_text` (string, required)
- `reasons` (array of string, required)
- `standard` (string, required)
- `reference` (string, required)
- `data_version` (string, required)

## Limits

- max text characters: 512
- max binary bytes: 256

## Example

Request input:

```json
{
  "cid": "bafybeie5nqv6kd3qnfjuprw2scvucpip3oda2pxyf7hyfasar4zu5flr5m"
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "canonical": true,
    "version": 1,
    "canonical_text": "bafybeie5nqv6kd3qnfjuprw2scvucpip3oda2pxyf7hyfasar4zu5flr5m",
    "reasons": [],
    "standard": "Multiformats CID Specification 1.0",
    "reference": "CID specification 1.0 §CIDv0/§CIDv1 and multicodec/multihash/multibase tables",
    "data_version": "multiformats tables snapshot 2026-10-24"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "cid-canonical-check",
  "version": "1.0.0",
  "input": {
    "cid": "bafybeie5nqv6kd3qnfjuprw2scvucpip3oda2pxyf7hyfasar4zu5flr5m"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/cid-canonical-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"cid":"bafybeie5nqv6kd3qnfjuprw2scvucpip3oda2pxyf7hyfasar4zu5flr5m"}'
```

The machine-readable contract is at [/v1/tools/cid-canonical-check/versions/1.0.0](/v1/tools/cid-canonical-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run cid-canonical-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Assignment feasibility check](/tools/assignment-feasibility-check): Check whether a claimed item-to-bin assignment is complete, unique, declared, and eligible.
- [Permutation indices check](/tools/permutation-indices-check): Check whether claimed indices are exactly one occurrence of every source index, reporting the first discrepancy.
- [Precedence levels check](/tools/precedence-levels-check): Check whether claimed node levels exactly equal the earliest levels induced by a caller-supplied DAG.
- [Bipartite coloring check](/tools/bipartite-coloring-check): Check a complete 0/1 coloring witness for graph bipartiteness and report the first certificate discrepancy.
- [Candidate key claim check](/tools/candidate-key-claim-check): Check an exact candidate-key claim, including uniqueness and minimality, under an explicit SQL null policy.
- [Capacity allocation check](/tools/capacity-allocation-check): Check an exact claimed allocation for eligibility and per-bin decimal capacity compliance.
