KeePass supports automation through
KPScript By writing a program with a .kps extension in C#
Found an example in the form of
//
// KeePass Master Key information
//
CompositeKey inputKey = new CompositeKey();
inputKey.AddUserKey(new KcpPassword(cmdArgs["pw"]));
inputKey.AddUserKey(new KcpKeyFile(cmdArgs["keyfile"]));
//
// Set up connection to Master KeePass Database
//
IOConnectionInfo iocInput = new IOConnectionInfo();
iocInput.Path = cmdArgs["infile"];
PwDatabase pwInputDB = new PwDatabase();
pwInputDB.Open( iocInput, inputKey, null);
But I can't find any documentation on these classes/methods to write my own program. Maybe someone can help?