Glitnir - A Perl module for accessing Glitnir's online bank system


    use Glitnir;
    my $glitnir = Glitnir->new();
    # Get a hash listing today's exchange rates
    my $rates = $glitnir->exchange_rates();
    # Logging in
    $glitnir->login($user, $password);      # Set programmatically
    $glitnir->login($glitnir->get_login()); # .. or ask the user
    # Get a reference to a hash of accounts
    my $accounts = $glitnir->accounts();
    # Get a reference to a list of transactions
    my $transactions = $glitnir->transactions('543-26-12345');
    # Same, for a credit-card (note the format may differ from bank statmens)
    my $transactions = $glitnir->transactions('5432100000199909');


This object provides a high-level programmatic interface to Glitnir's online mobile banking system at

Obviously if Glitnir change their HTML then some or all of this stuff might break. I've attempted to document the current state of things within this module, however exploring the returned values using something like Data::Dumper and building lots of sanity checks into any programs using this code is highly recommended.


This module uses perl ``exceptions'' to handle errors, any method may die if it fails to do it's job. Use eval blocks to catch such errors and handle them if you don't want errors to abort your programs:

   eval { # try
      ... some Glitnir calls ...
   if ($@) # catch
      ... handle exception $@ ...


This module was written by Bjarni R. Einarsson, <>.

It may be freely used and distributed under the same terms as Perl itself.


$glitnir = Glitnir->new( %args );
Creates a new object representing a session within the Glitnir home-banking system. Optionally, it can attempt to resume a previous session. Arguments:
  debug => 1         # Enable debug messages to STDERR
  base => $hostname  # Use something other than
  session_id => $s   # Resume an old session
  logged_in => 1     # Assume resumed session is logged-in

$rates = $glitnir->exchange_rates();
Returns a reference to a hash of exchange rates. The structure returned looks like this:
        "USD" => {
            Kaup => 74,
            Sala => 75,
        "EUR" => {

Note that the actual currencies described and the field names within each hash are determined by the info in the Glitnir mobile bank.

The code is written so that if they reorder their tables, it shouldn't matter as long as the columns retain the same descriptive headings (Kaup, Sala, ...). However, if they change their naming conventions all bets are off.

$transactions = $glitnir->transactions( $account );
Returns a reference to a list of transactions rates. The $account variable may either be one of the hashes returned by the accounts() method, or an account number (123-45-657000).

The structure returned looks like this:

        [ "", "description", "amount"  ],
        [ "", "description", "amount"  ],

Note that column order is determined by the Glitnir mobile bank, if they reorder things, programs using this method will break.

$accounts = $glitnir->accounts();
Returns a reference to a hash of hashes, each hash describing a bank account or credit-card.

The structure returned looks like this:

        "012-23-4234" => {
            nr       => "012-23-4234",    
            url      => $path_to_transaction_page,
            name     => $some_text,
            balance  => $number,
            currency => $currency_TLA,

Credit-card accounts have neither a balance nor a currency and their identifying numbers are 16 digits long.

($user, $pass) = $glitnir->get_login();
Prompts the user for a username and password, using stty to keep from echoing the password back. Useful for interactive console apps, other programs will want to implement their own.

$glitnir->login($user, $pass);
Attempts to log the user on to the Glitnir mobile bank. Should die on failure.

$session_id = $glitnir->session_id();
Returns the current session ID. This can be saved and then passed back to the new() method later (but not too late) to resume a session.

$logged_in = $glitnir->logged_in();
Returns non-zero if the session has successfully logged in.

Check whether a session is still alive and valid. Will die if it isn't.

Clear the internal cache, forcing all queries to refresh data from the Glitnir site.

Close the current session, clear the cache and create a new one.


This is all a hack and any changes to the mobile bank may break the functionality of this module and programs based on it. However, I hope it is a useful proof-of-concept demonstrating to the bank how useful (and simple!) it would be to provide a proper web-service API to 3rd party developers.

Transferring money between accounts is not supported. This is a deliberate omission, as I currently have no use for such features and don't intend to assist cyber-criminals by writing their tools for them.