À quoi sert la ressource « Leads & Opportunités » ?
Pistes commerciales : qualification BANT, scoring, provenance UTM, conversion en client et en devis
Quels endpoints sont disponibles ?
| Méthode | Adresse | Action |
|---|---|---|
| GET | /api/v1/leads et /{id} | lire (liste paginée ou un élément par identifiant) |
| POST | /api/v1/leads | créer un élément |
| PUT | /api/v1/leads/{id} | remplacer un élément |
| PATCH | /api/v1/leads/{id} | modifier certains champs |
| DELETE | /api/v1/leads/{id} | supprimer un élément |
Quels champs contient la ressource « Leads & Opportunités » ?
| Champ | Type et description |
|---|---|
| quoteId | string — devis né du lead |
| quoteNumber | string |
| anonymizedAt | ISO8601 — anonymisation RGPD de la piste (champ RÉEL, relu par components/CRMModule.tsx, absent de l’interface Lead) |
| campaignId | string — campagne marketing (attribution) |
| id | string |
| tenantId | string |
| company | string |
| value | number |
| status | string |
| probability | number |
| contactName | string — CHIFFRÉ au repos (services/cryptoService.ts) mais DÉCHIFFRÉ par db.getAll : servi EN CLAIR |
| source | string |
| score | number |
| string — CHIFFRÉ au repos (services/cryptoService.ts) mais DÉCHIFFRÉ par db.getAll : servi EN CLAIR | |
| phone | string — CHIFFRÉ au repos (services/cryptoService.ts) mais DÉCHIFFRÉ par db.getAll : servi EN CLAIR |
| industry | string |
| customFields | Record<string, any> |
| website | string |
| linkedinPage | string |
| employeeCount | number |
| revenueRange | string |
| address | string — CHIFFRÉ au repos (services/cryptoService.ts) mais DÉCHIFFRÉ par db.getAll : servi EN CLAIR |
| city | string |
| postalCode | string |
| country | string |
| jobTitle | string |
| decisionMaker | string |
| budget | number |
| timeline | string |
| painPoints | string |
| needDescription | string |
| territory | string |
| expectedCloseDate | string |
| lastTouchpointDate | string |
| nextActionDate | string |
| nextActionType | string |
| accountManagerId | string |
| salesStage | string |
| interactionsCount | number |
| demoDate | string |
| utmSource | string |
| utmMedium | string |
| utmCampaign | string |
| leadRatingScale | string |
| marketingOptIn | boolean |
| acquisitionChannel | string |
| opportunityType | string |
| dealComplexityLevel | string |
| contractType | string |
| salesMethodology | string |
| competitor | string |
| competitionLevel | string |
| winReason | string |
| lostReason | string |
| siret | string |
| vatNumber | string |
| legalStatus | string |
| gdprConsent | boolean |
| gdprConsentWithdrawnAt | ISO8601 — date du RETRAIT du consentement (art. 7 §3), sans elle, une case décochée ne prouve rien : un consentement jamais donné et un consentement retiré seraient indistinguables |
| gdprConsentWithdrawnSource | string — origine du retrait (lien public en un clic, saisie en fiche, propagation depuis le registre unique services/consentLedgerService.ts) |
| ndaSigned | boolean |
| ndaSignedDate | string |
| paymentTerms | string |
| creditLimit | number |
| billingFrequency | string |
| currency | string |
| currentSoftware | string |
| erpInUse | string |
| infrastructure | string |
| apiRequired | boolean |
| expectedUserCount | number |
| expectedGoLiveDate | string |
| primaryLanguage | string |
| supportLevel | string |
| bantBudgetScore | number |
| bantAuthorityScore | number |
| bantNeedScore | number |
| bantTimelineScore | number |
| technicalFitScore | number |
| competitorWeaknesses | string |
| competitorStrengths | string |
| strategicImportance | string |
| referralPartner | string |
| partnerCommission | number |
| documentUrls | { name: string, url: string, size?: number }[] |
| convertedToClientId | string — fiche tiers créée à la conversion |
| projectId | string |
| createdAt | string |
| updatedAt | string |
| kanbanOrder | number — rang dans la colonne du kanban |
Comment filtrer, trier et paginer ?
Exemple de lecture filtrée et triée : GET /api/v1/leads?filter[quoteId]=…&sort=quoteNumber:desc&limit=50.
Le filtre est une égalité stricte sur un champ déclaré, le tri s’écrit champ:asc ou champ:desc, la page contient 50 éléments par défaut et 200 au plus, un champ inconnu renvoie une erreur 400 plutôt qu’un résultat faux.
Quelles autorisations faut-il ?
- Une offre qui inclut l’API publique : Enterprise.
- Une clé d’API créée dans Système › Intégrations, envoyée dans l’en-tête Authorization: Bearer, limitée au dossier qui l’a émise.
- Une portée accordée à la clé pour cette ressource : lecture, écriture et suppression.