Reporting API v1 - how to map your invoice data
Introduction
The invoice-headers and invoice-rows endpoints return the data for all invoices relevant to your organization.
If you are a customer, then these will only be your incoming invoices.
If you are a reseller, then these will be your incoming and outgoing invoices.
If you are a multi-tier reseller or a distributor, then these will be your incoming and outgoing invoices, as well as the incoming and outgoing invoices of organizations in your sales channel.
Each invoice has two IDs associated – providerOrganizationId – the organization sending the invoice and consumerOrganizationId – the organization receiving the invoice.
In this article:
- Identifying incoming and outgoing invoices
- Finding your cost and revenue for each subscription
- Mapping invoices to the reconciliation file
Identifying incoming & outgoing invoices
Your incoming invoices are those where the consumerOrganizationId is your organization ID. Your outgoing invoices are those where the providerOrganizationId is your organization ID.
In most cases your organization ID will be the same as the requesterId used to access all Reporting APIs.
Finding your cost and revenue for each subscription
By matching your incoming and outgoing invoices, you can calculate the cost and revenue for each subscription – and from there, your margin.
To do this:
1. Pull your invoice data
Get invoice headers and invoice rows for the same period, for both your incoming and outgoing invoices (see the previous section).
2. Match the invoices
Preferred method: If vendorInvoiceRowId is returned, use it to match records directly:
incoming.vendorInvoiceRowId = outgoing.vendorInvoiceRowId
Fallback method: If vendorInvoiceRowId is not returned, match records using all of the following fields together:
- subscriptionId
- chargeStartDate
- chargeEndDate
- chargeType
- quantity
- meterId
- offerId
- invoiceDate
- invoiceHeader.invoiceSource
(i.e. incoming.subscriptionId = outgoing.subscriptionId, incoming.chargeStartDate = outgoing.chargeStartDate, and so on for each field above.)
3. Calculate revenue and cost
- incoming.TotalPrice = your revenue
- outgoing.TotalPrice = your cost
4. Check your currencies
Make sure incoming and outgoing invoices use the same currency. If they don’t, apply a currency exchange rate before calculating margin or other metrics.
About invoiceSource = VendorApi
Records with invoiceSource = VendorApi (and their related invoice-rows) represent raw vendor invoice lines. These are reference data only – the original vendor charges mapped into the AppXite platform structure – and this method is now considered legacy.
For retrieving raw vendor invoice lines, we recommend using this API instead:
Reporting API v1 – viewing vendor invoice row JSONs via API
With this endpoint, vendorInvoiceRowId matches directly to the vendorInvoiceRowId returned by the Reporting API invoice-rows endpoint, giving you accurate mapping between Reporting API invoice rows and the corresponding raw vendor incoming invoice lines.
Mapping invoices to the reconciliation file
Many of the key values from the invoice recon file can be mapped to the Reporting API. Please see the mapping below.
|
Recon file column |
API endpoint |
Column |
|
Invoice number |
/invoices/invoice-headers |
invoiceNumber |
|
Invoice Status |
/invoices/invoice-headers |
invoiceStatus |
|
Invoice date |
/invoices/invoice-headers |
invoiceDate |
|
Invoice provider |
/invoices/invoice-headers |
providerName |
|
Invoice receiver |
/invoices/invoice-headers |
consumerName |
|
Receiver status |
/organizations or /organizations/details |
status |
|
Receiver ERP ID |
/organizations/details |
erpId |
|
Receiver country |
/organizations/addresses |
country |
|
Receiver VAT number |
/organizations/details |
vatNumber |
|
Contract number |
/contracts |
contractNumber |
|
Contract reference number |
/contracts |
contractReferenceNumber |
|
Reference contact person |
/organizations/contacts |
firstName + lastName |
|
Billing address |
/organizations/addresses |
|
|
Account manager |
/organizations/contacts |
firstName + lastName |
|
Account manager email |
/organizations/contacts |
firstName + lastName |
|
Comments |
n/a |
n/a |
|
Reseller name |
/organizations or /organizations/details |
fullName / shortName |
|
Customer name |
/organizations or /organizations/details |
fullName / shortName |
|
Offer name |
/invoices/invoice-rows |
offerName |
|
Subscription name |
/invoices/invoice-rows |
subscriptionName |
|
Subscription start date |
/subscriptions |
startDate |
|
Subscription end date |
/subscriptions |
endDate |
|
Charge start date |
/invoices/invoice-rows |
chargeStartDate |
|
Charge end date |
/invoices/invoice-rows |
chargeEndDate |
|
Charge type |
/invoices/invoice-rows |
chargeType |
|
Currency |
/invoices/invoice-rows |
currency |
|
Customer Unit price |
/invoices/invoice-rows (where invoice receiver = customer) |
unitPrice |
|
Customer quantity |
/invoices/invoice-rows (where invoice receiver = customer) |
quantity |
|
Customer total price |
/invoices/invoice-rows (where invoice receiver = customer) |
totalPrice |
|
Vendor |
/subscriptions |
vendorName |
|
Reseller Unit Price |
/invoices/invoice-rows (where invoice receiver = reseller) |
unitPrice |
|
Reseller Total Price |
/invoices/invoice-rows (where invoice receiver = reseller) |
quantity |
|
Reseller Currency |
/invoices/invoice-rows (where invoice receiver = reseller) |
totalPrice |
|
Support Currency |
n/a |
n/a |
|
Support Total Price |
n/a |
n/a |
|
Retail Price Source |
n/a |
n/a |
|
Retail Price Markup |
n/a |
n/a |
|
Customer Markup |
n/a |
n/a |
|
Price Markup Start Date |
n/a |
n/a |
|
Invoice Provider Id |
/invoices/invoice-headers |
providerOrganizationId |
|
Invoice Receiver Id |
/invoices/invoice-headers |
consumerOrganizationId |
|
Reseller Id |
/subscriptions |
resellerOrganizationId |
|
Customer Id |
/subscriptions |
customerOrganizationId |
|
Offer Id |
/subscriptions |
offerId |
|
Vendor Offer Id |
/offers |
offerExternalId |
|
Subscription Id |
/invoices/invoice-rows |
subscriptionId |
|
Vendor Subscription Id |
/subscriptions |
subscriptionExternalId |
|
Custom offer properties |
/offers/properties |
key + value |
|
Buyer Purchase Order Number |
n/a |
n/a |
|
Seller Purchase Order Number |
n/a |
n/a |
|
Invoice Reference # |
/invoices/invoice-headers |
invoiceReferenceNumber |
Summary
The invoice-headers and invoice-rows endpoints return Invoice data relevant to your Organization, with incoming Invoices where consumerOrganizationId matches your Organization ID, and outgoing Invoices where providerOrganizationId matches your Organization ID.
To find Cost and Revenue for each Subscription, retrieve both incoming and outgoing Invoices for the same period and map them using vendorInvoiceRowId if available, or by matching subscriptionId, chargeStartDate, chargeEndDate, chargeType, quantity, meterId, offerId, invoiceDate, and invoiceSource.
The incoming totalPrice represents your Revenue, while the outgoing totalPrice represents your Cost — allowing you to calculate margins when currencies match, or after applying exchange rates.
Note that vendorInvoiceRowId may correctly be NULL in certain expected cases (e.g., invoiceSource = VendorApi, chargeType = UsageFee, or rows generated via Billing Logic rather than Invoice Parsing). This does not indicate a data error.
For retrieving raw vendor invoice lines, use the dedicated "Reporting API v1 - viewing vendor invoice row JSONs via API" endpoint instead.
Many key values from the Invoice reconciliation file can be mapped to the Reporting API for data integration.
Was this article helpful?
Articles in this section
- Reporting API v1 - overview
- Reporting API v2 - overview
- Reporting API v1/v2 - requesting access
- Reporting API v1 - data model
- Reporting API v1 - how to map your invoice data
- Reporting API v1 - detailed invoice line items
- Reporting API v2 - Invoice Taxes
- Reporting API v1 - how to identify organizations in your sales channel
- Reporting API v1 - currencies within the invoices
- Reporting API v1 - preview invoices in status 'New'
Add comment
Please sign in to leave a comment.