Home/财务与会计/norwegian-accounting-automation
N

norwegian-accounting-automation

by @ahdragev
3.5(0)

This is an AI agent skill designed to automate the accounting processes of Norwegian small businesses. It achieves invoice processing, expense booking, bank transaction reconciliation, attachment uploading, and VAT processing by integrating Fiken, Folio API, and Google Workspace CLI. It is suitable for businesses that need to simplify Norwegian accounting, improve efficiency, reduce manual operations, handle Fiken/Folio transactions, or integrate Gmail invoice search.

Norwegian AccountingFikenFolioBookkeepingAutomationGitHub
Installation
git clone https://github.com/ahdrage/norwegian-accounting-automation.git
compare_arrows

Before / After Comparison

1
Before

Accounting tasks for small businesses in Norway involve manually processing invoices, entering expenses, reconciling bank transactions, and filing VAT returns. This is time-consuming, prone to errors, and requires frequent switching between platforms like Fiken, Folio, and Gmail.

After

With the help of AI agents, invoices are automatically processed, expenses are booked, smart reconciliation is performed, and VAT is managed, significantly reducing manual operations, improving accuracy, and making accounting processes more efficient and seamless.

description SKILL.md


name: norwegian-accounting-automation description: Automate Norwegian small business accounting using the Fiken API, Folio API, and Google Workspace CLI (gws). Covers processing invoices, matching bank transactions, booking expenses/sales, uploading attachments, and reconciling card charges. Use when the user wants to automate bookkeeping, process invoices, book expenses in Fiken, handle Folio card transactions, reconcile Vipps settlements, or integrate Gmail invoice search with accounting software. Also use when the user mentions Fiken, Folio, Norwegian accounting, regnskap, or MVA/VAT handling for Norwegian businesses.

Norwegian Accounting Automation

Automate bookkeeping for Norwegian small businesses (ENK/AS) using:

  • Fiken — accounting software with REST API
  • Folio — business card/banking with REST API
  • Google Workspace CLI (gws) — search Gmail for invoices and download attachments

Prerequisites

1. Install Google Workspace CLI

npm install -g @googleworkspace/cli
gws auth setup
gws auth login -s gmail

See gws-setup.md for detailed setup instructions.

2. Fiken API Key

  1. Log in to fiken.no
  2. Go to Innstillinger → API and create an API token
  3. Store as FIKEN_API_KEY in .env

Base URL: https://api.fiken.no/api/v2 Auth: Authorization: Bearer {FIKEN_API_KEY} Docs: https://api.fiken.no/api/v2/docs

3. Folio API Key

  1. Log in to the Folio app
  2. Go to Settings → Integrations → API and create a key
  3. Store as FOLIO_API_KEY in .env

Base URL: https://api.folio.no/v2 Auth: Authorization: Bearer {FOLIO_API_KEY} Docs: https://dev.api.folio.no/v2/api

4. Find your Fiken company slug

curl -s "https://api.fiken.no/api/v2/companies" \
  -H "Authorization: Bearer $FIKEN_API_KEY" | jq '.[].slug'

Use this slug in all Fiken API paths: /companies/{slug}/...

Core Concepts

Norwegian VAT Types in Fiken

vatTypeWhen to usenetPricevat
HIGHNorwegian 25% VATgross / 1.25gross - net
HIGH_FOREIGN_SERVICE_DEDUCTIBLEForeign SaaS/services (USD/EUR/GBP). Triggers reverse charge.Full NOK amount0
NONEForeign physical goods (import VAT via customs)Full NOK amount0

All amounts in Fiken are in øre (1 NOK = 100). E.g. 438.00 NOK = 43800.

VAT types are account-specific. HIGH_FOREIGN_SERVICE_DEDUCTIBLE is NOT valid on all accounts. Check error messages for valid codes per account.

Common Fiken Expense Accounts

AccountDescriptionTypical use
6553ProgramvareSaaS subscriptions
7321ReklamekostnadMarketing/advertising
6100Frakt/transportShipping costs
6800KontorrekvisitaOffice/packaging supplies
1200Inventar/eiendelerPhysical equipment
4300VarekjøpGoods for resale
3000SalgsinntektRevenue

Payment Accounts

CodeDescription
2062Privatutlegg (personal card reimbursement)
1920:NNNNNBusiness bank card (Folio-kort, DNB, etc.)
1960:NNNNNPayment service accounts (Vipps, Stripe)

Find your payment account codes:

curl -s "https://api.fiken.no/api/v2/companies/{slug}/bankAccounts" \
  -H "Authorization: Bearer $FIKEN_API_KEY" | jq '.[] | {name, accountCode}'

Workflows

A. Book an expense (purchase) in Fiken

