Skip to content

Magnetic HQ Order XML

This XML format represents accounts documents in Magnetic HQ. Purchase orders and tax invoices use the same format. Only the collection name differs.

Tasks

Minimal XML Sample

This sample changes the status of an existing tax invoice.

<?xml version="1.0" encoding="utf-8"?>
<MagneticHQData>
  <TaxInvoices>
    <TaxInvoice>
      <Account>
        <Id>54067397</Id>
        <Status>PAID</Status>
      </Account>
    </TaxInvoice>
  </TaxInvoices>
</MagneticHQData>

For purchase orders, use PurchaseOrders and PurchaseOrder in place of TaxInvoices and TaxInvoice.

PurchaseOrder / TaxInvoice

XML Field Example Field Type Input Description
ExternalId PO1001 string Optional Your own reference for the document. Stored in the Zynk truth database against the Magnetic HQ ID after import. Not sent to Magnetic HQ.
Account Account Required The document header.
LineItems collection of LineItem Optional The document lines.

Account

The Account element is the document header.

XML Field Example Field Type Input Description
Id 54067397 long Optional Magnetic HQ document ID. Supply it to update an existing document.
Version 4 long Read only Magnetic HQ record version.
Name New Filming string Optional Document name.
RefCode 0001 string Optional Document number.
Status ISSUED string Optional Document status. See Statuses.
Description string Optional Description.
OrderCode PO-4471 string Optional Order code, for example the customer's purchase order number.
PaymentTerms 30 Days string Optional Payment terms.
Billed 100.0 decimal Read only Amount billed.
Tax 14.0 decimal Read only Tax amount.
Cost 500.0 decimal Read only Net amount in the base currency.
CurrencyCost 500.0 decimal Read only Net amount in the document currency.
Margin 500.0 decimal Read only Margin in the base currency.
CurrencyMargin 500.0 decimal Read only Margin in the document currency.
TotalCost 570.0 decimal Read only Gross amount in the base currency.
CurrencyTotalCost 570.0 decimal Read only Gross amount in the document currency.
CreatedDate 1447740000000 long Read only When the document was created. See Data Types.
IssuedDate 0 long Optional When the document was issued. 0 if not issued yet.
Company Company Optional The customer (tax invoices) or supplier (purchase orders).
DeliveryAddress string Optional Delivery address, as a single text field.
Contact Contact Optional The contact at the company.
Grouping Grouping Optional The job the document belongs to.
Owner User Optional The Magnetic HQ user who owns the document.
Discount 0.0 decimal Optional Discount.
Archive false bool Optional Whether the document is archived.
Tag string Optional Tag.
HideQtyAndCost false bool Optional Hide line quantities and costs on the printed document.
ModifiedDate 1503412276262 long Read only When the document was last changed. Used by the export tasks to pick up changes.
Currency GBP string Optional Document currency.
ExchangeRate 1.0 decimal Optional Exchange rate to the base currency.

Statuses

Purchase Orders Tax Invoices
DRAFT DRAFT
ISSUED ISSUED
CHECKED PAID
INVOICED PART_PAID
PART_INVOICED CREDITED
CANCELLED PART_CREDITED
CANCELLED

The export tasks return documents in a single status, chosen in the task's Status setting.

Contact

The Contact element has the same fields as KeyPerson.

Grouping

The Grouping element is the Magnetic HQ job the document belongs to. On import, only Id is needed.

XML Field Example Field Type Input Description
Id 54012001 long Required Magnetic HQ job ID.
Version 3 long Read only Magnetic HQ record version.
Code JOB0042 string Read only Job code.
Name Spring Campaign string Read only Job name.
Extra string Read only Extra information.
Access string Read only Access level.
CreatedDate 1447740000000 long Read only When the job was created.
ModifiedDate 1447740000000 long Read only When the job was last changed.
SignedDate 0 long Read only When the job was signed.
StartDate 0 long Read only Job start date.
EndDate 0 long Read only Job end date.
ExternalReference string Read only Reference held in Magnetic HQ.
Signed true bool Read only Whether the job is signed.
Status string Read only Job status.
Amount 5000.0 decimal Read only Job value.
MonthlyAmount 0.0 decimal Read only Monthly value.
PercentageComplete 40 int Read only Percentage complete.
Complete false bool Read only Whether the job is complete.
Archive false bool Read only Whether the job is archived.
Tag string Read only Tag.
TaskStatuses string Read only Task statuses.
ContactCompany Company Read only The job's company.
Contact Contact Read only The job's contact.
Owner User Read only Job owner.
Author User Read only Job author.
Winner User Read only User who won the job.
DefaultBillable string Read only Default billable setting.
TimeWarning string Read only Time budget warning.
GrossProfitFinancialWarning string Read only Gross profit warning.
NetProfitFinancialWarning string Read only Net profit warning.
Duration 0 int Read only Duration.
CustomFields collection Export only See Custom Fields.

