{"openapi":"3.1.0","info":{"title":"Facturare — API REST","version":"1.1.0","description":"API public pentru integrări (facturi, proforme, avize, clienți, furnizori, produse, stoc, încasări, e-Factura, rapoarte). Autentificare: antet `Authorization: Bearer fk_…`. Cheile se creează din Setări → API."},"servers":[{"url":"https://facturare.vtrade.ro/api/v1","description":"Instanța ta"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Facturi"},{"name":"e-Factura"},{"name":"Proforme"},{"name":"Avize"},{"name":"Încasări"},{"name":"Clienți"},{"name":"Furnizori"},{"name":"Produse"},{"name":"Stoc"},{"name":"Nomenclatoare"},{"name":"Recurente"},{"name":"Rapoarte"}],"paths":{"/facturi":{"get":{"tags":["Facturi"],"summary":"Listează facturi","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":50}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Facturi"],"summary":"Creează factur","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}":{"get":{"tags":["Facturi"],"summary":"Detalii","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Facturi"],"summary":"Modifică ciornă","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}}}},"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Facturi"],"summary":"Șterge ciornă","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/emite":{"post":{"tags":["Facturi"],"summary":"Emite (alocă număr)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/pdf":{"get":{"tags":["Facturi"],"summary":"Descarcă PDF","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{}}}}}},"/facturi/{id}/storno":{"post":{"tags":["Facturi"],"summary":"Emite storno","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/anuleaza":{"post":{"tags":["Facturi"],"summary":"Anulează","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/email":{"post":{"tags":["Facturi"],"summary":"Trimite pe email","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string"}}}}}},"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/status-plata":{"get":{"tags":["Facturi"],"summary":"Status plată","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/incasare":{"post":{"tags":["Facturi"],"summary":"Înregistrează încasare","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentQuick"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/efactura":{"post":{"tags":["e-Factura"],"summary":"Trimite la ANAF (SPV)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"get":{"tags":["e-Factura"],"summary":"Status e-Factura","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi/{id}/efactura/xml":{"get":{"tags":["e-Factura"],"summary":"Descarcă XML CIUS-RO","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"XML","content":{"application/xml":{}}}}}},"/efactura/primite":{"get":{"tags":["e-Factura"],"summary":"Facturi primite (SPV)","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/proforme":{"get":{"tags":["Proforme"],"summary":"Listează proforme","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":50}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Proforme"],"summary":"Creează proform","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/proforme/{id}":{"get":{"tags":["Proforme"],"summary":"Detalii","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Proforme"],"summary":"Modifică ciornă","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}}}},"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Proforme"],"summary":"Șterge ciornă","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/proforme/{id}/emite":{"post":{"tags":["Proforme"],"summary":"Emite (alocă număr)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/proforme/{id}/pdf":{"get":{"tags":["Proforme"],"summary":"Descarcă PDF","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{}}}}}},"/proforme/{id}/converteste":{"post":{"tags":["Proforme"],"summary":"Convertește în factură","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/avize":{"get":{"tags":["Avize"],"summary":"Listează avize","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":50}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Avize"],"summary":"Creează aviz","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/avize/{id}":{"get":{"tags":["Avize"],"summary":"Detalii","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Avize"],"summary":"Modifică ciornă","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}}}},"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Avize"],"summary":"Șterge ciornă","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/avize/{id}/emite":{"post":{"tags":["Avize"],"summary":"Emite (alocă număr)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/avize/{id}/pdf":{"get":{"tags":["Avize"],"summary":"Descarcă PDF","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{}}}}}},"/avize/{id}/converteste":{"post":{"tags":["Avize"],"summary":"Convertește în factură","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/incasari":{"get":{"tags":["Încasări"],"summary":"Listează încasări","parameters":[{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Încasări"],"summary":"Creează încasare","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/incasari/{id}":{"delete":{"tags":["Încasări"],"summary":"Șterge încasare","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/chitante":{"get":{"tags":["Încasări"],"summary":"Listează chitanțe","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/clienti":{"get":{"tags":["Clienți"],"summary":"Listează clienți","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Partner"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Clienți"],"summary":"Creează client","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerInput"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Partner"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/clienti/{id}":{"get":{"tags":["Clienți"],"summary":"Detalii client","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Partner"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Clienți"],"summary":"Modifică client","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerInput"}}}},"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Partner"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Clienți"],"summary":"Șterge client","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/clienti/anaf":{"get":{"tags":["Clienți"],"summary":"Date firmă din ANAF","parameters":[{"name":"cui","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/furnizori":{"get":{"tags":["Furnizori"],"summary":"Listează furnizori","parameters":[{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Partner"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Furnizori"],"summary":"Creează furnizor","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerInput"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Partner"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/furnizori/{id}":{"get":{"tags":["Furnizori"],"summary":"Detalii","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Partner"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Furnizori"],"summary":"Modifică","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerInput"}}}},"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Partner"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Furnizori"],"summary":"Șterge","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/produse":{"get":{"tags":["Produse"],"summary":"Listează produse","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Produse"],"summary":"Creează produs","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/produse/{id}":{"get":{"tags":["Produse"],"summary":"Detalii produs","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Produse"],"summary":"Modifică produs","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"}}}},"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Produse"],"summary":"Șterge produs","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/produse/{id}/fisa":{"get":{"tags":["Produse"],"summary":"Fișă produs (istoric mișcări)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/stocuri":{"get":{"tags":["Stoc"],"summary":"Nivel stoc","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/stocuri/miscari":{"get":{"tags":["Stoc"],"summary":"Mișcări de stoc","parameters":[{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/nir":{"post":{"tags":["Stoc"],"summary":"Intrare (NIR)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockEntry"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/stocuri/iesire":{"post":{"tags":["Stoc"],"summary":"Ieșire din stoc","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockEntry"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/serii":{"get":{"tags":["Nomenclatoare"],"summary":"Serii documente","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/cote-tva":{"get":{"tags":["Nomenclatoare"],"summary":"Cote TVA","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/unitati-masura":{"get":{"tags":["Nomenclatoare"],"summary":"Unități de măsură","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/gestiuni":{"get":{"tags":["Nomenclatoare"],"summary":"Gestiuni","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/facturi-recurente":{"get":{"tags":["Recurente"],"summary":"Listează abonamente","responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Recurente"],"summary":"Creează abonament","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi-recurente/{id}":{"delete":{"tags":["Recurente"],"summary":"Șterge abonament","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/facturi-recurente/{id}/genereaza":{"post":{"tags":["Recurente"],"summary":"Generează factură acum","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/rapoarte/jurnal-vanzari":{"get":{"tags":["Rapoarte"],"summary":"Jurnal de vânzări","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Succes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/declaratii/{tip}":{"get":{"tags":["Rapoarte"],"summary":"Declarație (d394 | d300 | saft)","parameters":[{"name":"tip","in":"path","required":true,"schema":{"type":"string","enum":["d394","d300","saft"]}},{"name":"an","in":"query","schema":{"type":"integer"}},{"name":"luna","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"XML sau JSON, în funcție de tip"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"fk_…","description":"Cheie API din Setări → API."}},"responses":{"Unauthorized":{"description":"Cheie API lipsă/invalidă","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"BadRequest":{"description":"Date invalide","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Resursă inexistentă","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{}}},"Partner":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"cui":{"type":"string","nullable":true},"vatPayer":{"type":"boolean"},"city":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"isClient":{"type":"boolean"},"isSupplier":{"type":"boolean"}}},"PartnerInput":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"cui":{"type":"string"},"city":{"type":"string"},"county":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"address":{"type":"string"},"iban":{"type":"string"},"paymentTermDays":{"type":"integer"}}},"Product":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"price":{"type":"string"},"kind":{"type":"string"}}},"ProductInput":{"type":"object","required":["name","unitId","vatRateId"],"properties":{"name":{"type":"string"},"code":{"type":"string"},"price":{"type":"number"},"kind":{"type":"string","enum":["PRODUCT","SERVICE"]},"unitId":{"type":"string"},"vatRateId":{"type":"string"}}},"Document":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"number":{"type":"string","nullable":true},"status":{"type":"string"},"issueDate":{"type":"string","format":"date"},"currency":{"type":"string"},"subtotal":{"type":"string"},"vatTotal":{"type":"string"},"total":{"type":"string"},"paidAmount":{"type":"string"},"partner":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"lines":{"type":"array","items":{"type":"object"}}}},"DocumentInput":{"type":"object","required":["partnerId","issueDate","lines"],"properties":{"issue":{"type":"boolean","description":"Emite direct dacă true"},"partnerId":{"type":"string"},"issueDate":{"type":"string","format":"date"},"currency":{"type":"string","default":"RON"},"exchangeRate":{"type":"number","default":1},"reverseCharge":{"type":"boolean"},"lines":{"type":"array","items":{"type":"object","required":["description","quantity","unitPrice","vatRateId"],"properties":{"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"discountPercent":{"type":"number"},"vatRateId":{"type":"string"},"productId":{"type":"string"}}}}}},"Payment":{"type":"object","required":["amount"],"properties":{"direction":{"type":"string","enum":["IN","OUT"],"default":"IN"},"method":{"type":"string","enum":["CASH","BANK_TRANSFER","CARD","CHECK","OTHER"]},"partnerId":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"},"date":{"type":"string","format":"date"},"isReceipt":{"type":"boolean"},"allocations":{"type":"array","items":{"type":"object","properties":{"documentId":{"type":"string"},"amount":{"type":"number"}}}}}},"PaymentQuick":{"type":"object","required":["amount"],"properties":{"amount":{"type":"number"},"method":{"type":"string"},"date":{"type":"string","format":"date"},"receipt":{"type":"boolean"}}},"StockEntry":{"type":"object","required":["warehouseId","date","lines"],"properties":{"warehouseId":{"type":"string"},"date":{"type":"string","format":"date"},"notes":{"type":"string"},"lines":{"type":"array","items":{"type":"object","required":["productId","quantity"],"properties":{"productId":{"type":"string"},"quantity":{"type":"number"},"unitCost":{"type":"number"}}}}}}}}}