curl -X POST "https://api.fiken.no/api/v2/companies/{slug}/purchases" \
  -H "Authorization: Bearer $FIKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2025-01-02",
    "kind": "cash_purchase",
    "currency": "NOK",
    "paid": true,
    "lines": [{
      "description": "Service name (2025-01-02)",
      "account": "6553",
      "netPrice": 36970,
      "vat": 0,
      "vatType": "HIGH_FOREIGN_SERVICE_DEDUCTIBLE"
    }],
    "paymentAccount": "1920:10003",
    "paymentDate": "2025-01-02"
  }'

For Norwegian vendors with 25% VAT:

{
  "lines": [{
    "account": "6553",
    "netPrice": 15920,
    "vat": 3980,
    "vatType": "HIGH"
  }]
}

B. Attach a PDF to a Fiken purchase

curl -X POST "https://api.fiken.no/api/v2/companies/{slug}/purchases/{purchaseId}/attachments" \
  -H "Authorization: Bearer $FIKEN_API_KEY" \
  -F "filename=Invoice.pdf" \
  -F "attachToSale=true" \
  -F "file=@/path/to/Invoice.pdf;type=application/pdf"

C. Fetch and filter Folio card transactions

curl -s "https://api.folio.no/v2/events?startDate=2025-01-01&endDate=2025-06-30" \
  -H "Authorization: Bearer $FOLIO_API_KEY"

The v2 REST API does not provide a search parameter on /events. Fetch by date range and filter client-side.

Prefer structured event fields such as cardAuthorization.merchantName when available. Use transactions[].description as a fallback for parsing card suffix, currency, foreign amount, and exchange rate.

D. Upload attachment to a Folio event

Folio uses raw binary body — NOT multipart/form-data:

curl -X POST "https://api.folio.no/v2/events/{eventId}/attachments" \
  -H "Authorization: Bearer $FOLIO_API_KEY" \
  -H "Content-Type: application/pdf" \
  -H 'Content-Disposition: attachment; filename="Invoice.pdf"' \
  --data-binary @/path/to/Invoice.pdf

E. Mark a Folio event complete

curl -X POST "https://api.folio.no/v2/events/{eventId}/complete" \
  -H "Authorization: Bearer $FOLIO_API_KEY"

Returns HTTP 202 (Accepted).

F. Search Gmail for invoices

gws gmail users messages list --params '{"userId":"me","q":"vendor invoice 2025"}'
gws gmail users messages get --params '{"userId":"me","id":"MSG_ID","format":"full"}'
gws gmail users messages attachments get \
  --params '{"userId":"me","messageId":"MSG_ID","id":"ATTACHMENT_ID"}'

Gmail attachment data is URL-safe base64: replace - with +, _ with /, add = padding before decoding.

G. Create a sale in Fiken (e.g. Vipps settlements)

curl -X POST "https://api.fiken.no/api/v2/companies/{slug}/sales" \
  -H "Authorization: Bearer $FIKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2025-11-06",
    "kind": "external_invoice",
    "currency": "NOK",
    "lines": [{
      "description": "Vipps settlement 2005799",
      "netPrice": 159920,
      "vat": 39980,
      "account": "3000",
      "vatType": "HIGH"
    }],
    "customerId": 12345678,
    "paid": true,
    "totalPaid": 199900,
    "paymentAccount": "1960:10002",
    "paymentDate": "2025-11-06"
  }'

totalPaid is required when paid: true.

Automation Strategies

For detailed patterns on batch processing, dedup logic, and vendor classification, see automation-patterns.md.

For complete API reference and gotchas, see api-reference.md.

Batch booking card charges

The most powerful automation: classify all card charges by vendor keyword, determine the correct Fiken account and VAT type, and create purchases in bulk.

  1. Fetch all Folio events for the period (split into H1/H2 for large sets)
  2. Filter for card charges (outgoing, identified by card number prefix)
  3. Classify each by vendor keyword → Fiken account + VAT type
  4. Fetch existing Fiken purchases to avoid duplicates (match on date + amount)
  5. Create cash_purchase for each unbooked charge with paymentAccount matching the bank card account
  6. Handle duplicate amounts on same date by counting occurrences

Folio → Fiken Superføring

When you create a Fiken purchase/sale with the correct paymentAccount, it auto-matches the bank line in Fiken's "Superføring" (bank feed matching). This eliminates manual bank reconciliation.

Personal card expenses (Privatutlegg)

For business expenses paid with a personal card, book in Fiken with paymentAccount: "2062". This creates a liability that can be reimbursed.

forumUser Reviews (0)

Write a Review

Effect
Usability
Docs
Compatibility

No reviews yet

Statistics

Installs1
Rating3.5 / 5.0
Version
Updated2026年4月8日
Comparisons1

User Rating

3.5(0)
5
0%
4
0%
3
0%
2
0%
1
0%

Rate this Skill

0.0

Compatible Platforms

🔧Claude Code

Timeline

Created2026年4月8日
Last Updated2026年4月8日