Example: invoices

A complete example from start to finish: your webshop should create invoices in e-conomic, without ever holding an e-conomic key and without knowing how e-conomic wants its invoices.

1. Connect e-conomic

An admin opens Services → Add a service, picks e-conomic from the gallery and signs in to the company's e-conomic agreement. OneAPI makes one harmless call to check the sign-in before saving it, encrypted. Nobody sees it again, and the webshop never gets it.

2. Design the Invoice

Under Artifacts, create an Invoice with the fields your company needs. The lines are their own artifact, InvoiceLine, part of the invoice, so an invoice and its lines are written in one call. (Or import "Accounting basics for e-conomic" from the artifact library and get all of this ready-made.)

FieldKindNote
customer_nametext, requiredCopied onto the invoice
customer_address, customer_city, customer_zipcode, customer_countrytextThe country decides the VAT zone
invoice_datedate, required
invoice_currencychoice: DKK, EUR, SEK, NOK, USDApplies to every line
invoice_linesparts: InvoiceLineDescription, price, count, discount %; total is read-only

3. Describe what "create" does

e-conomic wants a customer number on every invoice, but the webshop only knows the customer's name. So the create flow first looks the customer up, creates them if they're new, and then creates the invoice:

The create flow: find the customer; if not found, create the customer; then create the draft invoice and answer with the new id. POST /api/invoice/ Find the customer e-conomic · List customers by name and zip Found? no yes Create the customer e-conomic · Create customer Create the draft invoice e-conomic · with its lines, in one call 201 · invoice_id 17 links 17 → draft 2041, customer 118
The flow as OneAPI's flowchart shows it. Each blue box is one call on a service; the decision uses whether the previous step found anything. Power users can edit the same flow as a short script.

Each call has a mapping table: what to send, and where it comes from. Most rows point at an Invoice field; others come from an earlier step, a setting of the service, a fixed value or a formula.

e-conomic's draft invoicecomes from
date←Invoice field invoice_date
currency←Invoice field invoice_currency
customer.customerNumber←the customer found or created in an earlier step
recipient.name←Invoice field customer_name
lines[].unitNetPrice←for each line: invoiceline_price
paymentTerms.paymentTermsNumber←the e-conomic service's setting (set once by an admin)

Before publishing, Test this flow runs the whole flow for real and shows every step on the flowchart: what was sent, what came back, which way each decision went. A good run can be saved as a test case, and OneAPI replays it whenever the flow changes.

4. Give the webshop a key

Under People & API keys, create an API key called "Webshop" and give it W WRITE on Invoice (which includes R READ). The key is shown once. The webshop can now create and read invoices, and nothing else: to the webshop, Customer and every other artifact don't exist.

5. The webshop calls the API

POST /api/invoice/
Authorization: Bearer oa_svc_…
Content-Type: application/json

{
  "customer_name": "Nordic Bikes ApS",
  "customer_zipcode": "8000",
  "customer_country": "Denmark",
  "invoice_date": "2026-11-08",
  "invoice_currency": "DKK",
  "invoice_lines": [
    { "invoiceline_description": "Service, 2 hours", "invoiceline_price": 450, "invoiceline_count": 2 }
  ]
}

OneAPI answers in the Invoice's own shape, with the ids it issued:

201 Created

{
  "invoice_id": 17,
  "customer_name": "Nordic Bikes ApS",
  …
  "invoice_lines": [
    { "invoiceline_id": 18, "invoiceline_description": "Service, 2 hours",
      "invoiceline_price": 450, "invoiceline_count": 2, "invoiceline_total": 900 }
  ]
}

Behind the scenes OneAPI made three calls on e-conomic, and the call log shows them under the webshop's name:

CallerCallService callsStatus
Webshop (API key)POST /api/invoice/ GET /customers · 200
POST /customers · 201
POST /invoices/drafts · 201
201 · 640 ms

The log records that these calls happened, never the customer's name or the amounts.

6. Later: a new accounting system

A year on, the company moves from e-conomic to Dinero. Without OneAPI, the webshop's integration is rewritten. With OneAPI, an admin adds Dinero and changes the Invoice's flows to call it. The webshop keeps calling POST /api/invoice/ with the same fields and the same key, and doesn't notice.

The webshop keeps calling the Invoice API; only the flow behind it changes from e-conomic to Dinero. Webshop unchanged Invoice /api/invoice/ · same fields e-conomic before Dinero after
Only the flows behind the Invoice change. Callers, keys and permissions stay as they are.