Marmin

Edit and resubmit a purchase invoice


Updates and resubmits a specific purchase invoice after fixing validation issues.

Rate limit

60 requests/minute per authenticated account. See Rate limiting for response headers (X-RateLimit-*) and retry guidance.

Path parameters

Request body

Resubmit requires the complete purchase invoice JSON — send the full document payload again, not a partial patch. Include every root-level field you would send on create; corrected values replace the stored document. Omitting fields may clear or reset them.

Request fields

Fields in the request JSON. Rows are ordered RequiredConditionalOptional. The Required column shows whether each field is always needed, sometimes needed, or optional. Object fields have dedicated sections further down this page.

Do not send: accounting_customer_party — the API sets the customer from {profileId}. Do not send calculated or system fields (id, org_id, document_sequence, totals, meta_info, etc.) — those appear in the response only.

FieldTypeRequiredDescriptionValidation
issue_datestring
Required
The date when the invoice was issued.Format yyyy-MM-dd; must be a valid calendar date.
invoice_type_codestring
Required
The type of invoice.Must be 389 (Self-billed Invoice). The API overrides any other value to 389.
due_datestring
Required
The date when payment is due.Format yyyy-MM-dd.
profile_execution_idstring
Required
Invoice transaction type code.Exactly 8 characters; each character 0 or 1. See Profile execution ID section for details.
document_currency_codestring
Required
ISO 4217 alpha-3 currency code for all monetary amounts (e.g. AED).Must be a valid ISO 4217 code. See Get Currency Names and Codes section for details. For non-AED documents, see Non-AED invoices.
accounting_supplier_partyobject
Required
The supplier party for the invoice.Must be a valid party object. See Supplier party object section for details.
document_linesarray
Required
Invoice line items.At least one line required. See Document line object section for details.
document_numberstring
Conditional
The invoice number as displayed on the document.Required when auto-numbering is disabled; auto-generated when auto-numbering is enabled and omitted. Must be unique when provided. Recommendation: provide explicitly for ERP reconciliation.
tax_point_datestring
Conditional
Tax point date per UAE VAT Law.If present: format yyyy-MM-dd; must be on or before issue_date. See Tax point date (UAE VAT) section for details.
tax_currency_codestring
Conditional
ISO 4217 currency code for tax amounts.Required when document_currency_code is not AED—must be AED. See Non-AED invoices section for details.
tax_exchange_rateobject
Conditional
Exchange rate for tax calculation in AED.Required when document_currency_code is not AED. See Tax exchange rate object section for details.
buyer_customer_partyobject
Conditional
Beneficiary ID (UBL BTAE-01).Required for Free Trade Zone (FTZ).
seller_supplier_partyobject
Conditional
Principle ID (UBL BTAE-14).Required for Disclosed Agent Billing.
deliveryobject
Conditional
Delivery details.Required for Exports.
payment_meansarray
Conditional
Payment method.Required unless Deemed supply applies.
invoice_periodobject
Conditional
Billing period.Required for Summary invoice. See Invoice period object section for details.
issue_timestring
Optional
The time when the invoice was issued.Format HH:mm:ss. Gulf Standard Time (GST, UTC+4). Default when omitted: 00:00:00.
accounting_coststring
Optional
Accounting cost center identifier.Free text.
buyer_referencestring
Optional
Buyer reference for the invoice.Free text.
notestring
Optional
Additional notes on the invoice.Free text.
payee_partyobject
Optional
Party to whom payment should be made.See Payee party object section for details.
tax_representative_partyobject
Optional
Tax representative party.See Tax representative party object section for details.
order_referenceobject
Optional
Purchase order reference.See Order reference object section for details.
billing_referencearray
Optional
References to other billing documents.See Billing reference object section for details.
despatch_document_referenceobject
Optional
Despatch document reference.See Despatch document reference object section for details.
receipt_document_referenceobject
Optional
Receipt document reference.See Receipt document reference object section for details.
statement_document_referenceobject
Optional
Statement document reference.If present: id required.
originator_document_referenceobject
Optional
Originating document reference.If present: id required.
contract_document_referenceobject
Optional
Contract reference.See Contract document reference object section for details.
project_referenceobject
Optional
Project reference.See Project reference object section for details.
chargesarray
Optional
Document-level charges.See Charge object section for details.
allowancesarray
Optional
Document-level allowances.See Allowance object section for details.
payment_termsobject
Optional
Payment terms.See Payment terms object section for details.
prepaid_amountnumber
Optional
Prepaid amount applied.Typically non-negative.
payable_rounding_amountnumber
Optional
Rounding adjustment.May be positive or negative.
document_sourcestring
Optional
Origin system identifier.Defaults to API when omitted.
attachmentsarray
Optional
Supporting documents.See Attachment object (request) section for details. Max 8 MB body.
Conditional field rules
ConditionAffected fieldsRule
Free Trade Zone (FTZ)buyer_customer_party.idRequired
Summary invoiceinvoice_periodstart_date, end_date, description required
Disclosed Agent Billingseller_supplier_party.idRequired
ExportsdeliveryRequired with delivery_location.address
Not deemed supplypayment_meansAt least one required
document_currency_codeAEDtax_currency_code, tax_exchange_rateSee Non-AED invoices
Response meta_info object

