Intégrez SmartLawyer
dans votre application.
API REST et protocole MCP. Accédez à 1 million d'arrêts, au Legal Graph et aux 128 000 articles de loi depuis Python, Node.js ou n'importe quel client HTTP.
Votre première requête
en moins de 2 minutes.
Obtenez votre clé API, lancez une recherche, récupérez une fiche. Tout est REST — aucune dépendance requise.
sk-sl-curl -X POST https://smartlawyer.ai/api/search \
-H "X-API-Key: sk-sl-votre-cle" \
-H "Content-Type: application/json" \
-d '{"query": "clause de non-concurrence faute grave", "limit": 5}'
curl https://smartlawyer.ai/api/fiche/22-18.295 \
-H "X-API-Key: sk-sl-votre-cle"
Trois méthodes
d'authentification.
Passez votre clé API via header, query param ou Bearer token. La priorité est dans cet ordre.
# 1. Header X-API-Key (recommandé)
curl -H "X-API-Key: sk-sl-votre-cle" ...
# 2. Query parameter (Claude.ai custom connector)
https://mcp.smartlawyer.ai/mcp?api_key=sk-sl-votre-cle
# 3. Bearer token (OAuth)
curl -H "Authorization: Bearer sk-sl-votre-cle" ...
Intégration MCP
avec Python.
Utilisez le SDK MCP officiel pour connecter SmartLawyer à votre agent Python. Compatible LangChain, LlamaIndex, smolagents et tout framework utilisant MCP.
pip install mcp
import asyncio
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
MCP_URL = "https://mcp.smartlawyer.ai/mcp?api_key=sk-sl-votre-cle"
async def main():
async with streamablehttp_client(MCP_URL) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
# Lister les 13 tools disponibles
tools = await session.list_tools()
for tool in tools.tools:
print(f"- {tool.name}: {tool.description[:60]}...")
asyncio.run(main())
async def recherche_jurisprudence(session, query: str):
result = await session.call_tool(
"search_jurisprudences",
arguments={{
"query": query,
"domaine": "droit social",
"limit": 10,
"include_graph": True,
}}
)
import json
data = json.loads(result.content[0].text)
for arr in data.get("results", []):
print(f"[{{arr['score']:.2f}}] {{arr['number']}} — {{arr.get('probleme_droit', '')[:80]}}")
async def verifier_validite(session, numero: str):
result = await session.call_tool(
"superseded_chain",
arguments={{"identifier": numero}}
)
import json
data = json.loads(result.content[0].text)
if data["is_valid"]:
print(f"✓ Arrêt {{numero}} toujours valide")
else:
print(f"✗ Renversé — chaîne: {{len(data.get('chain', []))}} arrêts")
for step in data.get("chain", []):
print(f" → {{step['number']}} ({{step['date'][:10]}})")
Intégration MCP
avec Node.js.
Utilisez le SDK MCP officiel TypeScript. Compatible avec tous les frameworks Node.js et les runtimes Deno / Bun.
npm install @modelcontextprotocol/sdk
import {{ Client }} from "@modelcontextprotocol/sdk/client/index.js";
import {{ StreamableHTTPClientTransport }} from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const API_KEY = "sk-sl-votre-cle";
const MCP_URL = `https://mcp.smartlawyer.ai/mcp?api_key=${{API_KEY}}`;
const client = new Client({{ name: "mon-app", version: "1.0.0" }});
const transport = new StreamableHTTPClientTransport(new URL(MCP_URL));
await client.connect(transport);
// Recherche sémantique
const result = await client.callTool({{
name: "search_jurisprudences",
arguments: {{
query: "responsabilité civile du notaire défaut de conseil",
domaine: "droit civil",
limit: 5,
}},
}});
const data = JSON.parse(result.content[0].text);
console.log(`${{data.total}} décisions trouvées`);
data.results.forEach(arr => {{
console.log(`[${{arr.score.toFixed(2)}}] ${{arr.number}} — ${{arr.probleme_droit?.slice(0, 80)}}`);
}});
await client.close();
const graphResult = await client.callTool({{
name: "get_legal_graph",
arguments: {{ identifier: "22-18.295" }},
}});
const graph = JSON.parse(graphResult.content[0].text);
console.log(`Arrêt valide: ${{graph.is_valid}}`);
console.log(`Citations reçues: ${{graph.cited_by_count}}`);
graph.qualified_citations?.forEach(c => {{
console.log(` → ${{c.type}}: ${{c.number}}`);
}});
Recherche sémantique
dans 1M+ décisions.
RRF sur 4 vecteurs + Cohere Rerank 4 Pro. Filtres domaine, solution, juridiction, chambre, période.
https://smartlawyer.ai/api/search
import httpx
resp = httpx.post(
"https://smartlawyer.ai/api/search",
headers={{"X-API-Key": "sk-sl-votre-cle"}},
json={{
"query": "licenciement faute grave préavis",
"domaine": "droit social",
"solution": "Cassation",
"date_from": "2020-01-01",
"limit": 10,
"include_graph": True,
}}
)
data = resp.json()
print(f"Total: {{data['total']}} décisions")
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| query | string | requis | Question en langage naturel |
| domaine | string | optionnel | Ex: "droit social", "droit civil", "droit pénal" |
| solution | string | optionnel | Ex: "Cassation", "Rejet", "Irrecevabilité" |
| date_from | string | optionnel | Format ISO: 2020-01-01 |
| date_to | string | optionnel | Format ISO: 2023-12-31 |
| include_graph | boolean | optionnel | Inclut le Legal Graph dans chaque résultat |
| limit | integer | optionnel | Max 20 (défaut: 10) |
Fiche complète
et navigation dans le graphe.
Récupérez une fiche par numéro de pourvoi, ECLI ou UUID. Naviguez dans le Legal Graph : citations reçues, lignée procédurale, revirements.
# Fiche complète
resp = httpx.get(
"https://smartlawyer.ai/api/fiche/22-18.295",
headers={{"X-API-Key": "sk-sl-votre-cle"}}
)
fiche = resp.json()
print(fiche["probleme_droit"]) # Question tranchée par la Cour
print(fiche["solution"]) # Cassation / Rejet / ...
print(fiche["is_valid"]) # True / False
# Vérifier si un arrêt a été renversé
resp = httpx.get(
"https://smartlawyer.ai/api/fiche/17-19.860/superseded",
headers={{"X-API-Key": "sk-sl-votre-cle"}}
)
chain = resp.json()
print(f"Valide: {{chain['is_valid']}}, chaîne: {{len(chain.get('chain', []))}} arrêts")
# Citations reçues (qui cite cet arrêt ?)
resp = httpx.get(
"https://smartlawyer.ai/api/fiche/16-22.224/cited-by?limit=20",
headers={{"X-API-Key": "sk-sl-votre-cle"}}
)
cited = resp.json()
print(f"Cité par {{cited['total']}} décisions, importance_score: {{cited['importance_score']}}")
// Node.js — fiche + Legal Graph
const headers = {{ "X-API-Key": "sk-sl-votre-cle" }};
const fiche = await fetch(
"https://smartlawyer.ai/api/fiche/22-18.295",
{{ headers }}
).then(r => r.json());
console.log(fiche.probleme_droit);
// Lignée procédurale complète
const lineage = await fetch(
"https://smartlawyer.ai/api/fiche/22-18.295/lineage",
{{ headers }}
).then(r => r.json());
lineage.steps?.forEach(step => {{
console.log(`${{step.stage}}: ${{step.juridiction}} (${{step.date?.slice(0,10)}})`);
}});
128 000+ articles
de tous les codes français.
Recherche sémantique ou accès direct par code et numéro. Texte intégral en vigueur avec métadonnées Légifrance.
# Recherche sémantique d'articles
resp = httpx.post(
"https://smartlawyer.ai/api/articles/search",
headers={{"X-API-Key": "sk-sl-votre-cle"}},
json={{
"query": "obligation de sécurité employeur accident travail",
"code": "Code du travail",
"limit": 5,
}}
)
articles = resp.json()
for art in articles.get("results", []):
print(f"{{art['code']}} {{art['numero']}}: {{art['titre']}}")
# Accès direct à un article
resp = httpx.get(
"https://smartlawyer.ai/api/article?code=Code+du+travail&article=L1235-3",
headers={{"X-API-Key": "sk-sl-votre-cle"}}
)
article = resp.json()
print(article["texte"]) # Texte intégral en vigueur
# Toutes les décisions citant un article
resp = httpx.post(
"https://smartlawyer.ai/api/search-by-article",
headers={{"X-API-Key": "sk-sl-votre-cle"}},
json={{"code": "travail", "article": "L1235-3", "limit": 20}}
)
print(f"{{resp.json()['total']}} décisions citent L1235-3")
Réponses d'erreur
et comment les gérer.
Toutes les erreurs retournent un JSON avec un champ error.
| Code HTTP | Signification | Solution |
|---|---|---|
| 401 | Clé API manquante | Ajoutez le header X-API-Key |
| 403 | Clé API invalide ou expirée | Régénérez votre clé sur smartlawyer.ai/settings |
| 404 | Arrêt ou article non trouvé | Vérifiez le numéro de pourvoi ou l'ECLI |
| 422 | Paramètre invalide | Vérifiez les valeurs avec get_filters_tool |
| 429 | Quota dépassé | Attendez ou passez à un abonnement supérieur |
| 500 | Erreur serveur | Réessayez ou contactez contact@smartlawyer.ai |
import httpx
try:
resp = httpx.get(
"https://smartlawyer.ai/api/fiche/NUMERO-INVALIDE",
headers={{"X-API-Key": "sk-sl-votre-cle"}}
)
resp.raise_for_status()
data = resp.json()
except httpx.HTTPStatusError as e:
print(f"Erreur {{e.response.status_code}}: {{e.response.json().get('detail')}}")
Limites d'utilisation
par niveau d'accès.
Les quotas s'appliquent par clé API et se réinitialisent quotidiennement.
| Niveau | Recherches / jour | Résultats max | MCP |
|---|---|---|---|
| Sans compte | 3 | 10 | — |
| Compte gratuit | 5 | 10 | — |
| Abonné (4,99 €/mois) | Illimité | 20 | ✓ |