# Convert SAP Ariba & Coupa cXML Orders & Invoices to JSON

**Use case:** 

Parse SAP Ariba, Coupa, and Jaggaer cXML OrderRequest (Purchase Orders) and InvoiceDetailRequest documents into ERP-ready JSON line items. Automatically redacts Ariba SharedSecrets, strips external DTD headers offline, and audits exact Decimal line/tax/total math.

## Input

```json
{
  "operation_mode": "parse_and_audit_cxml",
  "cxml_documents": [
    "<!DOCTYPE cXML SYSTEM \"http://xml.cxml.org/schemas/cXML/1.2.061/cXML.dtd\">\n<cXML payloadID=\"1732440001.99812@ariba.acme.com\" timestamp=\"2026-11-24T09:15:00Z\" xml:lang=\"en-US\">\n  <Header>\n    <From><Credential domain=\"NetworkID\"><Identity>AN01000998877</Identity></Credential></From>\n    <To><Credential domain=\"DUNS\"><Identity>081466849</Identity></Credential></To>\n    <Sender><Credential domain=\"NetworkID\"><Identity>AN01000000001</Identity><SharedSecret>SUPER_SECRET_TOKEN_99</SharedSecret></Credential><UserAgent>Ariba SN 1.2</UserAgent></Sender>\n  </Header>\n  <Request deploymentMode=\"production\">\n    <OrderRequest>\n      <OrderRequestHeader orderID=\"PO-2026-88410\" orderDate=\"2026-11-24T09:00:00Z\" type=\"new\">\n        <Total><Money currency=\"USD\">1250.00</Money></Total>\n        <ShipTo><Address addressID=\"PLANT-01\"><Name xml:lang=\"en\">Acme Manufacturing Austin</Name><PostalAddress><DeliverTo>Receiving Dock B</DeliverTo><Street>400 Industrial Pkwy</Street><City>Austin</City><State>TX</State><PostalCode>78701</PostalCode><Country isoCountryCode=\"US\">United States</Country></PostalAddress></Address></ShipTo>\n        <BillTo><Address addressID=\"AP-HQ\"><Name xml:lang=\"en\">Acme Accounts Payable</Name><PostalAddress><Street>100 Congress Ave</Street><City>Austin</City><State>TX</State><PostalCode>78701</PostalCode><Country isoCountryCode=\"US\">United States</Country></PostalAddress></Address></BillTo>\n        <PaymentTerm payInNumberOfDays=\"30\"/>\n        <Extrinsic name=\"Department\">MRO-OPERATIONS</Extrinsic>\n      </OrderRequestHeader>\n      <ItemOut quantity=\"10\" lineNumber=\"10\" requestedDeliveryDate=\"2026-12-02\">\n        <ItemID><SupplierPartID>VLV-SS316-2IN</SupplierPartID><BuyerPartID>ACM-009812</BuyerPartID></ItemID>\n        <ItemDetail>\n          <UnitPrice><Money currency=\"USD\">125.00</Money></UnitPrice>\n          <Description xml:lang=\"en\">2-Inch 316 Stainless Ball Valve NPT</Description>\n          <UnitOfMeasure>EA</UnitOfMeasure>\n          <Classification domain=\"UNSPSC\">40141607</Classification>\n        </ItemDetail>\n      </ItemOut>\n    </OrderRequest>\n  </Request>\n</cXML>"
  ],
  "invoice_json_payloads": [],
  "strict_math_audit": true,
  "mask_contact_pii": false,
  "max_items": 25
}
```

## Output

```json
{
  "document_type": {
    "label": "Doc Type",
    "format": "string"
  },
  "document_id": {
    "label": "Document / PO / Invoice ID",
    "format": "string"
  },
  "related_order_id": {
    "label": "Ref PO ID",
    "format": "string"
  },
  "from_identity": {
    "label": "From (ANID/DUNS)",
    "format": "string"
  },
  "to_identity": {
    "label": "To (ANID/DUNS)",
    "format": "string"
  },
  "currency": {
    "label": "CCY",
    "format": "string"
  },
  "subtotal_amount": {
    "label": "Subtotal",
    "format": "string"
  },
  "tax_amount": {
    "label": "Tax",
    "format": "string"
  },
  "total_or_due_amount": {
    "label": "Total / Due",
    "format": "string"
  },
  "line_count": {
    "label": "Lines",
    "format": "integer"
  },
  "is_valid": {
    "label": "Valid",
    "format": "boolean"
  },
  "math_reconciled": {
    "label": "Math OK",
    "format": "boolean"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The cXML SAP Ariba & Coupa Order, ASN & Invoice JSON Bridge Actor is ready to run with the inputs already set for "Convert SAP Ariba & Coupa cXML Orders & Invoices to JSON". [Sign up or log in](https://console.apify.com/create-task-from-example/XENDuGmSycfcPFbzf) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Convert SAP Ariba & Coupa cXML Orders & Invoices to JSON" task

The cXML SAP Ariba & Coupa Order, ASN & Invoice JSON Bridge Actor will start running based on the input automatically. You can also change all the input fields, like operation mode, raw cxml xml documents, and more, to match your specific use case.

### 3. Receive the "Convert SAP Ariba & Coupa cXML Orders & Invoices to JSON" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as doc type, document / po / invoice id, ref po id, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Convert SAP Ariba & Coupa cXML Orders & Invoices to JSON" task via API](https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md).

## FAQ

### Are SAP Ariba <SharedSecret> credentials redacted automatically?

Yes. Any <SharedSecret> token inside the cXML <Header> is redacted to [REDACTED] in RAM before dataset output so credentials never leak into downstream logs.

### Does it fail on <!DOCTYPE cXML SYSTEM 'http://xml.cxml.org/...'> headers?

No. Standard external cXML DTD declarations are stripped safely offline while malicious XXE <!ENTITY declarations are blocked immediately at $0 charge.

### Does it verify line-item Qty * UnitPrice against order and invoice totals?

Yes. Exact Decimal arithmetic audits every line item against Subtotal, Tax, Shipping, Discount, and Total/Due amounts.

## About this Actor

This example demonstrates how to use [cXML SAP Ariba & Coupa Order, ASN & Invoice JSON Bridge](https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