The meta_info field is an object with the following attributes:

FieldTypeRequiredDescriptionValidation
peppol_statusobject
Optional
Peppol participant/FTA processing status.Response-only; see Peppol status object below.
Peppol status object

The meta_info.peppol_status field is an object with the following attributes:

FieldTypeRequiredDescriptionValidation
participant_statusstring
Optional
Participant-level processing status.Must be one of the status values listed below.
fta_statusstring
Optional
FTA submission/processing status.Must be one of the status values listed below.
overall_statusstring
Optional
Overall Peppol processing status.Must be one of the status values listed below.
validation_resultsarray
Optional
Validation details/errors returned during processing.Response-only list; empty when there are no validation issues.
Status values
ValueMeaning
VALIDATION_FAILEDThe received document failed validation checks.
PENDINGProcessing is in progress.
APPROVEDThe document is accepted.
REJECTEDThe document is processed but rejected.
Client processing guidance:
  1. Treat overall_status as the primary state for workflow decisions.

  2. Use participant_status and fta_status as stage-specific diagnostics for UI and support logs.

  3. If overall_status is PENDING, keep the invoice in a processing state and poll/re-fetch later.

  4. If overall_status is APPROVED, mark the Peppol flow as successful and continue normal downstream actions.

  5. If overall_status is REJECTED or VALIDATION_FAILED, stop submission-dependent actions and surface the failure to users.

  6. When validation_results is not empty, display user-friendly error summaries from text, and retain flag, reasonCode, location, and test for troubleshooting.

  7. participant_status or fta_status can be null in early/failed validation stages; do not treat null alone as success or failure.

Invoice type codes

CodeNameWhen to use
380Commercial invoiceStandard purchase invoice.
389Self-billed invoiceBuyer issues on behalf of supplier.
480Out of scope of taxSupply outside UAE VAT scope.
Profile execution ID

profile_execution_id is an 8-character binary flag string (each character 0 or 1) that encodes UAE special transaction types. Use 00000000 for a standard purchase invoice with no special types.

payment_means is optional and may be omitted or null.

Transaction scenarios follow PINT AE. Set the corresponding position to 1 when the supply matches that scenario; leave it 0 otherwise. Multiple flags may be 1 when more than one scenario applies.

Ready-to-use payloads for each scenario are on the purchase invoice Examples page.

Transaction typePositionWhen to useWhen the flag is 1
Free trade zone1XXXXXXXSupply of goods or services in a free trade zone.Set buyer_customer_party.id (Beneficiary TIN). See Buyer customer party object section for details. Example payload: Free Trade Zone.
Deemed supplyX1XXXXXXSupply of goods or services without consideration.No additional mandatory fields beyond standard validation.
Profit Margin SchemeXX1XXXXXSupply of goods under the profit margin scheme.No additional mandatory fields beyond standard validation.
Summary invoiceXXX1XXXXTaxable person makes more than one supply of goods or services to the same person in the same calendar month.Set invoice_period.start_date, invoice_period.end_date, and invoice_period.description. Example payload: Summary invoice.
Continuous SupplyXXXX1XXXSupply of goods and/or services made on a recurrent basis.No additional mandatory fields beyond standard validation.
Agent billingXXXXX1XXAgent who is a registrant makes a supply on behalf of the principal.Set seller_supplier_party.id (Principle ID TRN) for disclosed agent billing payloads. See Seller supplier party object section for details. Example payload: Disclosed agent billing.
Supply through e-commerceXXXXXX1XSupply of goods or services via e-commerce.Include delivery with delivery_location.address when required by your business scenario. See Delivery object section for details.
ExportsXXXXXXX1Supply of goods or services outside the country.Include delivery with delivery_location.address. accounting_customer_party.party_tax_scheme is optional when the buyer is non-UAE. See Delivery object section for details. Example payload: Export transaction with delivery.

*Each position X is 0 or 1 depending on your scenario.*

ScenarioTypical profile_execution_idExamples page
Standard invoice (baseline)00000000Minimal purchase invoice
Free Trade Zone10000000Free Trade Zone
Summary invoiceXXX1XXXX (flag in position 4)Summary invoice
Disclosed agent billingXXXXX1XX (flag in position 6)Disclosed agent billing
Export deliveryXXXXXXX1Export transaction with delivery
System behavior

  • VAT rules are applied according to UAE VAT law

  • Invoice status and transmission events are tracked

Party VAT and registration validation

RuleDescription
Time fieldsWhen sending issue_time or delivery_time, use Gulf Standard Time (GST, UTC+4). Format HH:mm:ss.
Party VAT (party_tax_scheme)Optional for UAE supplier parties. If either company_id or tax_scheme is provided, both are required with UAE VAT format
VAT/TRN format15 digits; starts with 1 and ends with 03
Supplier registrationOptional. If scheme_agency_id is provided, company_id is required and type-specific rules apply. See The Supplier party object section for details.
UAE supplier TINRequired for UAE suppliers. Exactly 10 characters, must start with 1
UAE supplier telephoneRequired for UAE suppliers

