# PIP-0037 · Document attestations

A signed statement about a document — its digest, its issuer, its type, its date, how the member stands behind it, and a time-stamp. Anyone who holds the document verifies it against the attestation. The document itself never travels on the network.

## Why

A landlord receives a bank statement, a consulate a payslip, a bank an invoice or a company extract. Each needs to know whether the document is authentic, intact, and issued or signed by whom it says, on the date it says. The document usually travels as a file the receiver cannot check.

This PIP defines the document attestation: a member signs the digest of a document with what it states about it. The receiver computes the digest of the file it holds and compares. The member never receives the document from the receiver, and the network never holds it.

## The object

```json
{
  "type": "path.document",
  "reference": "n5bvwy1lrtgnrc",
  "issuer": "member-a",
  "digest": { "alg": "sha-256", "value": "9c4e1f0a…" },
  "media_type": "application/pdf",
  "document_type": "account_statement",
  "statement": "issued",
  "document_date": "2026-10-31",
  "origin": null,
  "signatories": [],
  "timestamp": { "authority": "tsa.example", "token": "MIIF…" },
  "status": "active",
  "issued_at": "2026-11-01T06:00:00Z",
  "protocol_version": "0.2.0",
  "signed_at": "2026-11-01T06:00:00Z",
  "kid": "op_member_a_2026_01",
  "signature": "…"
}
```

| Field | Rule |
|---|---|
| `reference` | From the common reference generator. Linkable at `/path/<reference>` |
| `issuer` | The member that signs. The attestation verifies against its keys |
| `digest` | `alg` is `sha-256`. `value` is the digest of the document's bytes, lower-case hex |
| `media_type` | The media type of the file, as registered with IANA |
| `document_type` | One of the types below |
| `statement` | What the member states about the document: one of the statements below |
| `document_date` | The date the document bears, ISO 8601 |
| `origin` | With `issued_by_subject`: the subject that issued the document. `null` otherwise |
| `signatories` | With `signed`: one entry per signatory. Empty otherwise |
| `timestamp` | An RFC 3161 time-stamp token over `digest.value`, from a time-stamping authority, with its name. `null` when absent |
| `status` | `active` or `revoked` |

## Statements

| `statement` | The member states |
|---|---|
| `issued` | It issued the document itself: a statement of an account it holds, a certificate it delivers |
| `issued_by_subject` | One of its subjects issued the document through it: an invoice, a payslip. `origin` says who |
| `signed` | Subjects it verified signed the document through it, at the times in `signatories` |
| `certified` | It checked the document against its source or its original, and the file is a faithful copy |

### `origin`

```json
"origin": { "subject_type": "legal_entity", "identifier": { "type": "lei", "value": "9845003F5A2C7D1B6E27" }, "kyb_level": "standard" }
```

- `identifier` is an identifier of the subject whose discoverability is `public`: a `lei`, `reg` or `tax` identifier of a legal entity, with its type ([PATH ID](/docs/id#identifiers)).
- `kyb_level` is the level the member attested for that subject ([PIP-0034](/pips/0034)).
- For a natural person, `origin` carries `subject_type` and `identity_level`, and no identifier.

### `signatories`

```json
"signatories": [
  { "identity_level": "3", "signed_at": "2026-11-12T15:20:00Z" },
  { "identity_level": "4", "signed_at": "2026-11-12T15:41:00Z" }
]
```

A signatory carries the level at which the member verified it and the time it signed. Never a name or an identifier. The signatures themselves, when the format of the document carries them, are in the document.

## Document types

The list is closed. A later PIP adds to it.

| `document_type` | Document |
|---|---|
| `account_statement` | A statement of an account |
| `invoice` | An invoice |
| `payslip` | A payslip |
| `proof_of_address` | A document that states an address |
| `tax_notice` | A notice of a tax authority |
| `company_extract` | An extract of a company register |
| `contract` | A contract |
| `certificate` | A certificate the member delivers: of account, of balance, of payment |

An identity document is not a document attestation. Its verification is an attestation of [PIP-0034](/pips/0034).

## Verification

A verifier holds the file, and the attestation or its link.

1. Computes the SHA-256 of the file's bytes.
2. Reads the attestation at `/path/<reference>` and completes the chain of trust of [PATH INTEROP](/docs/interop), or looks it up by digest at the issuer.
3. Verifies the signature against the issuer's own `/.well-known/path-keys`.
4. Compares its digest with `digest.value`. A difference means the file is not the document attested.
5. Checks `status`. When `timestamp` is present, verifies the token against the authority's certificate.

- The digest covers the bytes. A file converted, re-saved, compressed, printed or scanned is another file and does not verify.
- An issuer that prints the link in the document chooses the reference first, then computes the digest of the final file.
- Verification needs no credential and sends nothing to the issuer but the reference or the digest.

## Rules

- The document is never sent to the operator. `POST /documents` takes the digest; the member computes it in its own systems.
- No network-wide index of digests exists. A lookup is asked of the issuer named on the document or by the person.
- A lookup by digest answers the attestation, or `404 path.core.not_found`. A digest the issuer never attested and a digest it does not disclose answer the same.
- The object carries no name, no account and no clear identifier of a natural person.
- A digest is attested at most once by one issuer. A second `POST /documents` with the same digest answers the first attestation.

## Revocation

The issuer revokes an attestation when the document is withdrawn or replaced. A revoked attestation answers `410 path.document.revoked`. `detail.replaced` says whether a new document replaces it, and never names it.

```json
{
  "error": {
    "code": "path.document.revoked",
    "message": "This document attestation has been revoked",
    "detail": { "replaced": true },
    "request_id": "req_4c81e0"
  }
}
```

## Interface

| Call | Credential | Effect |
|---|---|---|
| `POST /documents` | Local member | Attests a digest: `{ digest, media_type, document_type, statement, document_date, subject_id, signatories }`. Answers the signed attestation |
| `POST /documents/lookup` | None | `{ "digest": { "alg": "sha-256", "value": "…" } }`. Answers the attestation, or `404` |
| `GET /path/{reference}` | None | The attestation |
| `POST /documents/{reference}/revoke` | Local member | `{ replaced }`. Revokes it |

The digest travels in the body, never in a URL. The writes take `Path-Idempotency-Key` ([PIP-0022](/pips/0022)). The discovery document gains `endpoints.documents`, and `path.document` in `capabilities.interop_types`.

| Code | Status | `detail` | What the caller does |
|---|---|---|---|
| `path.document.revoked` | 410 | `{ "replaced": true }` | Ask the person for the current document |
| `path.document.revoked` | 410 | `{ "replaced": false }` | Do not rely on the document |

## Conformance

| Profile | Requires |
|---|---|
| `PATH-ID.Documents` | Attestations of digests only, never of files received; the statements and types above; `origin` and `signatories` without names; lookups by digest in the body, with one answer for every negative; `detail.replaced` on revocation |

## Compatibility

Additive. A new object type, new calls and one code. A reader that does not know `path.document` shows the upgrade prompt of PATH INTEROP.