Overview
Unykorn Legal is the world's first Web3 legal namespace platform. It combines Stellar-anchored legal identity namespaces (.law, .legal, .ai, .x402), x402 payment rails on Apostle Chain 7332, AI-powered case analysis, and JusticeChain evidence anchoring into a unified platform for legal professionals and their clients.
Unykorn Legal is built on three open protocols:
- Stellar Mainnet — Namespace ownership records, identity anchoring
- Apostle Chain 7332 — x402 payment settlement, subscription billing, JusticeChain evidence hashes
- ULegal AI — Legal case analysis engine trained on millions of public court filings, statutes, and legal precedents
Quickstart
Get your .law namespace registered and receive your first x402 payment in under 5 minutes.
1. Install the SDK
2. Initialize the Client
3. Register Your Namespace
4. Accept x402 Payments
Authentication
The Unykorn Legal API uses API key authentication for server-side calls and Stellar keypair signing for namespace operations.
| Method | Use Case |
|---|---|
Authorization: Bearer ulegal_... | All REST API calls |
| Stellar Ed25519 signature | Namespace registration & transfers |
| Apostle Chain agent key | x402 payment signing |
Namespace System
Unykorn Legal namespaces are Stellar Mainnet records that establish a legal identity on the Web3 layer. A namespace like smith.law is a payment address, a signing identity, a verified credential anchor, and an x402 endpoint — all in one.
Namespace Format
Namespace Properties
| Property | Type | Description |
|---|---|---|
name | string | The label portion before the TLD |
tld | string | .law | .legal | .ai | .x402 |
owner | StellarPublicKey | Stellar address owning this namespace |
apostleAgent | UUID | Linked Apostle Chain agent for x402 receipt |
registered | ISO 8601 | Registration timestamp |
expires | ISO 8601 | Expiry date (annual renewal required) |
stellarHash | 64-char hex | Stellar ledger transaction hash |
Stellar Registration
Namespaces are registered on Stellar Mainnet using a manage_data operation. The data key is ulegal:{tld}:{name} and the value is a JSON metadata payload signed by the owner's keypair.
TLD Reference
| TLD | Purpose | Annual Price | Min. Length |
|---|---|---|---|
.law | Licensed attorney identity | 49 ATP | 3 chars |
.legal | Law firms and legal entities | 39 ATP | 3 chars |
.ai | AI legal tools and assistants | 59 ATP | 2 chars |
.x402 | x402 payment-only endpoints | 29 ATP | 3 chars |
x402 Integration
x402 is the AI-to-AI payment protocol on Apostle Chain 7332. For legal applications, it enables instant ATP payments for consultations, case reviews, document services, and monthly subscriptions — with no payment processor, no chargebacks, and on-chain receipts.
How x402 Works
- Client sends ATP to a namespace address (e.g., smith.law)
- Apostle Chain nodes route the payment to the attorney's agent ID
- A receipt is generated at
POST /v1/txwithtype: "transfer" - Both parties get a signed receipt hash they can reference in any dispute
Payment Flows
One-Time Consultation Payment
amount fields must be sent as strings in JSON (not numbers). JavaScript's JSON.stringify loses precision on large integers. Use "15000000000000000000" not 15000000000000000000.Subscription Billing
Monthly subscriptions are managed by smart contract on Apostle Chain. The contract auto-debits the client's agent balance on the renewal date and emits a SUBSCRIPTION_RENEWED event you can listen to via webhook.
Case Review API
The AI Case Review API accepts a case type and facts, and returns a structured legal analysis including: key issues, strengths, weaknesses, document requirements, and a strategy checklist.
| Endpoint | Method | Description |
|---|---|---|
/v1/review/analyze | POST | Run full case analysis |
/v1/review/{id} | GET | Retrieve stored review |
/v1/review/{id}/anchor | POST | Anchor review to JusticeChain |
/v1/review/types | GET | List available case types |
Request: Analyze a Case
Response
Evidence Anchoring
JusticeChain anchoring commits the SHA-256 hash of any document or case review to Apostle Chain 7332. The block timestamp becomes an immutable proof of when you possessed that information.
AI Assistant
The ULegal AI Assistant is a context-aware legal assistant trained on U.S. federal and state statutes, regulations, and public court opinions. It can answer legal research questions, explain statutes, and provide procedural guidance.
sessionId to maintain context across calls.REST API Reference
Base URL
Rate Limits
| Plan | Requests / min | AI Reviews / month |
|---|---|---|
| Starter (Free) | 30 | 3 |
| Attorney Pro | 120 | Unlimited |
| Law Firm | 500 | Unlimited |
| Enterprise | Custom | Unlimited |
Error Codes
| Code | Meaning |
|---|---|
401 | Missing or invalid API key |
402 | Payment required (x402 — insufficient ATP balance) |
403 | Feature not available on current plan |
422 | Invalid request body (see error.details) |
429 | Rate limit exceeded |
503 | JusticeChain or Apostle Chain node unavailable |
Webhooks
Register a HTTPS webhook URL to receive real-time events from Unykorn Legal.
JavaScript SDK
Key Modules
client.namespaces— Register, transfer, resolve, list namespacesclient.x402— Create invoices, watch payments, subscription managementclient.review— Run AI case analysis, anchor to JusticeChainclient.justice— Direct JusticeChain anchoring and verificationclient.ai— Chat sessions with ULegal AI assistantclient.partners— Browse attorneys, initiate x402 connection requests
Python SDK
Smart Contract Templates
Unykorn Legal provides Apostle Chain smart contract templates for common legal engagements. Templates are deployed by the attorney and customized per-engagement.
| Template | Use Case | Fee |
|---|---|---|
RetainerAgreement | Attorney retainer with monthly ATP billing | 1 ATP to deploy |
ContingencyFee | Personal injury — auto-disburse on settlement | 1 ATP to deploy |
EscrowDispute | Neutral escrow for disputed payments | 0.5 ATP |
NDAEnforcement | NDA + breach penalty smart contract | 1 ATP to deploy |
EstateTrust | Programmable trust distribution schedule | 2 ATP to deploy |
Need Help?
Our developer team is available via Discord, email, and on-chain support ticket (50 ATP response SLA).