See The Supplier party object section for details.

Request

POST /api/purchase-invoices/{business_profile_id}
Authorization: Bearer {jwt_token}
X-MARMIN-VERSION: 20260507
Response

Status code: 201 Created

Returns the created purchase invoice with all request fields echoed plus system-generated and calculated fields.

Response body fields
FieldTypeSourceDescription
idstringSystem ProvidedPrimary identifier for the document (UUID). Automatically generated when the invoice is created.
org_idstringSystem ProvidedUnique identifier of the organization that owns this invoice.
document_sequencelongSystem ProvidedSequential number for the invoice within your organization. Used for compliance and tracking.
allowance_total_amountnumberCalculatedTotal of all document-level allowances.
charge_total_amountnumberCalculatedTotal of all document-level charges.
line_extension_amountnumberCalculatedSum of all line amounts before charges, allowances, and taxes. UBL 2.1 LineExtensionAmount.
tax_exclusive_amountnumberCalculatedLine extension plus charges minus allowances, before tax. UBL 2.1 TaxExclusiveAmount.
tax_amountnumberCalculatedAggregated VAT amount in document currency. UBL 2.1 TaxTotal.
tax_amount_in_aednumberCalculatedTotal tax amount converted to AED.
tax_inclusive_amountnumberCalculatedTax exclusive amount plus total tax. UBL 2.1 TaxInclusiveAmount.
payable_amountnumberCalculatedFinal amount due. UBL 2.1 PayableAmount.
payable_amount_in_aednumberCalculatedFinal amount payable in AED.
total_item_allowancesnumberCalculatedTotal of all line-level allowances.
total_item_chargesnumberCalculatedTotal of all line-level charges.
total_taxable_amountnumberCalculatedTotal taxable amount.
total_non_taxable_amountnumberCalculatedTotal non-taxable amount.
tax_breakdownarrayCalculatedTax amounts by tax category (S, Z, E, O, AE, N) and rate. UBL 2.1 TaxSubtotal.
is_phase2_documentbooleanSystem ProvidedWhether the document is Peppol-enabled (Phase 2).
meta_infoobjectSystem ProvidedAdditional metadata. See Meta info object below.
Document lines in response

Each line includes calculated fields: base_amount, net_amount, total_amount, tax_amount. The price object in the response contains price_amount (instead of base_amount in the request).

Charges and allowances
  • Document-level charges and allowances are applied after line item totals

  • Line-level charges and allowances are applied per line item

  • All charges and allowances require a tax_category for proper VAT calculation

See the right panel for complete response JSON.

Attachments

You may include an optional attachments array in the create request. Each item must include file_name, file_type, and Base64-encoded file_content. Allowed MIME types and validation rules are documented under Attachment object (request) on the Create a purchase invoice page.

ConcernBehavior
Payload sizeEntire POST body must not exceed 8MB (see 413 below).
Create responseEach attachment in the 201 body includes id, file_name, and file_type only.
System PDFOn successful create, the API adds invoice.pdf (application/pdf) for the rendered document in addition to any attachments you send.
DownloadUse Download attachment with the id from the response to fetch file bytes.
Error responses

400 Bad Request

Invalid request parameters or validation failed.

{
  "errors": {
    "message": "Business profile not found with id: {business_profile_id}"
  }
}

For validation errors, the response includes field-specific errors:

{
  "errors": {
    "profile_execution_id": "Profile execution ID is mandatory",
    "issue_date": "Issue date is mandatory"
  }
}
401 Unauthorized

Authentication required or invalid token.

{
  "errors": {
    "message": "Authentication required or invalid token"
  }
}
413 Request Entity Too Large

The request payload size exceeds the allowed limit of 8MB.

{
  "errors": {
    "message": "Payload size should not exceed 8MB"
  }
}
500 Internal Server Error

An error occurred while processing the request.

{
  "errors": {
    "message": "An error occurred"
  }
}
Resubmit condition

Resubmit is allowed only when:

  • meta_info.peppol_status.overall_status = VALIDATION_FAILED

Attachments

Each attachments item requires file_name, file_type, and Base64 file_content. On resubmit:

  • Omit attachments to keep the existing attachment set unchanged.

  • Send attachments to replace the full set (client uploads are re-persisted).

The response attachments array includes id, file_name, and file_type only. The create-only 8MB payload limit does not apply to this PUT endpoint.

Error responses

StatusDescription
400 Bad RequestResubmit is not allowed while the document is still pending.
401 UnauthorizedAuthentication required or invalid token.
404 Not FoundPurchase invoice not found, or business profile not found.
500 Internal Server ErrorAn error occurred while processing the request.
{
  "errors": {
    "document_status": "document status is still pending state you cannot resubmit"
  }
}
{
  "errors": {
    "message": "Business profile not found with id: {business_profile_id}"
  }
}
Next