LineItem

Each LineItem element inside LineItems is one document line.

XML Field Example Field Type Input Description
Id 54067400 long Read only Magnetic HQ line ID.
Version 1 long Read only Magnetic HQ record version.
ItemType ItemType Optional The item type (product or service) on the line.
RefCode DES-01 string Optional Line reference.
Unit 2.0 decimal Optional Quantity.
Cost 250.0 decimal Optional Unit cost.
Markup 0.0 decimal Optional Markup.
Ordering 1 int Optional Line position on the document.
TaxType VAT string Optional Tax type.
Notes Design work string Optional Line description.
DocType string Optional Document type the line belongs to.

ItemType

The ItemType element is a Magnetic HQ item type.

XML Field Example Field Type Input Description
Id 53090801 long Required Magnetic HQ item type ID.
Version 2 long Read only Magnetic HQ record version.
Name Design string Read only Item type name.
ExternalName Design string Read only Name shown on documents.
Cost 125.0 decimal Read only Default cost.
TaxType VAT string Read only Default tax type.
Markup 0.0 decimal Read only Default markup.
Description string Read only Description.
Company Read only The Magnetic HQ account the item type belongs to.
BillableByDefault true bool Read only Whether the item is billable by default.
Archive false bool Read only Whether the item type is archived.
ArchivedDate 0 long Read only When the item type was archived.
CreatedDate 1446813531845 long Read only When the item type was created.

Matching Existing Documents

If Account/Id is supplied and Magnetic HQ finds the document, it is updated. If not, a new document is created. There is no lookup by RefCode or Name.

Warning

Do not rely on ExternalId to find documents imported before. Supply Account/Id instead.

Fields Changed on Update

When an existing document is updated, only Status, RefCode and Description are changed. All other fields, including line items, are left as they are in Magnetic HQ.

Complete XML Sample

<?xml version="1.0" encoding="utf-8"?>
<MagneticHQData>
  <TaxInvoices>
    <TaxInvoice>
      <ExternalId>INV1001</ExternalId>
      <Account>
        <Name>Spring Campaign Design</Name>
        <RefCode>0001</RefCode>
        <Status>DRAFT</Status>
        <Description>Design work for the spring campaign</Description>
        <OrderCode>PO-4471</OrderCode>
        <PaymentTerms>30 Days</PaymentTerms>
        <IssuedDate>0</IssuedDate>
        <Company>
          <Id>53126881</Id>
        </Company>
        <DeliveryAddress>1 High Street, Leeds, LS1 1AA</DeliveryAddress>
        <Contact>
          <Id>53126884</Id>
        </Contact>
        <Grouping>
          <Id>54012001</Id>
        </Grouping>
        <Owner>
          <Id>53090727</Id>
        </Owner>
        <Discount>0.0</Discount>
        <Archive>false</Archive>
        <HideQtyAndCost>false</HideQtyAndCost>
        <Currency>GBP</Currency>
        <ExchangeRate>1.0</ExchangeRate>
      </Account>
      <LineItems>
        <LineItem>
          <ItemType>
            <Id>53090801</Id>
          </ItemType>
          <RefCode>DES-01</RefCode>
          <Unit>2.0</Unit>
          <Cost>250.0</Cost>
          <Markup>0.0</Markup>
          <Ordering>1</Ordering>
          <TaxType>VAT</TaxType>
          <Notes>Design work</Notes>
        </LineItem>
      </LineItems>
    </TaxInvoice>
  </TaxInvoices>
</MagneticHQData>