# Transparency log

The public, append-only log of ledger checkpoints.

Related guide: [Transparency log](https://provenanceauth.com/docs/concepts/transparency-log.md)

## Endpoints

- `GET /.well-known/provenance-log`: [Get the transparency log](#get-well-known-provenance-log)
- `GET /v1/log/inclusion`: [Prove log inclusion](#get-v1-log-inclusion)

## Get the transparency log

`GET /.well-known/provenance-log`

Returns the signed checkpoint history, the log's Merkle root and consistency proofs between checkpoints. Public, with no key, and cacheable.

Auth: an API key is optional.

### Parameters

No parameters.

### Returns

The checkpoints, the log's root and the consistency proofs.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
curl "$PROVENANCE_API/.well-known/provenance-log"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/.well-known/provenance-log`)).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/.well-known/provenance-log").json()
```

### Response 200

```json
{
  "environment": "sandbox",
  "log_root": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "checkpoints": [],
  "consistency": []
}
```

## Prove log inclusion

`GET /v1/log/inclusion`

Returns a Merkle proof that your account's ledger head is in the latest checkpoint, with the checkpoint's signed token.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The checkpoint and your account's inclusion proof.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/log/inclusion" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/log/inclusion`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/log/inclusion", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "log_inclusion",
  "root": "9c4e1f7a2b8d03e6c5a9f14b7d2e8c06a3f5b9d1e7c24a8f6b0d3e9c1a5f7b2d",
  "tree_size": 412,
  "account_hash": "5d2a8e1c7f3b9046e2c8a5f1d7b3e9c04a6f2d8b1e5c9a3f7d0b4e8c2a6f1d9b",
  "chain_head": "b8a3ee276f62cb80f3802594e2be103f99994cdc26c29de5faecad627bed7a0d",
  "leaf_index": 87,
  "proof": [
    "1f6c9a3e7d2b8f04c5a1e9d3b7f2c8a06e4d1b9f5c3a7e2d8b0f6c4a1e9d3b7f",
    "e2b7d4a9c1f6083b5e9a2d7c4f1b8e06a3d9c5f2b7e1a4d8c0f3b6e9a2d5c7f1"
  ],
  "signed_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtY2hlY2twb2ludCtqd3QifQ.eyJyb290Ijoi…"
}
```
