{"openapi":"3.0.0","info":{"title":"Invoicing.plus — API publique v1","description":"API de facturation et de gestion commerciale Invoicing.plus.\n\n## Premiers appels\n1. Appeler `POST /token` avec les identifiants d'un compte existant.\n2. Copier `data.token` dans **Authorize**. Il s'agit d'un token personnel.\n3. Appeler `GET /companies` et conserver le `data[].id` de la société souhaitée.\n4. Transmettre cet identifiant dans le header `X-Company` de chaque appel métier.\n\nPour créer une société, appeler `POST /company` avec le token du futur propriétaire, sans `X-Company`. Utiliser ensuite le `data.id` reçu pour créer un administrateur avec `POST /company/user`.\n\n## Requêtes et réponses\nEnvoyer `Accept: application/json` et, pour les corps JSON, `Content-Type: application/json`. Les propriétés non prévues sont rejetées par les endpoints utilisant la validation stricte. Les succès JSON sont généralement enveloppés dans `data`. Les exemples utilisent des identifiants fictifs à remplacer par ceux de votre société.\n\nLes codes dépendent de l'opération : `200` succès, `201` création, `401` token ou contexte société invalide, `403` droits insuffisants, `404` ressource introuvable, `422` validation et `429` quota dépassé.\n\n## Rate limiting\nQuota standard : **240 requêtes par minute**, partagé entre les routes et les sociétés pour un même utilisateur authentifié. Sans authentification, le quota est calculé par adresse IP. Consulter `X-RateLimit-Limit` et `X-RateLimit-Remaining` plutôt que de coder le quota en dur. En cas de `429`, attendre le délai `Retry-After` (secondes) ; `X-RateLimit-Reset` indique la fin de fenêtre en timestamp Unix.\n\n## Authentification et droits\nUn token représente un utilisateur et ses droits existants ; il ne donne pas automatiquement accès à toutes les sociétés. Le contrôle de `X-Company` et les autorisations sont appliqués côté serveur. `short_token: true` crée un token valable 30 minutes ; sinon aucun délai propre au token n'est ajouté par cette route (une expiration globale peut s'appliquer). Révoquer le token courant avec `POST /revoke-token`. Conserver les tokens et mots de passe côté serveur et utiliser HTTPS.","version":"1.0"},"servers":[{"url":"https://api.invoicing.plus/v1"}],"paths":{"/token":{"post":{"tags":["02 · Authentification"],"summary":"Obtenir un token personnel","operationId":"post.token","requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["email","password"],"properties":{"email":{"description":"Adresse email d'un utilisateur connu","type":"string","format":"email","example":"camille@example.com"},"password":{"description":"Mot de passe de l'utilisateur","type":"string","format":"password","writeOnly":true,"example":"le_mot_de_passe_cest_pas_ca"},"short_token":{"description":"true : expiration après 30 minutes ; false : aucun délai propre au token ajouté ici.","type":"boolean","default":false,"example":false}},"type":"object"}}}},"responses":{"422":{"$ref":"#/components/responses/PublicValidation"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Token émis","content":{"application/json":{"schema":{"properties":{"data":{"properties":{"type":{"type":"string","example":"Bearer"},"token":{"type":"string","example":"TOKEN_FICTIF_A_REMPLACER"}},"type":"object"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}}}},"/who-i-am":{"get":{"tags":["02 · Authentification"],"summary":"Afficher l’utilisateur connecté","operationId":"get.who","responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicUser"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/revoke-token":{"post":{"tags":["02 · Authentification"],"summary":"Supprimer le token courant","operationId":"post.revoke-token","responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/check":{"get":{"tags":["01 · Disponibilité"],"summary":"Un simple appel API pour se chauffer","operationId":"get.check","responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"503":{"description":"Service Unavailable"}}}},"/companies":{"get":{"tags":["03 · Sociétés et utilisateurs"],"summary":"Lister les sociétés accessibles et leurs identifiants X-Company","operationId":"get.companies","responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicCompany"}}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/company":{"get":{"tags":["03 · Sociétés et utilisateurs"],"summary":"Afficher les coordonnées de la société","operationId":"get.company","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCompany"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]},"post":{"tags":["03 · Sociétés et utilisateurs"],"summary":"Créer une société pour l'utilisateur connecté","description":"Authentification requise, sans X-Company. Le créateur devient administrateur. Utiliser data.id de la réponse comme X-Company pour les appels suivants. La création initialise les paramètres et le logo de la société.","operationId":"post.company","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCompanyCreate"}}}},"responses":{"201":{"description":"Société créée","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCompany"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"422":{"$ref":"#/components/responses/PublicValidation"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/company/user":{"post":{"tags":["03 · Sociétés et utilisateurs"],"summary":"Créer un administrateur dans la société sélectionnée","description":"Réservé aux administrateurs de la société. Crée un nouveau compte avec le rôle admin et le rattache à la société indiquée par X-Company. La réponse historique est HTTP 200. Aucun token n'est retourné ; utiliser POST /token pour connecter ce nouvel utilisateur.","operationId":"post.company.user","parameters":[{"name":"X-Company","in":"header","description":"data.id obtenu via GET /companies ou POST /company.","required":true,"schema":{"type":"string","example":"societe_demo"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCompanyUserCreate"}}}},"responses":{"200":{"description":"Administrateur créé et rattaché","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicUser"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"422":{"$ref":"#/components/responses/PublicValidation"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/contacts":{"get":{"tags":["05 · Contacts"],"summary":"Obtenir la liste des contacts de la société.","operationId":"get.contacts","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/contact/{id}":{"get":{"tags":["05 · Contacts"],"summary":"Afficher les coordonnées du contact.","operationId":"get.contact","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"put":{"tags":["05 · Contacts"],"summary":"Modifier un contact","operationId":"put.contact","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"name":{"type":"string","example":"ALPHAMATIC","nullable":true},"firstname":{"type":"string","nullable":true},"lastname":{"type":"string","nullable":true},"email":{"type":"string","example":"contact@alphamatic.com","nullable":true},"phone":{"type":"string","example":"0102030405","nullable":true},"phone2":{"nullable":true},"auto_recipient_email":{"type":"boolean","nullable":true}},"type":"object"}}}},"responses":{"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]}},"/contact":{"post":{"tags":["05 · Contacts"],"summary":"Créer un contact","operationId":"post.contact","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name"],"properties":{"name":{"type":"string","example":"Robin Cartoux"},"firstname":{"type":"string","example":"Robin","nullable":true},"lastname":{"type":"string","example":"Cartoux","nullable":true},"email":{"type":"string","example":"robin.cartoux@provider.com","nullable":true},"phone":{"type":"string","example":"0102030405","nullable":true},"phone2":{"nullable":true},"auto_recipient_email":{"type":"boolean","nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]}},"/contact/{id}/customer/{target}":{"post":{"tags":["05 · Contacts"],"summary":"Associer un contact à un client","operationId":"post.attach.customer","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"target","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["05 · Contacts"],"summary":"Dissocier un contact d'un client","operationId":"post.detach.customer","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"target","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]}},"/customers":{"get":{"tags":["04 · Clients"],"summary":"Obtenir la liste des clients de la société.","operationId":"get.customers","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","description":"Page demandée","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","description":"Nombre de résultats par page","schema":{"type":"integer","default":1000,"maximum":1000,"minimum":1}},{"name":"search","in":"query","description":"Recherche par nom ou référence du document","schema":{"type":"string","example":"Exemple"}},{"name":"status","in":"query","description":"Filtre de statut","schema":{"type":"string","enum":["active","inactive"]}}],"responses":{"422":{"$ref":"#/components/responses/PublicValidation"},"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicCustomer"}},"meta":{"properties":{"current_page":{"type":"integer","example":1},"last_page":{"type":"integer","example":1},"total":{"type":"integer","example":1},"has_more":{"type":"boolean","example":false}},"type":"object"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/customer/{id}":{"get":{"tags":["04 · Clients"],"summary":"Afficher les coordonnées du client.","operationId":"get.customer","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCustomer"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"put":{"tags":["04 · Clients"],"summary":"Modifier un client","operationId":"put.customer","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"name":{"type":"string","example":"ALPHAMATIC"},"company_name":{"type":"string","example":"SAS ALPHAMATIC"},"code":{"type":"string","example":"C0001","nullable":true},"sequence":{"type":"number","nullable":true},"account_code":{"type":"string","example":"411001","nullable":true},"email":{"type":"string","example":"contact@alphamatic.com","nullable":true},"phone":{"type":"string","example":"0102030405","nullable":true},"crn":{"type":"string","example":"123456789 ou 12345678900012","nullable":true},"nic":{"type":"string","example":"00012","nullable":true},"vat":{"type":"string","example":"FR62123456789","nullable":true},"naf":{"nullable":true},"billing_address_1":{"type":"string","example":"Chemin du loup","nullable":true},"billing_address_2":{"type":"string","example":"BP 234","nullable":true},"billing_zip":{"type":"string","example":"69480","nullable":true},"billing_city":{"type":"string","example":"Lucenay","nullable":true},"billing_country_id":{"type":"integer","nullable":true},"billing_country":{"type":"string","nullable":true},"is_web":{"type":"boolean","example":false,"nullable":true},"is_private_person":{"type":"boolean","nullable":true},"civility":{"type":"string","nullable":true},"activity":{"type":"string","nullable":true},"iban":{"type":"string","nullable":true},"bic":{"type":"string","nullable":true},"rum":{"type":"string","nullable":true},"rum_xml_type":{"type":"string","nullable":true},"rum_date":{"type":"string","format":"date","nullable":true},"notes":{"type":"string","nullable":true},"payment_method_id":{"type":"integer","nullable":true},"currency_id":{"type":"integer","nullable":true}},"type":"object"}}}},"responses":{"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCustomer"}},"type":"object"}}}},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["04 · Clients"],"summary":"Supprimer un client","operationId":"535c3f796f6108dbe95b8aac8eff35e4","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"string","example":"Deleted."}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/customer":{"post":{"tags":["04 · Clients"],"summary":"Créer un client","operationId":"post.customer","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name"],"properties":{"name":{"type":"string","example":"ALPHAMATIC"},"company_name":{"type":"string","example":"SAS ALPHAMATIC","nullable":true},"code":{"type":"string","example":"C0001","nullable":true},"sequence":{"type":"number","nullable":true},"account_code":{"type":"string","example":"411001","nullable":true},"email":{"type":"string","example":"contact@alphamatic.com","nullable":true},"phone":{"type":"string","example":"0102030405","nullable":true},"crn":{"type":"string","example":"123456789 ou 12345678900012","nullable":true},"nic":{"type":"string","example":"00012","nullable":true},"vat":{"type":"string","example":"FR62123456789","nullable":true},"naf":{"nullable":true},"billing_address_1":{"type":"string","example":"Chemin du loup","nullable":true},"billing_address_2":{"type":"string","example":"BP 234","nullable":true},"billing_zip":{"type":"string","example":"69480","nullable":true},"billing_city":{"type":"string","example":"Lucenay","nullable":true},"billing_country_id":{"type":"integer","nullable":true},"billing_country":{"type":"string","nullable":true},"is_web":{"type":"boolean","example":false,"nullable":true},"is_private_person":{"type":"boolean","nullable":true},"civility":{"type":"string","nullable":true},"activity":{"type":"string","nullable":true},"iban":{"nullable":true},"bic":{"nullable":true},"rum":{"type":"string","nullable":true},"rum_xml_type":{"type":"string","nullable":true},"rum_date":{"type":"string","format":"date","nullable":true},"notes":{"type":"string","nullable":true},"payment_method_id":{"type":"integer","nullable":true},"currency_id":{"type":"integer","nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCustomer"}},"type":"object"}}}},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]}},"/estimates":{"get":{"tags":["09 · Devis"],"summary":"Obtenir la liste de vos devis.","description":"Pour le suivi périodique, utiliser status=ALL et parcourir toutes les pages. from_date et to_date filtrent la date du document, pas celle de changement de statut.","operationId":"get.estimates","parameters":[{"name":"status","in":"query","description":"ALL : tous les statuts ; CURRENT : DRAFT, ACCEPTED, ORDERED, PARTIAL_INVOICED. Sans filtre, tous les statuts sont renvoyés.","schema":{"type":"string","enum":["CURRENT","ALL"]}},{"name":"search","in":"query","description":"Recherche dans le numéro de devis ou le nom du client.","schema":{"type":"string"}},{"name":"page","in":"query","description":"Page demandée.","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","description":"Nombre de documents par page.","schema":{"type":"integer","default":1000,"maximum":1000,"minimum":1}},{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"from_date","in":"query","description":"Filtrer les devis à partir de cette date (YYYY-MM-DD).","required":false,"schema":{"type":"string","format":"date"}},{"name":"to_date","in":"query","description":"Filtrer les devis jusqu'à cette date (YYYY-MM-DD).","required":false,"schema":{"type":"string","format":"date"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicEstimate"}},"meta":{"$ref":"#/components/schemas/PublicDocumentPagination"}},"type":"object"}}}},"429":{"$ref":"#/components/responses/PublicApiRateLimit"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/estimate/{id}":{"get":{"tags":["09 · Devis"],"summary":"Données d'un devis","operationId":"get.estimate","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicEstimateResponse"}}}},"429":{"$ref":"#/components/responses/PublicApiRateLimit"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]}},"/estimate":{"post":{"tags":["09 · Devis"],"summary":"Créer un devis","operationId":"post.estimate","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["customer_id","lines"],"properties":{"estimate_date":{"type":"string","format":"date","example":"2026-10-28","nullable":true},"expiry_date":{"type":"string","format":"date","example":"2026-11-28","nullable":true},"customer_id":{"type":"integer","example":1234},"title":{"nullable":true},"notes":{"nullable":true},"reference":{"nullable":true},"lines":{"type":"array","items":{"properties":{"is_title":{"type":"boolean","nullable":true},"item_id":{"description":"Condition : required_if:lines.*.is_title,false","type":"integer","example":123},"tax_type_id":{"type":"integer","nullable":true},"title":{"nullable":true},"is_ttc":{"nullable":true},"name":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"quantity":{"type":"number","example":2,"nullable":true},"unit":{"type":"string","nullable":true},"price":{"type":"number","nullable":true},"discount_type":{"type":"string","nullable":true},"discount":{"type":"number","nullable":true}},"type":"object"}}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/estimate/effortless":{"post":{"tags":["09 · Devis"],"summary":"Créer un devis (sans effort), le client est créé automatiquemet avec comme clé l'adresse email, les produits sont créés automatiquement avec comme clés les codes produits","operationId":"post.estimate.effortless","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["customer_email","customer","lines"],"properties":{"estimate_date":{"type":"string","format":"date","example":"2026-10-28","nullable":true},"expiry_date":{"type":"string","format":"date","example":"2026-11-28","nullable":true},"customer_email":{"type":"string","format":"email","example":"demo@example.com"},"customer":{"required":["name"],"properties":{"name":{"type":"string","example":"Atelier Exemple"},"company_name":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"account_code":{"type":"string","nullable":true},"phone":{"nullable":true},"crn":{"nullable":true},"vat":{"nullable":true},"billing_address_1":{"type":"string","nullable":true},"billing_address_2":{"type":"string","nullable":true},"billing_zip":{"type":"string","nullable":true},"billing_city":{"type":"string","nullable":true},"is_web":{"type":"boolean","nullable":true}},"type":"object"},"title":{"nullable":true},"notes":{"nullable":true},"reference":{"nullable":true},"lines":{"type":"array","items":{"properties":{"is_title":{"type":"boolean","nullable":true},"item_code":{"description":"Condition : required_if:lines.*.is_title,false","type":"string","example":"DEMO-001"},"tax_type_id":{"type":"integer","nullable":true},"tax_percent":{"type":"number","nullable":true},"title":{"nullable":true},"is_ttc":{"nullable":true},"name":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"quantity":{"type":"number","example":2,"nullable":true},"unit":{"type":"string","nullable":true},"price":{"type":"number","nullable":true},"discount_type":{"type":"string","nullable":true},"discount":{"type":"number","nullable":true},"item":{"properties":{"name":{"description":"Condition : required_if:lines.*.is_title,false","type":"string","example":"Conseil technique"},"description":{"nullable":true},"account_code":{"nullable":true},"tax_percent":{"type":"number","nullable":true},"price":{"nullable":true},"tax_type_id":{"type":"integer","nullable":true},"unit_id":{"type":"integer","nullable":true}},"type":"object"}},"type":"object"}}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/estimate/{id}/pdf":{"get":{"tags":["09 · Devis"],"summary":"Afficher le PDF d'un devis","operationId":"get.estimate.pdf","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"ID du devis à envoyer","required":true}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Ok","content":{"application/pdf":[]}},"404":{"$ref":"#/components/responses/PublicNotFound"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/invoices":{"get":{"tags":["12 · Factures"],"summary":"Obtenir la liste de vos factures.","description":"Chaque ligne de facture expose unit (unité enregistrée sur la ligne, nullable) et line_number (position à partir de 1, titres compris). line_number peut changer après modification du document et ne constitue pas un identifiant stable.","operationId":"get.invoices","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"from_date","in":"query","description":"Filtrer les factures à partir de cette date (YYYY-MM-DD).","required":false,"schema":{"type":"string","format":"date"}},{"name":"to_date","in":"query","description":"Filtrer les factures jusqu'à cette date (YYYY-MM-DD).","required":false,"schema":{"type":"string","format":"date"}},{"name":"page","in":"query","description":"Page demandée","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","description":"Nombre de résultats par page","schema":{"type":"integer","default":1000,"maximum":1000,"minimum":1}},{"name":"search","in":"query","description":"Recherche par nom ou référence du document","schema":{"type":"string","example":"Exemple"}},{"name":"status","in":"query","description":"Filtre de statut","schema":{"type":"string","enum":["DONE","DRAFT"]}}],"responses":{"422":{"$ref":"#/components/responses/PublicValidation"},"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicInvoice"}},"meta":{"properties":{"current_page":{"type":"integer","example":1},"last_page":{"type":"integer","example":1},"total":{"type":"integer","example":1},"has_more":{"type":"boolean","example":false}},"type":"object"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/invoice/{id}":{"get":{"tags":["12 · Factures"],"summary":"Données d'une facture","description":"Chaque ligne de facture expose unit (unité enregistrée sur la ligne, nullable) et line_number (position à partir de 1, titres compris). line_number peut changer après modification du document et ne constitue pas un identifiant stable.","operationId":"get.invoice","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicInvoice"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"put":{"tags":["12 · Factures"],"summary":"Modifier une facture brouillon","description":"Réservé aux factures DRAFT ; une facture validée renvoie 404. Sans lines, les lignes et montants enregistrés sont conservés. Si lines est fourni, toutes les lignes existantes sont remplacées et les montants recalculés. due_date est appliqué uniquement si invoice_set_due_date_automatically vaut YES. Les montants sont en unité monétaire.","operationId":"1c86b2c8197e1a64b6b11406f1266dee","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"invoice_date":{"type":"string","format":"date"},"due_date":{"type":"string","format":"date","example":"2026-11-28"},"customer_id":{"type":"integer"},"payment_method_id":{"type":"integer"},"title":{"type":"string"},"notes":{"type":"string"},"reference":{"type":"string"},"refund":{"type":"boolean"},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"currency_id":{"type":"integer"},"lines":{"type":"array","items":{"properties":{"is_title":{"type":"boolean"},"item_id":{"type":"integer"},"tax_type_id":{"type":"integer"},"title":{"type":"string"},"is_ttc":{"type":"boolean"},"name":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"number"},"unit":{"type":"string"},"price":{"type":"number"},"discount_type":{"type":"string"},"discount":{"type":"number"}},"type":"object"}}},"type":"object"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicInvoice"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["12 · Factures"],"summary":"Supprimer une facture brouillon","description":"La suppression effective est limitée aux brouillons. Une réponse 200 ne prouve pas la suppression d’une facture validée ; relire la ressource.","operationId":"1829f7d2ba6010c1275fdf53543eac61","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"string","example":"Deleted."}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/invoice":{"post":{"tags":["12 · Factures"],"summary":"Créer une facture","operationId":"post.invoice","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["customer_id","lines"],"properties":{"invoice_date":{"type":"string","format":"date","example":"2026-11-01","nullable":true},"due_date":{"type":"string","format":"date","example":"2026-11-30","nullable":true},"customer_id":{"type":"integer","example":1234},"related_customer_id":{"type":"integer","nullable":true},"payment_method_id":{"description":"Mode de paiement de la société sélectionnée.","type":"integer","example":3,"nullable":true},"title":{"type":"string","example":"Prestations octobre","nullable":true},"notes":{"type":"string","example":"Merci de votre confiance.","nullable":true},"reference":{"type":"string","example":"COMMANDE-42","nullable":true},"refund":{"type":"boolean","nullable":true},"period_start":{"type":"string","format":"date","nullable":true},"period_end":{"type":"string","format":"date","nullable":true},"lines":{"type":"array","items":{"properties":{"is_title":{"type":"boolean","nullable":true},"item_id":{"description":"Condition : required_if:lines.*.is_title,false","type":"integer","example":123},"tax_type_id":{"description":"TVA de la société sélectionnée.","type":"integer","example":12,"nullable":true},"title":{"description":"Texte pour une ligne de titre.","type":"string","nullable":true},"is_ttc":{"nullable":true},"name":{"type":"string","example":"Prestation de conseil","nullable":true},"description":{"type":"string","nullable":true},"quantity":{"type":"number","example":2,"nullable":true},"unit":{"type":"string","example":"heure","nullable":true},"price":{"description":"Prix unitaire en unité monétaire.","type":"number","example":75.5,"nullable":true},"discount_type":{"type":"string","nullable":true},"discount":{"type":"number","nullable":true},"group_key":{"type":"string","nullable":true}},"type":"object"}},"group_lines":{"type":"array","items":{"required":["key","name","quantity"],"properties":{"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"quantity":{"type":"number"},"unit":{"type":"string","nullable":true}},"type":"object"},"nullable":true},"currency_id":{"type":"integer","nullable":true},"invoice_type_id":{"type":"integer","nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicInvoice"}},"type":"object"}}}},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/invoice/effortless":{"post":{"tags":["12 · Factures"],"summary":"Créer une facture (sans effort), le client est créé automatiquemet avec comme clé l'adresse email, les produits sont créés automatiquement avec comme clés les codes produits","operationId":"post.invoice.effortless","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["customer_email","customer","lines"],"properties":{"invoice_date":{"type":"string","format":"date","example":"2026-11-01","nullable":true},"due_date":{"type":"string","format":"date","example":"2026-11-30","nullable":true},"customer_email":{"type":"string","format":"email","example":"demo@example.com"},"customer":{"required":["name"],"properties":{"name":{"type":"string","example":"Atelier Exemple"},"company_name":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"account_code":{"type":"string","nullable":true},"phone":{"nullable":true},"crn":{"nullable":true},"vat":{"nullable":true},"billing_address_1":{"type":"string","nullable":true},"billing_address_2":{"type":"string","nullable":true},"billing_zip":{"type":"string","nullable":true},"billing_city":{"type":"string","nullable":true},"is_web":{"type":"boolean","nullable":true}},"type":"object"},"title":{"nullable":true},"notes":{"nullable":true},"reference":{"nullable":true},"refund":{"type":"boolean","nullable":true},"period_start":{"type":"string","format":"date","nullable":true},"period_end":{"type":"string","format":"date","nullable":true},"lines":{"type":"array","items":{"properties":{"is_title":{"type":"boolean","nullable":true},"item_code":{"description":"Condition : required_if:lines.*.is_title,false","type":"string","example":"DEMO-001"},"tax_type_id":{"description":"Condition : required_if:lines.*.tax_type_id,false","type":"integer","nullable":true},"tax_percent":{"type":"number","nullable":true},"title":{"nullable":true},"is_ttc":{"nullable":true},"name":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"quantity":{"type":"number","example":2,"nullable":true},"unit":{"type":"string","nullable":true},"price":{"type":"number","nullable":true},"discount_type":{"type":"string","nullable":true},"discount":{"type":"number","nullable":true},"group_key":{"type":"string","nullable":true},"item":{"properties":{"name":{"description":"Condition : required_if:lines.*.is_title,false","type":"string","example":"Conseil technique"},"description":{"nullable":true},"account_code":{"nullable":true},"tax_percent":{"type":"number","nullable":true},"price":{"nullable":true},"tax_type_id":{"type":"integer","nullable":true},"unit_id":{"type":"integer","nullable":true}},"type":"object"}},"type":"object"}},"group_lines":{"type":"array","items":{"required":["key","name","quantity"],"properties":{"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"quantity":{"type":"number"},"unit":{"type":"string","nullable":true}},"type":"object"},"nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicInvoice"}},"type":"object"}}}},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/invoice/{id}/validation":{"post":{"tags":["12 · Factures"],"summary":"Valider une facture","operationId":"post.invoice.validation","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"ID de la facture à valider","required":true}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Ok"},"404":{"$ref":"#/components/responses/PublicNotFound"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/invoice/{id}/pdf":{"get":{"tags":["12 · Factures"],"summary":"Afficher le PDF d'une facture","operationId":"get.invoice.pdf","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"ID de la facture à envoyer","required":true}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Ok","content":{"application/pdf":[]}},"404":{"$ref":"#/components/responses/PublicNotFound"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/invoice/{id}/send":{"post":{"tags":["12 · Factures"],"summary":"Envoyer par email une facture","operationId":"post.invoice.send","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"ID de la facture à envoyer","required":true}],"requestBody":{"content":{"application/json":{"schema":{"required":["subject","from_name","from_email"],"properties":{"to":{"type":"string","example":"email@provider.com"},"subject":{"type":"string","example":"Votre facture"},"from_name":{"type":"string","example":"Alfred Gaston"},"from_email":{"type":"string","example":"demo@example.com"},"body":{"type":"string"},"cc":{"type":"string"},"bcc":{"type":"string"},"to_array":{"type":"array","items":{"required":["name","email"],"properties":{"name":{"type":"string"},"email":{"type":"string","format":"email"}},"type":"object"}}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Ok","content":{"application/json":{"schema":{"properties":{"data":{"properties":{"message":{"type":"string","example":"Queued."}},"type":"object"}},"type":"object"}}}},"404":{"$ref":"#/components/responses/PublicNotFound"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/items":{"get":{"tags":["06 · Produits et services"],"summary":"Obtenir la liste des produits de la société.","operationId":"get.items","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicItem"}}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/item/{id}":{"get":{"tags":["06 · Produits et services"],"summary":"Afficher les détails du produit","operationId":"get.item","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicItem"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"put":{"tags":["06 · Produits et services"],"summary":"Modifier un produit","operationId":"put.item","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"name":{"type":"string","example":"Ravioli","nullable":true},"description":{"type":"string","example":"Ravioli du mercredi","nullable":true},"code":{"type":"string","example":"P001","nullable":true},"account_code":{"type":"string","example":"706001","nullable":true},"price":{"type":"number","example":5.49,"nullable":true},"default_tax_id":{"type":"integer","example":1234,"nullable":true},"unit_id":{"type":"integer","example":1234,"nullable":true},"currency_id":{"type":"integer","nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicItem"}},"type":"object"}}}},"422":{"$ref":"#/components/responses/PublicValidation"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["06 · Produits et services"],"summary":"Supprimer un produit","operationId":"8d18231d60b55abf546fa6ef439f04d4","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"string","nullable":true}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/item":{"post":{"tags":["06 · Produits et services"],"summary":"Créer un produit","operationId":"post.item","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name"],"properties":{"name":{"type":"string","example":"Ravioli"},"description":{"type":"string","example":"Ravioli du mercredi","nullable":true},"code":{"type":"string","example":"P001","nullable":true},"account_code":{"type":"string","example":"706001","nullable":true},"price":{"type":"number","example":5.49,"nullable":true},"default_tax_id":{"type":"integer","example":1234,"nullable":true},"unit_id":{"type":"integer","example":1234,"nullable":true},"currency_id":{"type":"integer","nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicItem"}},"type":"object"}}}},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/pass-good-data":{"post":{"tags":["17 · Exemples et validation"],"summary":"Poster des données en JSON avec le bon type, un nombre c'est un nombre, une date c'est une date...","operationId":"post.pass-good-data","requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"customer_id":{"type":"integer","example":"123"},"invoice_date":{"type":"string","format":"date","example":"2026-10-28"},"name":{"type":"string","example":"Avignon"},"lines":{"description":"Lines","type":"array","items":{"properties":{"item_id":{"type":"integer","example":"54321"},"quantity":{"type":"number","example":"7.5"}},"type":"object"}}},"type":"object"}}}},"responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}}}},"/pass-bad-data":{"post":{"tags":["17 · Exemples et validation"],"summary":"Poster des données en JSON avec le mauvais type pour voir comment ça réagit","operationId":"post.pass-bad-data","requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"customer_id":{"type":"integer","example":"123"},"invoice_date":{"type":"string","format":"date","example":"lundi"},"name":{"type":"string","example":"Avignon"},"lines":{"description":"Lines","type":"array","items":{"properties":{"item_id":{"type":"integer","example":"54321.9"},"quantity":{"type":"number","example":"7.5"}},"type":"object"}}},"type":"object"}}}},"responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}}}},"/pass-unexpected-data":{"post":{"tags":["17 · Exemples et validation"],"summary":"Poster un JSON avec des propriétés non attendues","operationId":"post.pass-unexpected-data","requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"customer_id":{"type":"integer","example":"123"},"invoice_date":{"type":"string","format":"date","example":"2026-10-28"},"name":{"type":"string","example":"Avignon"},"city":{"type":"string","example":"Marseille"},"lines":{"description":"Lines","type":"array","items":{"properties":{"item_id":{"type":"integer"},"quantity":{"type":"number"},"tax_name":{"type":"string"}},"type":"object"},"example":[{"item_id":"54321","quantity":"7.5","tax_name":"TVA 20%"},{"item_id":"98760","quantity":"12","measure":"100cm","negative":"false"}]}},"type":"object"}}}},"responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}}}},"/pass-bad-json":{"post":{"tags":["17 · Exemples et validation"],"summary":"Poster un JSON cassé pour voir comment ça réagit (il faut enlever le double quote à la fin de titi)","operationId":"post.pass-bad-json","requestBody":{"required":true,"content":{"application/json":{"schema":[],"example":{"toto":"titi"}}}},"responses":{"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}}}},"/orders":{"get":{"tags":["10 · Commandes"],"summary":"Obtenir la liste des commandes.","description":"Par défaut, retourne les commandes DRAFT et PARTIAL_INVOICED. Pour le suivi périodique de tous les statuts, utiliser status=ALL et parcourir toutes les pages : une commande facturée disparaît de la liste CURRENT. Les filtres de dates portent sur la date du document, pas sur le changement de statut.","operationId":"get.orders","parameters":[{"name":"from_date","in":"query","description":"Date du document minimale incluse.","schema":{"type":"string","format":"date"}},{"name":"to_date","in":"query","description":"Date du document maximale incluse.","schema":{"type":"string","format":"date"}},{"name":"status","in":"query","description":"CURRENT : DRAFT et PARTIAL_INVOICED ; ALL : tous les statuts.","schema":{"type":"string","default":"CURRENT","enum":["CURRENT","ALL"]}},{"name":"search","in":"query","description":"Recherche dans le numéro de commande ou le nom du client.","schema":{"type":"string"}},{"name":"page","in":"query","description":"Page demandée.","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","description":"Nombre de documents par page.","schema":{"type":"integer","default":1000,"maximum":1000,"minimum":1}},{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicOrder"}},"meta":{"$ref":"#/components/schemas/PublicDocumentPagination"}},"type":"object"}}}},"429":{"$ref":"#/components/responses/PublicApiRateLimit"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/order/{id}":{"get":{"tags":["10 · Commandes"],"summary":"Données d'une commande","description":"Le numéro COM est renvoyé dans estimate_number, comme dans la liste. previous_document décrit le devis d'origine au même format que pour les factures (type, number, reference, sub_total) et est absent sans devis accessible. estimate contient l'identifiant et le numéro du devis d'origine, ou null pour une commande sans devis accessible.","operationId":"get.order","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderResponse"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicApiRateLimit"}},"security":[{"bearerAuth":[]}]}},"/order/{id}/pdf":{"get":{"tags":["10 · Commandes"],"summary":"Afficher le PDF d'une commande","operationId":"get.order.pdf","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]}},"/payments":{"get":{"tags":["14 · Paiements"],"summary":"Obtenir la liste des paiements.","operationId":"get.payments","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicPayment"}}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/payment/{id}":{"get":{"tags":["14 · Paiements"],"summary":"Afficher les données d'un paiement","operationId":"get.payment","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicPayment"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["14 · Paiements"],"summary":"Supprimer un paiement","operationId":"629f7971e91afa09a53b1ff581428cd9","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"string","example":"Deleted"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/payment":{"post":{"tags":["14 · Paiements"],"summary":"Créer un paiement","description":"Renseigner invoice_id pour une facture ou refund_invoice_id pour un avoir. Montant en unité monétaire. Sans amount, le solde restant est utilisé. Le montant ne doit être ni négatif ni supérieur au solde. La réponse réelle est HTTP 200.","operationId":"post.payment","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"invoice_id":{"description":"Facture de la société sélectionnée ; utiliser cet identifiant pour un règlement de facture.","type":"integer","example":123},"refund_invoice_id":{"description":"Avoir de la société sélectionnée, à utiliser à la place de invoice_id.","type":"integer","example":124},"payment_date":{"type":"string","format":"date","example":"2026-10-28"},"amount":{"type":"number","example":120},"payment_method_id":{"type":"integer","example":3},"currency_id":{"type":"integer"},"notes":{"type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicPayment"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"422":{"$ref":"#/components/responses/PublicValidation"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/payment-methods":{"get":{"tags":["15 · Modes de paiement"],"summary":"Obtenir la liste des méthodes de paiements.","operationId":"get.paymentMethods","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicPaymentMethod"}}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/pre-billings":{"get":{"tags":["11 · Préfacturations"],"summary":"Liste des préfacturations","operationId":"b5d460fcc6fe708a600c3fa9299b6f98","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"query","schema":{"type":"integer"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"from_date","in":"query","schema":{"type":"string","format":"date"}},{"name":"to_date","in":"query","schema":{"type":"string","format":"date"}},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"page","in":"query","schema":{"type":"integer","default":1}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Liste paginée"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/pre-billing/{id}":{"get":{"tags":["11 · Préfacturations"],"summary":"Consulter une préfacturation","operationId":"24cdbb9db62a828f01c327683ec5d648","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"put":{"tags":["11 · Préfacturations"],"summary":"Remplacer une préfacturation brouillon non liée à une facture","operationId":"c0513259052e61b26d77e4c0a278f09b","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicPreBilling"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"404":{"$ref":"#/components/responses/PublicNotFound"},"409":{"description":"Préfacturation déjà facturée ou archivée"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["11 · Préfacturations"],"summary":"Supprimer une préfacturation brouillon non liée à une facture","operationId":"3ffbcbb6a9a86c7249d8ea6abe128823","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Deleted"},"404":{"$ref":"#/components/responses/PublicNotFound"},"409":{"description":"Préfacturation déjà facturée ou archivée"}},"security":[{"bearerAuth":[]}]}},"/pre-billing":{"post":{"tags":["11 · Préfacturations"],"summary":"Créer une préfacturation","operationId":"f94a6f5c69de6d2e19ebcef84bfb910f","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicPreBilling"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"Created"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/pre-billing/{id}/duplicate":{"post":{"tags":["11 · Préfacturations"],"summary":"Dupliquer une préfacturation à aujourd'hui","operationId":"28ed3d116f5ca30bf45baa42c0a6e4cf","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"Brouillon dupliqué à la date du jour"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]}},"/purchase-invoices":{"get":{"tags":["16 · Achats"],"summary":"Historique des achats envoyés par l’utilisateur connecté","operationId":"1300b30da141ac3e397c3fa1fbbcaf3b","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":50,"minimum":1}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Achats de l’utilisateur, du plus récent au plus ancien"}},"security":[{"bearerAuth":[]}]}},"/purchase-invoice/import":{"post":{"tags":["16 · Achats"],"summary":"Importer une facture fournisseur ou une note","description":"Enregistre la pièce jointe. Si supplier_id est fourni, une écriture à compléter est préparée. Sans paramètre ocr, toutes les sociétés bénéficient temporairement automatiquement de l’extraction sur les formats compatibles lorsque le service est disponible. Sinon, la pièce est conservée pour saisie manuelle. Les paramètres ocr=true/false restent disponibles pour les intégrations existantes.","operationId":"post.purchase-invoice.import","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"required":["file"],"properties":{"file":{"description":"PDF, image, document Word, Excel, PowerPoint ou OpenDocument (20 Mo maximum).","type":"string","format":"binary"},"ocr":{"description":"Facultatif : absent, le backend active automatiquement l’OCR sur les formats compatibles lorsque le service est disponible. true demande explicitement l’OCR, false conserve le document pour saisie manuelle. L’OCR est temporairement disponible pour toutes les sociétés. HEIC/HEIF et ODS/ODP restent des documents classiques en mode automatique.","type":"boolean"},"supplier_id":{"description":"Identifiant facultatif d'un fournisseur appartenant à la société.","type":"integer","nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"Pièce importée"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/purchase-invoice/{id}":{"get":{"tags":["16 · Achats"],"summary":"Consulter un achat et son résultat OCR","operationId":"eebf7c2276555958c53739dc799ef1c7","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Achat, pièce jointe et état OCR"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["16 · Achats"],"summary":"Supprimer son envoi non comptabilisé","operationId":"3d865f0a5a40c6fa8be30ad0a564cafd","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"204":{"description":"Envoi et pièce jointe supprimés"},"404":{"$ref":"#/components/responses/PublicNotFound"},"409":{"description":"Envoi déjà comptabilisé"}},"security":[{"bearerAuth":[]}]}},"/purchase-invoice/{id}/pdf":{"get":{"tags":["16 · Achats"],"summary":"Télécharger la pièce originale d’un achat","description":"Renvoie le PDF original sans modification (notamment Factur-X). Pour une image ou un document Office, renvoie le fichier dans son format original, sans conversion.","operationId":"bf57965a35004a4a83843981e5d44f14","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"Fichier original","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]}},"/recurring-invoices":{"get":{"tags":["13 · Factures récurrentes"],"summary":"Obtenir la liste de vos factures récurrentes.","operationId":"get.recurring.invoices","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/recurring-invoice/{id}":{"get":{"tags":["13 · Factures récurrentes"],"summary":"Données d'une facture récurrente","operationId":"get.recurring.invoice","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"404":{"$ref":"#/components/responses/PublicNotFound"}},"security":[{"bearerAuth":[]}]}},"/recurring-invoice":{"post":{"tags":["13 · Factures récurrentes"],"summary":"Créer une facture récurrente","operationId":"post.recurring.invoice","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["customer_id","frequency","generation_date","invoice_date","due_date"],"properties":{"customer_id":{"type":"integer","example":1234},"frequency":{"type":"string","enum":["M","T","Q","S","A","H"],"example":"M"},"status":{"type":"string","enum":["ACTIVE","INACTIVE"],"nullable":true},"reference":{"nullable":true},"generation_date":{"type":"string","format":"date","example":"2026-11-01"},"invoice_date":{"type":"string","format":"date","example":"2026-11-01"},"due_date":{"type":"string","format":"date","example":"2026-11-30"},"init_date":{"type":"string","format":"date","nullable":true},"end_date":{"type":"string","format":"date","nullable":true},"period_start":{"type":"string","format":"date","nullable":true},"period_end":{"type":"string","format":"date","nullable":true},"generate_pre_billings":{"description":"Inclure la préfacturation lors de la génération des factures récurrentes.","type":"boolean","example":true,"nullable":true},"payment_method_id":{"type":"integer","nullable":true},"title":{"nullable":true},"notes":{"nullable":true},"lines":{"type":"array","items":{"properties":{"is_title":{"type":"boolean","nullable":true},"item_id":{"description":"Condition : required_if:lines.*.is_title,false","type":"integer","example":123},"tax_type_id":{"type":"integer","nullable":true},"title":{"nullable":true},"is_ttc":{"nullable":true},"name":{"type":"string","nullable":true},"name2":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"quantity":{"type":"number","example":2,"nullable":true},"unit":{"type":"string","nullable":true},"price":{"type":"number","nullable":true},"discount_type":{"type":"string","nullable":true},"discount":{"type":"number","nullable":true},"is_percent":{"type":"boolean","nullable":true},"percent":{"type":"number","nullable":true},"line_percent":{"type":"array","items":{"type":"integer"},"nullable":true},"updown":{"type":"string","nullable":true}},"type":"object"},"nullable":true}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/tax-types":{"get":{"tags":["07 · TVA"],"summary":"Obtenir la liste des TVA.","operationId":"get.taxTypes","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/tax-type":{"post":{"tags":["07 · TVA"],"summary":"Créer une TVA","operationId":"post.tax-type","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name","percent"],"properties":{"name":{"type":"string","example":"TVA 8.5 %"},"percent":{"type":"number","example":8.5},"account_code":{"type":"string","example":"445664"},"code":{"type":"string","example":"1"}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]}},"/tax-type/{id}":{"put":{"tags":["07 · TVA"],"summary":"Modifier une TVA","operationId":"put.tax-type","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"name":{"type":"string","example":"TVA 8.5 %"},"percent":{"type":"number","example":8.5},"account_code":{"type":"string","example":"445664"},"code":{"type":"string","example":"1"}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]}},"/units":{"get":{"tags":["08 · Unités"],"summary":"Obtenir la liste des unités.","operationId":"get.units","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"200":{"description":"OK"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"}},"security":[{"bearerAuth":[]}]}},"/unit":{"post":{"tags":["08 · Unités"],"summary":"Créer une unité","operationId":"post.unit","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name"],"properties":{"name":{"type":"string","example":"forfait"},"plural":{"type":"string","example":"forfaits"}},"type":"object"}}}},"responses":{"403":{"$ref":"#/components/responses/PublicForbidden"},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"201":{"description":"OK"},"422":{"$ref":"#/components/responses/PublicValidation"},"503":{"description":"Service Unavailable"}},"security":[{"bearerAuth":[]}]}},"/customer/code/{code}":{"get":{"tags":["04 · Clients"],"summary":"Rechercher un client : code","operationId":"039d06c20bc7db4e24ec450a379b2f34","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCustomer"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/customer/account-code/{code}":{"get":{"tags":["04 · Clients"],"summary":"Rechercher un client : account-code","operationId":"f47a45ea1503e5392baf841600d9aec1","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCustomer"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/customer/email/{email}":{"get":{"tags":["04 · Clients"],"summary":"Rechercher un client : email","operationId":"41ae0944e81a388961531960c3d9950f","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"email","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCustomer"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/item/name/{name}":{"get":{"tags":["06 · Produits et services"],"summary":"Rechercher un produit : name","operationId":"ca7c88f30aecbbbd6703870cffde662b","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"name","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicItem"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/item/code/{code}":{"get":{"tags":["06 · Produits et services"],"summary":"Rechercher un produit : code","operationId":"fa330f3b8b34e8018c5a483554d5bd42","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicItem"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/invoice/{id}/stream-pdf":{"get":{"tags":["12 · Factures"],"summary":"Générer et télécharger le PDF","operationId":"28913d97d57dbc94405b0ba14b2f2b3f","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/pdf":[]}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/projects":{"get":{"tags":["18 · Projets"],"summary":"Lister les projets","description":"search filtre le nom ; status accepte DONE ou CURRENT. from_date et to_date sont validés mais ne sont pas appliqués par le contrôleur actuel.","operationId":"e8a83a8ab0aaf58de72dbfbe44ac2b0e","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":1000,"maximum":1000,"minimum":1}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicProject"}},"meta":{"$ref":"#/components/schemas/PublicDocumentPagination"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/project/{id}":{"get":{"tags":["18 · Projets"],"summary":"Consulter un projet","operationId":"8f0eec41b5c2d1efa737fac6919e7851","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicProject"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]},"put":{"tags":["18 · Projets"],"summary":"Modifier un projet","operationId":"00f0cbdf3a06ed6610f1947b685867b9","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name"],"properties":{"name":{"type":"string","example":"Projet de démonstration"},"description":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"city":{"type":"string","nullable":true}},"type":"object"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicProject"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["18 · Projets"],"summary":"Supprimer un projet","operationId":"80d6fa78c2e1be14fda132acf4500770","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"string","example":"Deleted."}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/project":{"post":{"tags":["18 · Projets"],"summary":"Créer un projet","operationId":"5e87587f952ded42737aa3770bae2839","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name"],"properties":{"name":{"type":"string","example":"Projet de démonstration"},"description":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"city":{"type":"string","nullable":true}},"type":"object"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicProject"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/lead":{"post":{"tags":["19 · Prospects"],"summary":"Créer un prospect","description":"name renseigne le nom du contact ; le nom du prospect est pris dans company_name par le contrôleur actuel. super_name est obligatoire. Les champs d’adresse ne sont pas acceptés par la validation publique.","operationId":"32ea0421517039114d4157425c35ed09","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name","super_name"],"properties":{"name":{"type":"string","example":"Camille Exemple"},"super_name":{"type":"string","example":"Prospect Démo"},"company_name":{"type":"string","example":"Atelier Exemple"},"email":{"type":"string","example":"demo@example.com"},"phone":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"type":"object"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicCustomer"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/artisans":{"get":{"tags":["20 · Artisans"],"summary":"Lister les artisans","description":"status accepte active ou inactive ; search filtre le nom ou l’email. La liste exclut les fiches vintage et is_web.","operationId":"1586c7bec6ce073abf461f8477ae2b35","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":1000,"maximum":1000,"minimum":1}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicCustomer"}},"meta":{"$ref":"#/components/schemas/PublicDocumentPagination"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}},"/payment-method/{id}":{"get":{"tags":["15 · Modes de paiement"],"summary":"Consulter un mode de paiement","operationId":"fb010d9a0e85f3232ba755839376287c","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicPaymentMethod"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["15 · Modes de paiement"],"summary":"Supprimer un mode de paiement","description":"La suppression renvoie 403 si des paiements ou dépenses sont rattachés.","operationId":"661df86251c24f73a0db3716fdd2a921","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"type":"string","example":"Deleted"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"}},"security":[{"bearerAuth":[]}]}},"/payment-method":{"post":{"tags":["15 · Modes de paiement"],"summary":"Créer un mode de paiement","description":"Le nom doit être unique dans la société. La création renvoie HTTP 200.","operationId":"030a610d989098b4ccd5b699208169ca","parameters":[{"name":"X-Company","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name"],"properties":{"name":{"type":"string","example":"Virement Démo"},"account_code":{"type":"string","example":"512000"},"filebank":{"type":"boolean","example":false},"accounting":{"type":"boolean","example":false}},"type":"object"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/PublicPaymentMethod"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/PublicUnauthenticated"},"403":{"$ref":"#/components/responses/PublicForbidden"},"404":{"$ref":"#/components/responses/PublicNotFound"},"429":{"$ref":"#/components/responses/PublicRateLimited"},"422":{"$ref":"#/components/responses/PublicValidation"}},"security":[{"bearerAuth":[]}]}}},"components":{"schemas":{"PublicPreBilling":{"title":"Préfacturation","description":"Données de création ou de modification d’une préfacturation.","required":["customer_id","lines"],"properties":{"customer_id":{"type":"integer"},"pre_billing_date":{"description":"Date de préfacturation (défaut : aujourd'hui)","type":"string","format":"date","nullable":true},"reference":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"refund":{"type":"boolean","default":false},"lines":{"type":"array","items":{"properties":{"item_id":{"description":"Produit de la société, obligatoire sauf pour un titre","type":"integer"},"is_title":{"type":"boolean","default":false},"title":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"name2":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"unit":{"type":"string","nullable":true},"price":{"description":"Prix unitaire en devise (défaut : prix du produit)","type":"number"},"ecotaxe":{"description":"Écotaxe unitaire en devise (défaut : produit)","type":"number"},"quantity":{"type":"number","default":1},"nkp":{"type":"number","default":1},"tax_type_id":{"description":"TVA de la société ; défaut : TVA du produit, null : sans TVA","type":"integer","nullable":true},"discount_type":{"type":"string","default":"fixed","enum":["fixed","percentage"]},"discount":{"description":"Remise unitaire en devise ou en pourcentage","type":"number","default":0},"is_ttc":{"type":"boolean","default":false},"is_free":{"type":"boolean","default":false},"debours":{"type":"boolean","default":false}},"type":"object"},"minItems":1}},"type":"object"},"PublicEstimateLine":{"properties":{"line_number":{"description":"Position dans le tableau lines, à partir de 1, lignes de titre comprises. Ce numéro peut changer lors d'un ajout, d'une suppression ou d'un déplacement de ligne et ne constitue pas un identifiant stable.","type":"integer","minimum":1,"example":1},"item_id":{"type":"integer","example":7,"nullable":true},"is_title":{"type":"boolean","example":false,"nullable":true},"title":{"type":"string","example":"","nullable":true},"name":{"type":"string","example":"Pièce découpée","nullable":true},"replace_name":{"type":"string","example":"","nullable":true},"description":{"type":"string","example":"","nullable":true},"quantity":{"type":"number","example":1,"nullable":true},"unit":{"description":"Unité enregistrée sur la ligne du document (forfait, pièce, heure…), indépendamment de l'unité actuelle du produit.","type":"string","example":"pièce","nullable":true},"price":{"type":"number","example":100,"nullable":true},"discount_type":{"type":"string","example":"fixed","nullable":true},"discount":{"type":"number","example":0,"nullable":true},"is_ttc":{"type":"boolean","example":false,"nullable":true},"sub_total":{"type":"number","example":100,"nullable":true},"tax":{"type":"number","example":20,"nullable":true},"total":{"type":"number","example":100,"nullable":true},"tax_type_id":{"type":"integer","example":1,"nullable":true},"tax_type":{"properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"TVA 20 %"},"percent":{"type":"number","example":20},"amount":{"description":"Présent pour les anciennes lignes utilisant la relation taxes.","type":"number","example":20}},"type":"object","nullable":true}},"type":"object"},"PublicEstimate":{"description":"Devis ou commande. Les montants sont exprimés en unité monétaire (ex. euros), pas en centimes. status_changed_at est la date du dernier changement de statut enregistré depuis la mise en place du suivi ; null pour les documents antérieurs sans nouveau changement. updated_at désigne toute modification et ne constitue pas une date de changement d'état. Dates horaires au format ISO 8601 en UTC.","properties":{"id":{"type":"integer","example":123},"customer_id":{"type":"integer","example":42},"customer":{"properties":{"name":{"type":"string","example":"Client de démonstration"}},"type":"object"},"estimate_date":{"type":"string","format":"date","example":"2026-10-21"},"expiry_date":{"type":"string","format":"date","example":"2026-11-21","nullable":true},"estimate_number":{"description":"Numéro du document : DEVxxxx pour un devis, COMxxxx pour une commande (le nom du champ reste estimate_number).","type":"string","example":"DEV20260001"},"reference":{"description":"Référence libre du document, distincte du devis d'origine.","type":"string","example":"AFFAIRE-001","nullable":true},"status":{"description":"Statut métier courant, renvoyé tel qu'enregistré. Les commandes peuvent notamment être DRAFT, PARTIAL_INVOICED, INVOICED, ARCHIVED ou DELIVERED ; les devis également SENT, VIEWED, EXPIRED, ACCEPTED, REJECTED ou ORDERED selon leur parcours.","type":"string","example":"ACCEPTED"},"status_changed_at":{"type":"string","format":"date-time","example":"2026-10-21T14:30:00.000000Z","nullable":true},"updated_at":{"type":"string","format":"date-time","example":"2026-10-21T14:30:00.000000Z","nullable":true},"title":{"type":"string","example":"Découpe de pièces","nullable":true},"notes":{"type":"string","example":"","nullable":true},"sub_total":{"type":"number","example":100},"tax":{"type":"number","example":20},"total":{"type":"number","example":120},"payment_method_id":{"type":"integer","example":1,"nullable":true},"lines":{"type":"array","items":{"$ref":"#/components/schemas/PublicEstimateLine"}}},"type":"object"},"PublicOrder":{"allOf":[{"$ref":"#/components/schemas/PublicEstimate"},{"properties":{"id":{"type":"integer","example":124},"estimate_number":{"type":"string","example":"COM20260001"},"status":{"type":"string","example":"DRAFT"},"previous_document":{"description":"Devis d'origine accessible, au même format que pour les factures. Champ absent sans devis accessible. sub_total est exprimé en unité monétaire, pas en centimes.","properties":{"type":{"type":"string","enum":["estimate"],"example":"estimate"},"number":{"type":"string","example":"DEV20260001"},"reference":{"type":"string","example":"AFFAIRE-001","nullable":true},"sub_total":{"type":"number","example":100}},"type":"object"},"estimate_id":{"description":"Identifiant du devis d'origine accessible, sinon null.","type":"integer","example":123,"nullable":true},"estimate":{"description":"Devis d'origine accessible dans la société et pour l'utilisateur courant, sinon null.","properties":{"id":{"type":"integer","example":123},"estimate_number":{"type":"string","example":"DEV20260001"}},"type":"object","nullable":true}},"type":"object"}]},"PublicEstimateResponse":{"properties":{"data":{"$ref":"#/components/schemas/PublicEstimate"}},"type":"object"},"PublicOrderResponse":{"properties":{"data":{"$ref":"#/components/schemas/PublicOrder"}},"type":"object"},"PublicDocumentPagination":{"properties":{"current_page":{"type":"integer","example":1},"last_page":{"type":"integer","example":1},"total":{"type":"integer","example":1},"has_more":{"type":"boolean","example":false}},"type":"object"},"PublicProject":{"properties":{"id":{"type":"integer","example":123},"name":{"type":"string","example":"Projet de démonstration"},"description":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"status":{"type":"string","example":"CURRENT"},"photo":{"properties":{"id":{"type":"integer"},"thumb":{"type":"string","format":"uri"}},"type":"object","nullable":true}},"type":"object"},"PublicPaymentMethod":{"properties":{"id":{"type":"integer","example":3},"name":{"type":"string","example":"Virement Démo"},"account_code":{"type":"string","example":"512000"}},"type":"object"},"PublicCompany":{"properties":{"id":{"description":"Identifiant de société à transmettre dans X-Company.","type":"string","example":"societe_demo"},"name":{"type":"string","example":"Atelier Exemple"},"company_name":{"type":"string","example":"SAS Atelier Exemple"},"company_group_id":{"description":"Identifiant public du groupe","type":"string","nullable":true},"logo":{"type":"string","nullable":true},"color":{"type":"string","nullable":true},"is_admin":{"type":"boolean","example":true},"permissions":{"type":"object","additionalProperties":true}},"type":"object"},"PublicUser":{"properties":{"id":{"type":"integer","example":42},"name":{"type":"string","example":"Camille Exemple"},"email":{"type":"string","format":"email","example":"camille@example.com"},"phone":{"type":"string","example":"0601020304","nullable":true},"language":{"description":"Uniquement dans GET /who-i-am.","type":"string","example":"fr"}},"type":"object"},"PublicCompanyCreate":{"required":["name","company_name","address_street_1","zip","city","email","crn"],"properties":{"name":{"type":"string","example":"Atelier Exemple"},"company_name":{"type":"string","example":"SAS Atelier Exemple"},"address_street_1":{"type":"string","example":"10 rue des Ateliers"},"address_street_2":{"type":"string","example":"Bâtiment A","nullable":true},"zip":{"type":"string","example":"75001"},"city":{"type":"string","example":"Paris"},"email":{"type":"string","format":"email","example":"contact@example.com"},"phone":{"type":"string","example":"0102030405","nullable":true},"crn":{"description":"SIREN ou SIRET de la société.","type":"string","example":"12345678900012"},"vat":{"type":"string","example":"FR00123456789","nullable":true},"logo":{"description":"Image encodée en base64 ; omettre pour utiliser le logo par défaut.","type":"string","nullable":true},"footer_document":{"type":"string","nullable":true},"price":{"description":"Facultatif, ignoré : tarif issu de price_child du groupe sélectionné ou du partenaire connecté, ou 7 si absent.","type":"number","nullable":true},"company_group_id":{"description":"Identifiant public du groupe du partenaire connecté ; équipe interne autorisée à choisir tout groupe existant. Les anciens identifiants numériques restent acceptés.","type":"string","nullable":true},"settings":{"properties":{"language":{"description":"Initialisation en français (pays France) ou espagnol (pays Espagne).","type":"string","default":"fr","enum":["fr","es"]}},"type":"object","nullable":true}},"type":"object"},"PublicCompanyUserCreate":{"required":["name","email","password"],"properties":{"name":{"type":"string","example":"Camille Exemple"},"email":{"description":"Adresse unique parmi tous les utilisateurs. Cette route crée un nouvel utilisateur, elle ne rattache pas un compte existant.","type":"string","format":"email","example":"camille@example.com"},"password":{"description":"Au moins une minuscule, une majuscule et un chiffre.","type":"string","format":"password","minLength":8,"writeOnly":true,"example":"ExempleDemo42!"},"phone":{"type":"string","example":"0601020304","nullable":true}},"type":"object"},"PublicItem":{"description":"Produit ou service. Prix en unité monétaire, pas en centimes. Les noms de TVA et unité sont conditionnels ; currency contient id et name si une devise existe.","properties":{"id":{"type":"integer","example":123},"name":{"type":"string","example":"Prestation de conseil"},"description":{"type":"string","example":"Conseil technique"},"code":{"type":"string","example":"P001"},"account_code":{"type":"string","example":"706001"},"price":{"type":"number","example":75.5},"ecotaxe":{"type":"number","example":0},"default_tax_id":{"type":"integer","example":12},"default_tax_name":{"type":"string","example":"TVA 20 %"},"unit_id":{"type":"integer","example":3},"unit_name":{"type":"string","example":"heure"}},"type":"object"},"PublicCustomer":{"description":"Coordonnées client. Peut également contenir contacts, custom_fields, devise, mode de paiement et pays de facturation.","properties":{"id":{"type":"integer","example":42},"name":{"type":"string","example":"Atelier Exemple"},"company_name":{"type":"string","example":"SAS Atelier Exemple"},"code":{"type":"string","example":"C0001"},"account_code":{"type":"string","example":"411001"},"email":{"type":"string","example":"contact@example.com"},"phone":{"type":"string","example":"0102030405"},"crn":{"type":"string","example":"123456789"},"nic":{"type":"string","example":"00012"},"vat":{"type":"string","example":"FR00123456789"},"billing_address_1":{"type":"string","example":"10 rue des Ateliers"},"billing_zip":{"type":"string","example":"75001"},"billing_city":{"type":"string","example":"Paris"},"is_web":{"type":"boolean","example":false}},"type":"object"},"PublicInvoice":{"description":"Principaux champs de facture. Montants en unité monétaire, pas en centimes. La réponse complète inclut notamment customer, lines, devise, mode de paiement et champs personnalisés éventuels.","properties":{"id":{"type":"integer","example":123},"customer_id":{"type":"integer","example":42},"invoice_date":{"type":"string","format":"date","example":"2026-10-28"},"due_date":{"type":"string","format":"date","example":"2026-11-28"},"invoice_number":{"type":"string","example":"FAC-2026-00123"},"reference":{"type":"string","example":"COMMANDE-42"},"status":{"type":"string","example":"DRAFT"},"paid_status":{"type":"string","enum":["UNPAID","PARTIALLY_PAID","PAID"],"example":"UNPAID"},"refund":{"type":"boolean","example":false},"deposit":{"type":"boolean","example":false},"final":{"type":"boolean","example":false},"sub_total":{"type":"number","example":100},"tax":{"type":"number","example":20},"total":{"type":"number","example":120},"lines":{"type":"array","items":{"properties":{"line_number":{"type":"integer","example":1},"item_id":{"type":"integer","example":123},"quantity":{"type":"number","example":2},"unit":{"type":"string","example":"heure","nullable":true}},"type":"object"}}},"type":"object"},"PublicPayment":{"properties":{"id":{"type":"integer","example":321},"customer_id":{"type":"integer","example":42},"payment_number":{"type":"string","example":"REG-2026-00321"},"payment_date":{"type":"string","example":"2026-10-28"},"amount":{"type":"number","example":120},"invoice_id":{"type":"integer","example":123,"nullable":true},"refund_invoice_id":{"type":"integer","nullable":true},"payment_method_id":{"type":"integer","example":3,"nullable":true},"notes":{"type":"string","nullable":true}},"type":"object"}},"responses":{"PublicApiRateLimit":{"description":"Limite par défaut de l'API publique : 240 appels par minute, partagée entre les endpoints et les sociétés pour un même utilisateur authentifié (par IP hors authentification). Une dérogation temporaire peut être configurée côté serveur pour une reprise initiale de données ; elle expire automatiquement. Le plafond effectif est indiqué par X-RateLimit-Limit sur les réponses. Quelques appels par quart d'heure et par société sont compatibles avec la limite standard. Après HTTP 429, attendre le délai Retry-After avant de réessayer.","headers":{"Retry-After":{"description":"Délai en secondes avant une nouvelle tentative.","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Plafond d'appels par fenêtre.","schema":{"type":"integer","example":240}},"X-RateLimit-Remaining":{"description":"Appels restants dans la fenêtre courante.","schema":{"type":"integer","example":0}}}},"PublicUnauthenticated":{"description":"Token absent, invalide ou expiré ; ou X-Company absent, inconnu ou inaccessible à cet utilisateur.","content":{"application/json":{"schema":{"properties":{"message":{"type":"string","example":"401 Unauthorized"}},"type":"object"}}}},"PublicForbidden":{"description":"Utilisateur authentifié mais droits insuffisants dans la société sélectionnée.","content":{"application/json":{"schema":{"properties":{"message":{"type":"string","example":"This action is unauthorized."}},"type":"object"}}}},"PublicNotFound":{"description":"Ressource introuvable ou non visible dans la société sélectionnée.","content":{"application/json":{"schema":{"properties":{"message":{"type":"string","example":"Not Found"}},"type":"object"}}}},"PublicValidation":{"description":"JSON malformé, champ invalide ou attribut non prévu. api_validation utilise debug.errors, debug.fatal_error ou debug.unexpected_attributes ; certaines opérations utilisent message et errors.","content":{"application/json":{"schema":{"properties":{"message":{"type":"string","example":"422 Unprocessable Content"},"debug":{"properties":{"errors":{"type":"object","example":{"email":["The email field is required."]},"additionalProperties":{"type":"array","items":{"type":"string"}}},"fatal_error":{"type":"string","example":"Check your request. Not a valid JSON."},"unexpected_attributes":{"type":"array","items":{"type":"string"},"example":["unknown_field"]}},"type":"object"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"type":"object"}}}},"PublicRateLimited":{"description":"Quota dépassé. Attendre Retry-After secondes avant de réessayer ; éviter les nouvelles tentatives immédiates.","headers":{"X-RateLimit-Limit":{"description":"Quota de la fenêtre courante (240 par défaut).","schema":{"type":"integer","example":240}},"X-RateLimit-Remaining":{"description":"Requêtes restantes.","schema":{"type":"integer","example":0}},"Retry-After":{"description":"Délai en secondes avant une nouvelle tentative.","schema":{"type":"integer","example":60}},"X-RateLimit-Reset":{"description":"Fin de fenêtre, timestamp Unix en secondes.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"properties":{"message":{"type":"string","example":"Too Many Attempts."}},"type":"object"}}}}},"securitySchemes":{"bearerAuth":{"type":"http","description":"Token personnel obtenu par POST /token. Saisir uniquement le token dans Authorize ; Swagger ajoute le préfixe Bearer.","scheme":"bearer"}}},"tags":[{"name":"01 · Disponibilité","description":"Disponibilité"},{"name":"02 · Authentification","description":"Obtenir, vérifier et révoquer un token personnel."},{"name":"03 · Sociétés et utilisateurs","description":"Lister les sociétés, récupérer X-Company, créer une société puis ses administrateurs."},{"name":"04 · Clients","description":"Clients"},{"name":"05 · Contacts","description":"Contacts"},{"name":"06 · Produits et services","description":"Produits et services"},{"name":"07 · TVA","description":"TVA"},{"name":"08 · Unités","description":"Unités"},{"name":"09 · Devis","description":"Devis"},{"name":"10 · Commandes","description":"Commandes"},{"name":"11 · Préfacturations","description":"Préfacturations"},{"name":"12 · Factures","description":"Factures"},{"name":"13 · Factures récurrentes","description":"Factures récurrentes"},{"name":"14 · Paiements","description":"Paiements"},{"name":"15 · Modes de paiement","description":"Modes de paiement"},{"name":"16 · Achats","description":"Achats"},{"name":"17 · Exemples et validation","description":"Routes pédagogiques publiques pour comprendre la validation stricte du JSON."},{"name":"18 · Projets","description":"18 · Projets"},{"name":"19 · Prospects","description":"19 · Prospects"},{"name":"20 · Artisans","description":"20 · Artisans"}]}