← Présentation API Agents

Documentation API Agents

Authentifiez vos outils avec une clé d’organisation (lc_live_…), créée par un admin dans Réglages → API Agents (plan Pilote).

Authentification

curl -sS -H "Authorization: Bearer $LC_API_KEY" \
  "https://locataire.live/api/v1/me"

Endpoints REST

  • GET /api/v1/me
  • GET /api/v1/properties, GET /api/v1/properties/{id}
  • GET /api/v1/leases, GET /api/v1/leases/{id}
  • GET /api/v1/tenants, GET /api/v1/tenants/{id}
  • GET /api/v1/payments, GET /api/v1/payments/overdue
  • POST /api/v1/payments/{id}/mark-paid
  • GET|POST /api/v1/incidents, GET /api/v1/incidents/{id}
  • GET /api/v1/applications, GET /api/v1/applications/{id}
  • GET /api/v1/visits, GET /api/v1/visits/{id}
  • GET /api/v1/artisans, GET /api/v1/artisans/{id}
  • GET /api/v1/move-in-outs, GET /api/v1/move-in-outs/{id}

Schéma OpenAPI : /api/v1/openapi

MCP (agents)

Transport Streamable HTTP (protocole MCP 2025-03-26) sur /api/v1/mcp — mêmes clés Bearer. Compatible connecteurs Custom Claude (Customize → Connectors → Add custom connector, header Authorization: Bearer lc_live_…). Le flux SSE GET (keep-alive) est supporté pour la conformité transport ; les outils passent par POST (initialize, tools/list, tools/call).

curl -sS -H "Authorization: Bearer $LC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
  "https://locataire.live/api/v1/mcp"

Connecter un agent (MCP)

Copiez la configuration pour Cursor, Claude Code, Codex ou un connecteur Custom Claude / ChatGPT. Plan Pilote requis. Doc : /developers.

Fichier `.cursor/mcp.json` à la racine du projet (ou Settings → MCP).

{
  "mcpServers": {
    "locatairecloud": {
      "url": "https://locataire.live/api/v1/mcp",
      "headers": {
        "Authorization": "Bearer lc_live_VOTRE_CLE"
      }
    }
  }
}

Remplacez lc_live_VOTRE_CLE par la clé affichée après création (visible une seule fois).

Couverture MCP (30 outils)
  • get_me
  • list_properties
  • get_property
  • list_leases
  • get_lease
  • list_tenants
  • get_tenant
  • list_payments
  • list_overdue_payments
  • mark_payment_paid
  • list_incidents
  • get_incident
  • create_incident
  • list_applications
  • get_application
  • list_visits
  • get_visit
  • list_artisans
  • get_artisan
  • list_move_in_outs
  • get_move_in_out
  • send_payment_reminder
  • generate_receipt
  • update_application_status
  • schedule_visit
  • assign_artisan_to_incident
  • create_lease_draft
  • send_lease_for_signing
  • create_move_in_out
  • invite_move_in_out_tenant

Pas encore via l’agent :

  • Webhooks sortants (config via REST /api/v1/webhooks)

Scopes

  • org:readOrganisation (lecture)
  • properties:readBiens (lecture)
  • leases:readBaux (lecture)
  • tenants:readLocataires (lecture)
  • payments:readPaiements (lecture)
  • payments:writePaiements (écriture minimale)
  • incidents:readIncidents (lecture)
  • incidents:writeIncidents (création)
  • applications:readCandidatures (lecture)
  • visits:readVisites candidats (lecture)
  • artisans:readArtisans (lecture)
  • move_in_outs:readÉtats des lieux (lecture)
  • applications:writeCandidatures (décision / présélection)
  • visits:writeVisites candidats (planification)
  • leases:writeBaux (brouillon et envoi signature)
  • move_in_outs:writeÉtats des lieux (création et invitation)
  • webhooks:writeWebhooks sortants (configuration)

Limites & sécurité

  • Rate limit : 60 requêtes / minute / clé (configurable côté serveur).
  • Quota journalier par organisation (défaut 10 000, fuseau Europe/Paris) — réponse 429 quota_exceeded.
  • Allowlist IP optionnelle par clé (Réglages → API Agents) — sinon toutes les IPs.
  • Durée de validité à la création (1 h, 1 j, 1 sem., 1 mois, 1 an ; défaut 1 jour). Une clé expirée est refusée comme une clé révoquée.
  • Writes (POST) : header optionnel Idempotency-Key (max 128) pour rejouer la même réponse sans double effet. Rejeu → header Idempotency-Replayed: true.
  • Connecteur ChatGPT installable : OAuth 2.1 sur /.well-known/oauth-protected-resource (plan Pilote). Les clés API restent disponibles pour scripts et IDE.
  • Webhooks sortants : POST /api/v1/webhooks (scope webhooks:write).
curl -sS -X POST \
  -H "Authorization: Bearer $LC_API_KEY" \
  -H "Idempotency-Key: mark-paid-$(date +%F)-PAYMENT_UUID" \
  -H "Content-Type: application/json" \
  "https://locataire.live/api/v1/payments/PAYMENT_UUID/mark-paid"