{"openapi":"3.0.3","info":{"title":"Courtigo API","version":"2.0.0","description":"API REST Courtigo pour applications externes."},"servers":[{"url":"https://apps.courtigo.fr/api/v2"}],"paths":{"/me":{"get":{"summary":"Retourne le contexte authentifie","tags":["System"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[]}},"/users":{"get":{"summary":"Liste les utilisateurs de la societe","tags":["Directory"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"agency_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"active","in":"query","required":false,"schema":{"type":"boolean"}}],"x-courtigo-scopes":["directory:read"]}},"/users/{id}":{"get":{"summary":"Recupere un utilisateur de la societe","tags":["Directory"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["directory:read"]}},"/agencies":{"get":{"summary":"Liste les agences de la societe","tags":["Directory"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["directory:read"]}},"/agencies/{id}":{"get":{"summary":"Recupere une agence","tags":["Directory"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["directory:read"]}},"/referentials/contract-types":{"get":{"summary":"Liste les types de contrats","tags":["Referentials"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["referentials:read"]}},"/referentials/companies":{"get":{"summary":"Liste les compagnies","tags":["Referentials"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["referentials:read"]}},"/referentials/statuses":{"get":{"summary":"Liste les statuts utiles aux automations","tags":["Referentials"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"resource","in":"query","required":false,"schema":{"type":"string","enum":["client","contract","contrat","task","ticket","support_ticket","project","projet","custom_project","custom","all"]}}],"x-courtigo-scopes":["referentials:read"]}},"/referentials/ticket-categories":{"get":{"summary":"Liste les categories ticket","tags":["Referentials"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"x-courtigo-scopes":["referentials:read"]}},"/clients":{"get":{"summary":"Liste les fiches client accessibles","tags":["Clients"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"email","in":"query","required":false,"schema":{"type":"string"}},{"name":"ref_client","in":"query","required":false,"schema":{"type":"string"}},{"name":"nom","in":"query","required":false,"schema":{"type":"string"}},{"name":"prenom","in":"query","required":false,"schema":{"type":"string"}},{"name":"raison_sociale","in":"query","required":false,"schema":{"type":"string"}},{"name":"telephone","in":"query","required":false,"schema":{"type":"string"}},{"name":"mobile","in":"query","required":false,"schema":{"type":"string"}},{"name":"siren","in":"query","required":false,"schema":{"type":"string"}},{"name":"siret","in":"query","required":false,"schema":{"type":"string"}},{"name":"code_postal","in":"query","required":false,"schema":{"type":"string"}},{"name":"ville","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["clients:read"]},"post":{"summary":"Cree une fiche client","tags":["Clients"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientInput"}}}},"x-courtigo-scopes":["clients:write"]}},"/clients/warehouse":{"get":{"summary":"Liste les lignes clients consolidees pour warehouse","tags":["Clients","Warehouse"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"boolean"}}],"x-courtigo-scopes":["clients:read"]}},"/clients/warehouse/export":{"get":{"summary":"Exporte les lignes clients consolidees en JSON ou CSV","tags":["Clients","Warehouse"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","csv"]}}],"x-courtigo-scopes":["clients:read"]}},"/clients/{id}":{"get":{"summary":"Recupere une fiche client","tags":["Clients"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["clients:read"]},"patch":{"summary":"Met a jour une fiche client","tags":["Clients"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientInput"}}}},"x-courtigo-scopes":["clients:write"]},"put":{"summary":"Remplace les champs fournis sur une fiche client","tags":["Clients"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientInput"}}}},"x-courtigo-scopes":["clients:write"]},"delete":{"summary":"Supprime ou archive une fiche client","tags":["Clients"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["clients:delete"]}},"/clients/{id}/360":{"get":{"summary":"Retourne une vue client 360 avec contrats, projets, tags, taches, historique et documents","tags":["Clients"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"x-courtigo-scopes":["clients:read"]}},"/clients/{id}/warehouse":{"get":{"summary":"Retourne une ligne client consolidee pour warehouse avec contrats, commissions, frais et equipements","tags":["Clients","Warehouse"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"schema":{"type":"boolean"}}],"x-courtigo-scopes":["clients:read"]}},"/clients/{id}/equipment":{"get":{"summary":"Retourne les equipements d une fiche client par type","tags":["Clients","Equipment"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["auto","moto","habitation","animaux","sante","decennale","dommage_ouvrage"]}},{"name":"expand","in":"query","required":false,"schema":{"type":"boolean"}}],"x-courtigo-scopes":["clients:read"]}},"/clients/{id}/equipment/export":{"get":{"summary":"Exporte les equipements d une fiche client en JSON ou CSV","tags":["Clients","Equipment"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["auto","moto","habitation","animaux","sante","decennale","dommage_ouvrage"]}},{"name":"expand","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","csv"]}}],"x-courtigo-scopes":["clients:read"]}},"/clients/{id}/commissions":{"get":{"summary":"Retourne les commissions d une fiche client par contrat","tags":["Clients","Commissions"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["clients:read"]}},"/clients/{id}/commissions/export":{"get":{"summary":"Exporte les commissions d une fiche client en JSON ou CSV","tags":["Clients","Commissions"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","csv"]}}],"x-courtigo-scopes":["clients:read"]}},"/tags":{"get":{"summary":"Liste les tags clients disponibles","tags":["Tags"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["clients:read"]}},"/clients/{id}/tags":{"get":{"summary":"Liste les tags rattaches a une fiche client","tags":["Tags"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["clients:read"]},"post":{"summary":"Ajoute un tag a une fiche client","tags":["Tags"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagAttachInput"}}}},"x-courtigo-scopes":["clients:write"]}},"/clients/{id}/tags/{tag_id}":{"delete":{"summary":"Retire un tag d une fiche client","tags":["Tags"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"tag_id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["clients:write"]}},"/contracts":{"get":{"summary":"Liste les contrats accessibles","tags":["Contracts"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"client_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["contracts:read"]},"post":{"summary":"Cree un contrat","tags":["Contracts"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractInput"}}}},"x-courtigo-scopes":["contracts:write"]}},"/contracts/{id}":{"get":{"summary":"Recupere un contrat","tags":["Contracts"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["contracts:read"]},"patch":{"summary":"Met a jour un contrat","tags":["Contracts"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractInput"}}}},"x-courtigo-scopes":["contracts:write"]},"put":{"summary":"Remplace les champs fournis sur un contrat","tags":["Contracts"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractInput"}}}},"x-courtigo-scopes":["contracts:write"]},"delete":{"summary":"Supprime ou archive un contrat","tags":["Contracts"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["contracts:delete"]}},"/contracts/{id}/commission":{"get":{"summary":"Retourne la commission d un contrat","tags":["Contracts","Commissions"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["contracts:read"]}},"/contracts/{id}/commission/export":{"get":{"summary":"Exporte la commission d un contrat en JSON ou CSV","tags":["Contracts","Commissions"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","csv"]}}],"x-courtigo-scopes":["contracts:read"]}},"/clients/{id}/contracts":{"get":{"summary":"Liste les contrats d une fiche client","tags":["Contracts"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["contracts:read"]}},"/projects":{"get":{"summary":"Liste les projets accessibles","tags":["Projects"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"client_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"type_projet","in":"query","required":false,"schema":{"type":"string"}},{"name":"id_etat","in":"query","required":false,"schema":{"type":"integer"}},{"name":"status","in":"query","required":false,"schema":{"type":"integer"}},{"name":"is_transform","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"is_controle_doc","in":"query","required":false,"schema":{"type":"boolean"}}],"x-courtigo-scopes":["projects:read"]}},"/projects/{id}":{"get":{"summary":"Recupere un projet","tags":["Projects"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["projects:read"]}},"/clients/{id}/projects":{"get":{"summary":"Liste les projets d une fiche client","tags":["Projects"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"type_projet","in":"query","required":false,"schema":{"type":"string"}},{"name":"id_etat","in":"query","required":false,"schema":{"type":"integer"}},{"name":"status","in":"query","required":false,"schema":{"type":"integer"}}],"x-courtigo-scopes":["projects:read"]}},"/clients/{id}/documents":{"get":{"summary":"Liste les documents d une fiche client","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["documents:read"]},"post":{"summary":"Depose un document sur une fiche client","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUploadInput"}}}},"x-courtigo-scopes":["documents:write"]}},"/document-templates":{"get":{"summary":"Liste les modeles de documents publipostage disponibles","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"query","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["documents:read"]}},"/email-templates":{"get":{"summary":"Liste les modeles email disponibles","tags":["Communications"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"query","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["communications:write"]}},"/documents/generate":{"post":{"summary":"Genere un document depuis un modele et le depose en GED","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentGenerationInput"}}}},"x-courtigo-scopes":["documents:write"]}},"/documents/generate-email":{"post":{"summary":"Genere un document GED puis l envoie par email","tags":["Documents","Communications"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeneratedDocumentEmailInput"}}}},"x-courtigo-scopes":["documents:write","communications:write"]}},"/documents/{id}/send-email":{"post":{"summary":"Envoie un document GED existant par email","tags":["Documents","Communications"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExistingDocumentEmailInput"}}}},"x-courtigo-scopes":["documents:read","communications:write"]}},"/contracts/{id}/documents":{"get":{"summary":"Liste les documents d un contrat","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["documents:read"]},"post":{"summary":"Depose un document sur un contrat","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUploadInput"}}}},"x-courtigo-scopes":["documents:write"]}},"/documents/{id}":{"get":{"summary":"Recupere les metadonnees d un document","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["documents:read"]}},"/documents/{id}/download":{"get":{"summary":"Genere un lien de telechargement document","tags":["Documents"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["documents:read"]}},"/clients/{id}/history":{"get":{"summary":"Liste l historique/timeline d une fiche client","tags":["History"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["history:read"]},"post":{"summary":"Ajoute une note d historique sur une fiche client","tags":["History"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HistoryInput"}}}},"x-courtigo-scopes":["history:write"]}},"/tasks":{"get":{"summary":"Liste les taches accessibles","tags":["Tasks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"client_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"assigned_to","in":"query","required":false,"schema":{"type":"integer"}},{"name":"status","in":"query","required":false,"schema":{"type":"integer"}},{"name":"due_before","in":"query","required":false,"schema":{"type":"string"}},{"name":"due_after","in":"query","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}}],"x-courtigo-scopes":["tasks:read"]},"post":{"summary":"Cree une tache","tags":["Tasks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"x-courtigo-scopes":["tasks:write"]}},"/tasks/{id}":{"get":{"summary":"Recupere une tache","tags":["Tasks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["tasks:read"]},"patch":{"summary":"Met a jour une tache","tags":["Tasks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"x-courtigo-scopes":["tasks:write"]},"delete":{"summary":"Supprime ou archive une tache","tags":["Tasks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["tasks:delete"]}},"/clients/{id}/tasks":{"get":{"summary":"Liste les taches d une fiche client","tags":["Tasks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["tasks:read"]},"post":{"summary":"Cree une tache sur une fiche client","tags":["Tasks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"x-courtigo-scopes":["tasks:write"]}},"/clients/{id}/emails":{"post":{"summary":"Envoie un email client et trace l historique","tags":["Communications"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailInput"}}}},"x-courtigo-scopes":["communications:write"]}},"/clients/{id}/sms":{"post":{"summary":"Envoie un SMS client et trace l historique","tags":["Communications"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmsInput"}}}},"x-courtigo-scopes":["communications:write"]}},"/webhooks":{"get":{"summary":"Liste les webhooks API v2","tags":["Webhooks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"x-courtigo-scopes":["webhooks:read"]},"post":{"summary":"Cree un webhook API v2","tags":["Webhooks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}},"x-courtigo-scopes":["webhooks:write"]}},"/webhooks/{id}":{"get":{"summary":"Recupere un webhook API v2","tags":["Webhooks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["webhooks:read"]},"patch":{"summary":"Met a jour un webhook API v2","tags":["Webhooks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}},"x-courtigo-scopes":["webhooks:write"]},"delete":{"summary":"Supprime un webhook API v2","tags":["Webhooks"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["webhooks:delete"]}},"/imports/clients":{"post":{"summary":"Importe un lot de fiches clients","tags":["Imports"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientImportInput"}}}},"x-courtigo-scopes":["imports:write"]}},"/imports/contracts":{"post":{"summary":"Importe un lot de contrats","tags":["Imports"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractImportInput"}}}},"x-courtigo-scopes":["imports:write"]}},"/jobs":{"get":{"summary":"Liste les jobs API v2","tags":["Jobs"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"x-courtigo-scopes":["jobs:read"]}},"/jobs/{id}":{"get":{"summary":"Recupere un job API v2","tags":["Jobs"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"x-courtigo-scopes":["jobs:read"]}},"/mcp":{"post":{"summary":"Endpoint MCP JSON-RPC Courtigo","description":"Endpoint MCP pour initialiser une session, lister les outils, appeler un outil, lire les ressources et utiliser les prompts.","tags":["MCP"],"security":[{"bearerAuth":[]},{"xAuthUser":[]},{"xApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpJsonRpcRequest"}}}},"responses":{"200":{"description":"Reponse JSON-RPC MCP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpJsonRpcResponse"}}}},"204":{"description":"Notification JSON-RPC acceptee"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"x-courtigo-mcp-methods":["initialize","tools/list","tools/call","resources/list","resources/templates/list","resources/read","prompts/list","prompts/get","ping"]}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"xAuthUser":{"type":"apiKey","in":"header","name":"X-Auth-User"},"xApiKey":{"type":"apiKey","in":"header","name":"X-API-Key"}},"responses":{"BadRequest":{"description":"Requete invalide"},"Unauthorized":{"description":"Cle API manquante ou invalide"},"Forbidden":{"description":"Acces refuse"},"NotFound":{"description":"Ressource introuvable"}},"schemas":{"ApiResponse":{"type":"object","properties":{"data":{"nullable":true},"meta":{"type":"object"},"errors":{"type":"array","items":{"type":"object"}}}},"ClientInput":{"type":"object","properties":{"nom":{"type":"string"},"prenom":{"type":"string"},"raison_sociale":{"type":"string"},"email":{"type":"string"},"mobile":{"type":"string"},"telephone":{"type":"string"},"adresse":{"type":"string"},"code_postal":{"type":"string"},"ville":{"type":"string"},"siren":{"type":"string"},"siret":{"type":"string"}}},"ClientWarehouseSummary":{"type":"object","properties":{"contracts":{"type":"object","properties":{"count":{"type":"integer"},"active_count":{"type":"integer"},"prime_ht_total":{"type":"string"},"prime_ttc_total":{"type":"string"},"commission_an_pct_total":{"type":"string"},"commission_ra_pct_total":{"type":"string"},"commission_estimated_total":{"type":"string"},"frais_total":{"type":"string"}}},"equipment":{"type":"object","properties":{"auto_count":{"type":"integer"},"moto_count":{"type":"integer"},"habitation_count":{"type":"integer"},"animaux_count":{"type":"integer"},"sante_count":{"type":"integer"},"decennale_count":{"type":"integer"},"dommage_ouvrage_count":{"type":"integer"}}},"history":{"type":"integer"},"latest_updated_at":{"type":"string","nullable":true}}},"ClientWarehouseRow":{"type":"object","properties":{"client":{"type":"object"},"client_details":{"type":"object"},"summary":{"$ref":"#/components/schemas/ClientWarehouseSummary"},"contracts":{"type":"array","items":{"type":"object"}},"equipment":{"type":"object"},"history":{"type":"array","items":{"type":"object"}},"projects":{"type":"array","items":{"type":"object"}},"generated_at":{"type":"string"}}},"ClientEquipmentCollection":{"type":"object","properties":{"client":{"type":"object"},"summary":{"type":"object"},"equipment":{"type":"object"},"equipment_type":{"type":"string"},"items":{"type":"array","items":{"type":"object"}},"count":{"type":"integer"},"generated_at":{"type":"string"}}},"ClientCommissionCollection":{"type":"object","properties":{"client":{"type":"object"},"summary":{"type":"object"},"items":{"type":"array","items":{"type":"object"}},"generated_at":{"type":"string"}}},"ContractCommissionCollection":{"type":"object","properties":{"contract":{"type":"object"},"commission":{"type":"object"},"generated_at":{"type":"string"}}},"ContractInput":{"type":"object","properties":{"id_client":{"type":"integer"},"type_contrat":{"type":"string"},"ref_dossier":{"type":"string","description":"Référence affichée sur la fiche contrat."},"reference_contrat":{"type":"string","description":"Alias de ref_dossier sur le schéma standard, renvoyé aussi en lecture et dans /360. Si les deux champs sont fournis, leurs valeurs doivent être identiques ; sinon la requête est refusée (400 conflicting_contract_reference)."},"id_compagnie":{"type":"integer","minimum":1,"nullable":true,"description":"Identifiant renvoyé par GET /referentials/companies pour une compagnie active du cabinet. Renvoyé en lecture. Peut remplacer compagnie ; si les deux sont fournis, ils doivent correspondre. null sans nom retire le rattachement."},"compagnie":{"type":"string","description":"Libellé exact et unique parmi les compagnies actives du cabinet. Le rattachement est résolu automatiquement, y compris dans /imports/contracts. Nom inconnu, ambigu ou incohérent avec id_compagnie : 400 invalid_company."},"produit":{"type":"string"},"date_effet":{"type":"string","format":"date"},"date_echeance":{"type":"string","format":"date"},"prime_annuelle_ht":{"type":"number"},"prime_annuelle_ttc":{"type":"number"},"prime_annuelles":{"type":"array","description":"Primes annuelles a enregistrer dans users_index_contrat_prime_annuelles.","items":{"type":"object","properties":{"year":{"type":"integer"},"prime_ht":{"type":"number"},"prime_ttc":{"type":"number"}}}},"commission_courtier_an":{"type":"number","description":"Commission courtier premiere annee en pourcentage. Mappe vers users_index_contrat.com_an_comp."},"commission_courtier_recurrente":{"type":"number","description":"Commission courtier recurrente en pourcentage. Mappe vers users_index_contrat.com_ra_comp."},"frais_gestion":{"type":"number","description":"Frais de gestion/courtage du contrat. Mappe vers users_index_contrat.frais."}}},"HistoryInput":{"type":"object","properties":{"titre":{"type":"string"},"content":{"type":"string"},"id_contrat":{"type":"integer"}}},"TaskInput":{"type":"object","properties":{"titre":{"type":"string"},"content":{"type":"string"},"id_client":{"type":"integer"},"id_contrat":{"type":"integer"},"assigned_to":{"type":"integer"},"due_at":{"type":"string"},"urgence":{"type":"string"},"statut_tache":{"type":"integer"}}},"DocumentUploadInput":{"type":"object","properties":{"filename":{"type":"string"},"content_base64":{"type":"string"},"is_client":{"type":"boolean"}}},"DocumentGenerationInput":{"type":"object","properties":{"document_template_id":{"type":"integer"},"target_type":{"type":"string","enum":["client","contrat","projet","sinistre"]},"target_id":{"type":"integer"},"id_client":{"type":"integer"},"id_contrat":{"type":"integer"},"id_project":{"type":"integer"},"id_sinistre":{"type":"integer"},"label":{"type":"string"}}},"GeneratedDocumentEmailInput":{"type":"object","properties":{"document_template_id":{"type":"integer"},"email_template_id":{"type":"integer"},"target_type":{"type":"string","enum":["client","contrat","projet","sinistre"]},"target_id":{"type":"integer"},"id_client":{"type":"integer"},"id_contrat":{"type":"integer"},"id_project":{"type":"integer"},"id_sinistre":{"type":"integer"},"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"},"cc":{"type":"string"},"bcc":{"type":"string"}}},"ExistingDocumentEmailInput":{"type":"object","properties":{"email_template_id":{"type":"integer"},"id_client":{"type":"integer"},"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"},"cc":{"type":"string"},"bcc":{"type":"string"}}},"TagAttachInput":{"type":"object","properties":{"id_tag":{"type":"integer"},"tag_id":{"type":"integer"},"tag":{"type":"string"},"libelle":{"type":"string"},"color":{"type":"string"},"create_missing":{"type":"boolean"}}},"EmailInput":{"type":"object","properties":{"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"},"cc":{"type":"string"},"bcc":{"type":"string"},"attachments":{"type":"array","maxItems":10,"items":{"$ref":"#/components/schemas/EmailAttachmentInput"}}}},"EmailAttachmentInput":{"type":"object","required":["name","content"],"properties":{"name":{"type":"string","maxLength":255},"content":{"type":"string","format":"byte","description":"Contenu du fichier encode en Base64 (4 Mo maximum apres decodage)."}}},"SmsInput":{"type":"object","properties":{"to":{"type":"string"},"message":{"type":"string"},"sender":{"type":"string"}}},"WebhookInput":{"type":"object","properties":{"target_url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"}}},"ClientImportInput":{"type":"object","properties":{"clients":{"type":"array","items":{"$ref":"#/components/schemas/ClientInput"}}}},"ContractImportInput":{"type":"object","properties":{"contracts":{"type":"array","items":{"$ref":"#/components/schemas/ContractInput"}}}},"McpJsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","example":"2.0"},"id":{"nullable":true},"method":{"type":"string","example":"tools/list"},"params":{"type":"object"}},"required":["jsonrpc","method"]},"McpJsonRpcResponse":{"type":"object","properties":{"jsonrpc":{"type":"string","example":"2.0"},"id":{"nullable":true},"result":{"nullable":true},"error":{"nullable":true}}}}}}