> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jurat.io/llms.txt
> Use this file to discover all available pages before exploring further.

# API Quickstart

> Create and track a Jurat recovery case with direct REST API calls.

Base URL:

```txt theme={null}
https://api.jurat.io/api/v1
```

The API is versioned under `/api/v1`. Recovery and estate endpoints use wallet signatures to prove user intent.

For server-side integrations, issue credentials from the developer dashboard and send them with API requests:

```http theme={null}
x-api-key: sk_...
x-api-secret: ss_...
```

Do not expose API secrets in browser code.

## 1. Build A Recovery Intent

```ts theme={null}
const intent = {
  rec: {
    lostAccount: "0xLostSmartAccount",
    recoveryAccount: "0xRecoveryWallet",
    chainId: 8453,
    reasonForRecovery: "lost key",
    email: "user@example.com",
  },
  txs: [
    {
      dest: "0xTokenContract",
      value: "0",
      data: "0xEncodedCallData",
    },
  ],
};
```

`txs` are the exact transactions Jurat should execute if the court order is verified.

## 2. Calculate The JRC Hash

```ts theme={null}
const response = await fetch("https://api.jurat.io/api/v1/recovery-cases/jrc-hash", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(intent),
});

const { jrcHash } = await response.json();
```

The returned `jrcHash` is the Jurat Legal Code hash the user includes in the legal filing.

## 3. Check For An Existing Case

```ts theme={null}
const response = await fetch("https://api.jurat.io/api/v1/recovery-cases/exists", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(intent),
});

const duplicate = await response.json();
```

Example response:

```json theme={null}
{
  "caseExists": true,
  "caseId": "case-uuid",
  "jrcHash": "0x..."
}
```

## 4. Create A Recovery Case

The recovery wallet signs the canonical EIP-712 recovery intent. Until the SDK is published, reproduce the typed-data shape in [Signing](/signing) exactly.

```ts theme={null}
const signedIntent = {
  case: intent.rec,
  transactions: intent.txs,
  signature: "0xRecoveryWalletSignature",
};

const response = await fetch("https://api.jurat.io/api/v1/recovery-cases/new-case", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": process.env.JURAT_API_KEY!,
    "x-api-secret": process.env.JURAT_API_SECRET!,
  },
  body: JSON.stringify(signedIntent),
});

const created = await response.json();
```

Example response:

```json theme={null}
{
  "caseId": "case-uuid",
  "jrcHash": "0x..."
}
```

## 5. Submit Court Metadata

After the court order exists, the recovery wallet signs the court metadata.

```ts theme={null}
const payload = {
  courtInfo: {
    title: "Order granting recovery",
    fullCaseNumber: "1:26-cv-00001",
    courtId: "California Northern District Court",
    docketNumber: 42,
  },
  signature: "0xRecoveryWalletSignature",
};

await fetch(`https://api.jurat.io/api/v1/recovery-cases/${created.jrcHash}/court-order`, {
  method: "PATCH",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(payload),
});
```

## 6. Track Status

```ts theme={null}
const response = await fetch(`https://api.jurat.io/api/v1/recovery-cases/${created.caseId}`);
const detail = await response.json();
```

Statuses:

* `initiated`: case created, court metadata not yet submitted.
* `pending`: court metadata submitted and awaiting verification.
* `rejected`: recovery rejected.
* `executed`: recovery verified and executed on-chain.

## Dashboard And Credentials

Create and revoke developer API keys from:

```txt theme={null}
https://app.jurat.io/developers
```

Each developer account can have up to five active API keys. The API secret is returned only when a key is created.
