How to create a Bean type programmatically?
Bean uses ctools plugins for its types. Per the docs:

/**
 * Implements hook_bean_types().
 *
 * Beans uses ctools plugins to define the block types.
 * All plugin files must be registered in the .info file.
 */
function hook_bean_types() {
  $plugins = array();
  $plugins['plugin_key'] = array(
    'label' =&gt; t('Title'),
    'description' =&gt; t('Description'),
    // This is optional. Set it to TRUE if you do not want the plugin to be
    // displayed in the UI.
    'abstract' =&gt; FALSE,
    'handler' =&gt; array(
      'class' =&gt; 'ClassName',
      'parent' =&gt; 'bean',
      // This should be pointing to the path of your custom bean plugin module.
      'path' =&gt; drupal_get_path('module', 'example_bean') . '/plugins',
      // Class files should be named accordingly in order to support ctools
      // autoloading procedures.
      'file' =&gt; 'ClassName.class.php',
    ),
  );
  return $plugins;
}