Skip to main content

Type Alias: CreateInvoiceDtoPayload

@arolariu/website


@arolariu/website / types/invoices/Invoice / CreateInvoiceDtoPayload

Type Alias: CreateInvoiceDtoPayload

CreateInvoiceDtoPayload = object

Defined in: types/invoices/Invoice.ts:396

DTO payload for creating a new invoice via the API.

Remarks

Required Fields:

  • userIdentifier: The authenticated user's ID (from Clerk)
  • initialScan: At least one document scan to process

Metadata Handling: The metadata field accepts both reserved keys (SpecialMetadataKeys) and arbitrary string keys for extensibility. Reserved keys trigger special backend behaviors.

Validation:

  • userIdentifier must be a valid Clerk user ID
  • initialScan.location must be a valid Azure Blob Storage URL
  • Scan type must match the actual file format

Example

const payload: CreateInvoiceDtoPayload = {
userIdentifier: "user_abc123",
initialScan: {
scanType: InvoiceScanType.JPEG,
location: "https://cdn.arolariu.ro/uploads/receipt.jpg",
metadata: {}
},
metadata: {
isImportant: "true",
requiresAnalysis: "true",
source: "mobile-app"
}
};

const response = await fetch("/api/invoices", {
method: "POST",
body: JSON.stringify(payload)
});

See

Properties

userIdentifier

readonly userIdentifier: string

Defined in: types/invoices/Invoice.ts:398

The user identifier associated with the invoice.


initialScan

readonly initialScan: InvoiceScan

Defined in: types/invoices/Invoice.ts:400

The initial scan associated with the invoice.


metadata

readonly metadata: Record<SpecialMetadataKeys | string & object, string>

Defined in: types/invoices/Invoice.ts:403

The metadata associated with the invoice.

// was this page useful?