Material Purchase With Documents

Create a product material purchase and attach supporting documents.

Use this flow when an inventory purchase and its supporting files should be created together.

1. Create the purchase with document metadata

Shell
curl -X POST {{BASE_URL}}/api/v1/product/materials/FABRIC/{materialId}/purchases/with-documents \
-H "Authorization: Bearer $CONFORMA_PAT" \
-H "idempotency-key: fabric-lot-2026-0001" \
-F 'payload={
"lotNumber": "LOT-2026-0001",
"purchaseDate": "2026-06-16T00:00:00.000Z",
"quantity": "120",
"unitOfMeasure": "M",
"value": "2400.00",
"currency": "EUR",
"transportMode": "TRUCK",
"distanceKm": 320,
"ddtNumber": "DDT-2026-0001",
"invoiceNumber": "INV-2026-0001"
}' \
-F 'attachments=[
{
"clientId": "invoice_file",
"fileName": "invoice.pdf",
"contentType": "application/pdf",
"sizeBytes": 240183,
"category": "INVOICE"
},
{
"clientId": "ddt_file",
"fileName": "ddt.pdf",
"contentType": "application/pdf",
"sizeBytes": 182004,
"category": "DDT"
}
]' \
-F "invoice_file=@invoice.pdf;type=application/pdf" \
-F "ddt_file=@ddt.pdf;type=application/pdf"

The response is MaterialPurchaseCreatedResponseDto with purchase, line, documents and optional scope3Estimate.

2. List documents for the created purchase

Shell
curl {{BASE_URL}}/api/v1/product/materials/FABRIC/{materialId}/purchases/{purchaseId}/documents \
-H "Authorization: Bearer $CONFORMA_PAT"

Reuse the same idempotency-key only when retrying the same logical create request after a timeout or network failure.