Reports API | Norwegian Financial Reporting | Snapbooks Documentation

Reports API

The Reports API provides endpoints for generating various financial reports following Norwegian accounting standards. Reports can be generated in multiple formats including Excel, HTML, and PDF.

Available Reports

Balance Sheet Report

Generates a balance sheet report showing assets, liabilities, and equity at a specific date.

GET /api/v2/reports/balance-sheet

Query Parameters:

  • client_account_id (required): Integer ID of the client account
  • report_date (required): Date in YYYY-MM-DD format
  • dimensions (optional): Array of dimension tuples [type, id] for filtering
  • include_drafts (optional): Boolean to include draft journal entries
  • format (required): One of “excel”, “html”, “pdf”

JSON Response Format:

{
  "rows": [
    {
      "grouping": {
        "level_1_code": "1000",
        "level_1_name": "Assets",
        "level_2_code": "1100",
        "level_2_name": "Current Assets",
        "level_3_code": "1110",
        "level_3_name": "Cash and Bank"
      },
      "account_code": "1110",
      "account_name": "Bank Account",
      "balance": 50000.00
    }
  ]
}

Income Statement Report

Generates an income statement (profit & loss) report for a specified period.

GET /api/v2/reports/income-statement

Query Parameters:

  • client_account_id (required): Integer ID of the client account
  • date_from (required): Start date in YYYY-MM-DD format
  • date_to (required): End date in YYYY-MM-DD format
  • dimensions (optional): Array of dimension tuples [type, id] for filtering
  • include_drafts (optional): Boolean to include draft journal entries
  • format (required): One of “excel”, “html”, “pdf”

JSON Response Format:

{
  "rows": [
    {
      "grouping": {
        "level_1_code": "3000",
        "level_1_name": "Revenue",
        "level_2_code": "3100",
        "level_2_name": "Sales Revenue",
        "level_3_code": "3110",
        "level_3_name": "Product Sales"
      },
      "account_code": "3110",
      "account_name": "Product Sales",
      "period_debit_movements": {
        "1": 10000.00,  // January
        "2": 12000.00,  // February
        "3": 15000.00   // March (etc. for each month in period)
      }
    }
  ]
}

VAT Report

Generates a VAT (MVA) report for Norwegian tax reporting.

GET /api/v2/reports/vat

Query Parameters:

  • client_account_id (required): Integer ID of the client account
  • from_date (required): Start date in YYYY-MM-DD format
  • to_date (required): End date in YYYY-MM-DD format
  • format (required): One of “html”, “pdf”

JSON Response Format:

{
  "rows": [
    {
      "tax_code": {
        "code": "3",
        "description": "Purchases 25% VAT",
        "tax_rate": 25,
        "category": "input"
      },
      "base_debit_amount": 40000.00,
      "base_credit_amount": 0.00,
      "tax_debit_amount": 10000.00,
      "tax_credit_amount": 0.00,
      "posted_tax_debit_amount": 10000.00,
      "posted_tax_credit_amount": 0.00,
      "reconciliation_debit_amount": 0.00,
      "reconciliation_credit_amount": 0.00,
      "reportable_tax_amount": -10000.00,
      "reportable_acquisition_tax_amount": 0.00,
      "discrepancy_note": null
    }
  ]
}

Trial Balance Report

Generates a trial balance showing all account balances.

GET /api/v2/reports/trial-balance

Query Parameters:

  • client_account_id (required): Integer ID of the client account
  • date_from (required): Start date in YYYY-MM-DD format
  • date_to (required): End date in YYYY-MM-DD format
  • account_codes (optional): Array of account codes to filter
  • dimensions (optional): Array of dimension tuples [type, id] for filtering
  • include_drafts (optional): Boolean to include draft journal entries
  • format (required): One of “excel”, “html”, “pdf”

JSON Response Format:

{
  "rows": [
    {
      "grouping": {
        "level_1_code": "1000",
        "level_1_name": "Assets",
        "level_2_code": "1100",
        "level_2_name": "Current Assets",
        "level_3_code": "1110",
        "level_3_name": "Cash and Bank"
      },
      "account_code": "1110",
      "account_name": "Bank Account",
      "incoming_balance": 40000.00,
      "debit": 15000.00,
      "credit": 5000.00,
      "outgoing_balance": 50000.00,
      "relation_type": "bank_account",
      "relation_id": 1,
      "relation_name": "Main Bank Account"
    }
  ]
}

General Ledger Report

Generates a detailed general ledger report showing all transactions.

GET /api/v2/reports/general-ledger

Query Parameters:

  • client_account_id (required): Integer ID of the client account
  • start_date (required): Start date in YYYY-MM-DD format
  • end_date (required): End date in YYYY-MM-DD format
  • account_codes (optional): Array of account codes to filter
  • dimensions (optional): Array of dimension tuples [type, id] for filtering
  • include_drafts (optional): Boolean to include draft journal entries
  • format (required): One of “excel”, “html”, “pdf”

SAF-T Financial Export

Generates a SAF-T Financial export following Norwegian tax authority requirements.

GET /api/v2/reports/saf-t-financial

Query Parameters:

  • client_account_id (required): Integer ID of the client account
  • start_date (required): Start date in YYYY-MM-DD format
  • end_date (required): End date in YYYY-MM-DD format

Response: Returns a ZIP file containing the SAF-T XML file following the Norwegian SAF-T Financial format specification.

Response Formats

Excel Format

Returns an Excel workbook with the following features:

  • Formatted headers and footers
  • Grouped data with subtotals
  • Number formatting following Norwegian standards
  • Multi-language support (Norwegian/English)

HTML Format

Returns an HTML document with:

  • Responsive table layout
  • Formatted numbers and dates
  • Hierarchical data presentation
  • Print-friendly styling

PDF Format

Returns a PDF document with:

  • Professional layout
  • Page headers and footers
  • Table of contents for longer reports
  • Print-optimized formatting

Error Responses

{
    "error": "string",
    "message": "string",
    "details": {}
}

Common error codes:

  • 400 Bad Request: Invalid parameters
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Client account not found
  • 422 Unprocessable Entity: Invalid date range

Relaterte artikler