# @integraledger/lcp/discovery

> The discovery document of LCP §2, served at `/.well-known/legal-context.json`: `parse` reads one, and `emit` writes one.

Source: https://lcp.integraledger.com/reference/api/discovery

Updated 2026-11-18. Documents @integraledger/lcp 0.6.3 and @integraledger/profile-facilitator 0.5.1. Every page of this site is listed in https://lcp.integraledger.com/llms.txt.

The discovery document of LCP §2, served at `/.well-known/legal-context.json`: `parse` reads one, and `emit` writes
one.

`emit` writes the members in the order of LCP §2.4–§2.5's tables, absent members omitted, no whitespace, UTF-8. Both
check the members LCP §2.4–§2.5 define, with these bounds: each string member non-empty, `terms` an https URL, at
most 65,536 bytes, and JSON nested at most 64 levels. Neither throws or does I/O.

## Interfaces

### LegalContextDocument

LCP §2.4–§2.5; members in the order of their tables.

#### Properties

| Property | Type | Description |
| ------ | ------ | ------ |
| <a id="property-acceptancerequired"></a> `acceptanceRequired?` | `boolean` | - |
| <a id="property-api"></a> `api?` | `string` | - |
| <a id="property-atrhash"></a> `atrHash?` | `` `0x${string}` `` | The digest of the document at `terms` (LCP §2.5). |
| <a id="property-contact"></a> `contact?` | `object` | - |
| `contact.legal?` | `string` | - |
| `contact.technical?` | `string` | - |
| <a id="property-disputeresolution"></a> `disputeResolution?` | `object` | - |
| `disputeResolution.catalog?` | `string` | - |
| `disputeResolution.clauseId?` | `string` | - |
| `disputeResolution.contact?` | `string` | - |
| `disputeResolution.jurisdiction?` | `string` | - |
| `disputeResolution.method?` | `string` | - |
| `disputeResolution.source?` | `string` | - |
| <a id="property-returns"></a> `returns?` | `string` | - |
| <a id="property-terms"></a> `terms` | `string` | Absolute https URL of the terms document. |
| <a id="property-termsformat"></a> `termsFormat?` | `string` | - |

## Variables

### MAX\_DOCUMENT\_BYTES

> `const` **MAX\_DOCUMENT\_BYTES**: `65536` = `65_536`

The largest discovery document `parse` reads and `emit` writes, in bytes.

***

### WELL\_KNOWN\_PATH

> `const` **WELL\_KNOWN\_PATH**: `"/.well-known/legal-context.json"` = `"/.well-known/legal-context.json"`

The path at which the discovery document is served (LCP §2).

## Functions

### emit()

> **emit**(`document`): `Uint8Array`\<`ArrayBuffer`\> \| [`Refusal`](https://lcp.integraledger.com/reference/api.md#refusal)

The document's bytes: its checked members in table order, `atrHash` in lowercase, and no other member.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `document` | [`LegalContextDocument`](#legalcontextdocument) |

#### Returns

`Uint8Array`\<`ArrayBuffer`\> \| [`Refusal`](https://lcp.integraledger.com/reference/api.md#refusal)

***

### parse()

> **parse**(`bytes`): [`Refusal`](https://lcp.integraledger.com/reference/api.md#refusal) \| \{ `document`: [`LegalContextDocument`](#legalcontextdocument); `ignored`: `string`[]; \}

One UTF-8 JSON object of at most `MAX_DOCUMENT_BYTES`, nested at most 64 levels, with the members LCP §2.4–§2.5
define checked: each string member non-empty and `terms` an https URL. Unknown members, at the top level or inside
`disputeResolution` and `contact`, are left out of `document` and named in `ignored` by dotted path.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `bytes` | `Uint8Array` |

#### Returns

[`Refusal`](https://lcp.integraledger.com/reference/api.md#refusal) \| \{ `document`: [`LegalContextDocument`](#legalcontextdocument); `ignored`: `string`[]; \}
