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

# NFT Minting

> Anchor product records on-chain with ERC-721 tokens.

SQR can mint an ERC-721 NFT for any record, anchoring its provenance on-chain. Tokens are minted on **Ethereum Sepolia** (testnet).

## Lifecycle

```
unclaimed → mint → minted → claim → claimed
```

1. **Create** a record (status: `unclaimed`)
2. **Mint** an NFT — the server wallet pays gas and receives the token
3. **Claim** — transfer the NFT to an end-user's wallet address

## Mint a record

```bash theme={null}
curl -X POST https://yys-sqr-render-bsbe.onrender.com/api/records/SQR-A1B2C/mint \
  -H "Authorization: Bearer $SQR_KEY"
```

```json theme={null}
{
  "success": true,
  "tx_hash": "0xabc123...",
  "token_id": 42,
  "etherscan_url": "https://sepolia.etherscan.io/tx/0xabc123...",
  "card": { "..." }
}
```

The record's `claim_status` changes to `minted`.

<Note>
  Minting requires the server to have Web3 configured (ETH private key and contract address). If Web3 is not set up, you'll get a 503 response.
</Note>

## Claim (transfer) the NFT

After minting, transfer the token to a wallet:

```bash theme={null}
curl -X POST https://yys-sqr-render-bsbe.onrender.com/api/records/SQR-A1B2C/claim \
  -H "Authorization: Bearer $SQR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"wallet_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18"}'
```

```json theme={null}
{
  "success": true,
  "tx_hash": "0xdef456...",
  "etherscan_url": "https://sepolia.etherscan.io/tx/0xdef456...",
  "card": { "..." }
}
```

The record's `claim_status` changes to `claimed` and `claimed_by` is set to the wallet address.

## Via the dashboard

You can also mint and claim from the record detail page in the [Dashboard](https://yys-sqr-render-bsbe.onrender.com/dashboard). Click **Mint NFT** on any unclaimed record.

## Viewing on Etherscan

After minting, the `etherscan_url` in the response links directly to the transaction on Sepolia Etherscan. You can verify the token ID, owner, and transaction details there.
