norwegian-accounting-automation
这是一个AI代理技能,旨在自动化挪威小型企业的会计流程。它通过集成Fiken、Folio API和Google Workspace CLI,实现发票处理、费用预订、银行交易对账、附件上传及增值税处理。适用于需要简化挪威会计、提高效率、减少人工操作、处理Fiken/Folio事务或整合Gmail发票搜索的企业。
git clone https://github.com/ahdrage/norwegian-accounting-automation.gitBefore / After 效果对比
1 组挪威小型企业会计工作需手动处理发票、录入费用、核对银行交易和增值税申报,耗时且易出错,需频繁切换Fiken、Folio和Gmail等平台。
借助AI代理,自动处理发票、预订费用、智能对账和增值税管理,显著减少人工操作,提高准确性,使会计流程更高效、无缝。
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
- Log in to fiken.no
- Go to Innstillinger → API and create an API token
- Store as
FIKEN_API_KEYin.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
- Log in to the Folio app
- Go to Settings → Integrations → API and create a key
- Store as
FOLIO_API_KEYin.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
| vatType | When to use | netPrice | vat |
|---|---|---|---|
HIGH | Norwegian 25% VAT | gross / 1.25 | gross - net |
HIGH_FOREIGN_SERVICE_DEDUCTIBLE | Foreign SaaS/services (USD/EUR/GBP). Triggers reverse charge. | Full NOK amount | 0 |
NONE | Foreign physical goods (import VAT via customs) | Full NOK amount | 0 |
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
| Account | Description | Typical use |
|---|---|---|
6553 | Programvare | SaaS subscriptions |
7321 | Reklamekostnad | Marketing/advertising |
6100 | Frakt/transport | Shipping costs |
6800 | Kontorrekvisita | Office/packaging supplies |
1200 | Inventar/eiendeler | Physical equipment |
4300 | Varekjøp | Goods for resale |
3000 | Salgsinntekt | Revenue |
Payment Accounts
| Code | Description |
|---|---|
2062 | Privatutlegg (personal card reimbursement) |
1920:NNNNN | Business bank card (Folio-kort, DNB, etc.) |
1960:NNNNN | Payment 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.
- Fetch all Folio events for the period (split into H1/H2 for large sets)
- Filter for card charges (outgoing, identified by card number prefix)
- Classify each by vendor keyword → Fiken account + VAT type
- Fetch existing Fiken purchases to avoid duplicates (match on date + amount)
- Create
cash_purchasefor each unbooked charge withpaymentAccountmatching the bank card account - 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.
forum用户评价 (0)
发表评价
暂无评价
统计数据
用户评分
为此 Skill 评分