got api keygen working. Still need set_permissions fixed.