diff --git a/CRM/FormProcessor/BAO/FormProcessorInstance.php b/CRM/FormProcessor/BAO/FormProcessorInstance.php
index b019f22ecf1a193e13537d7fbd68a72b9b68bb4a..c1822d53eccc5cd2ff1c16662b0575aeab4e6234 100644
--- a/CRM/FormProcessor/BAO/FormProcessorInstance.php
+++ b/CRM/FormProcessor/BAO/FormProcessorInstance.php
@@ -236,7 +236,24 @@
     return $status;
   }
 
-  /**
+   /**
+    * Returns the status of the form processor.
+    * @See CRM_FormProcessor_Status for possible values.
+    *
+    * @param string $formProcessorName
+    *   The name of the form processor.
+    * @param integer $status
+    *   The new status
+    */
+   public static function setStatus($formProcessorName, $status) {
+     $sql = "UPDATE `civicrm_form_processor_instance` SET `status` = %1 WHERE `name` = %2";
+     $params[1] = array($status, 'Integer');
+     $params[2] = array($formProcessorName, 'String');
+     CRM_Core_DAO::executeQuery($sql, $params);
+
+   }
+
+   /**
    * Updates the status and source file of the form processor.
    * @See CRM_FormProcessor_Status for possible status values.
    *
diff --git a/api/v3/FormProcessorInstance/Export.php b/api/v3/FormProcessorInstance/Export.php
index 08d760994ef1d17a3dae42bc3665461e38a6ffdf..6cb5903e1efc5f62cd320b598fd46ed0665330b3 100644
--- a/api/v3/FormProcessorInstance/Export.php
+++ b/api/v3/FormProcessorInstance/Export.php
@@ -3,7 +3,7 @@
 use CRM_FormProcessor_ExtensionUtil as E;
 
 /**
- * FormProcessorInstance.Validatename API
+ * FormProcessorInstance.Export API
  *
  * @param array $params
  * @return array API result descriptor
@@ -14,12 +14,24 @@ use CRM_FormProcessor_ExtensionUtil as E;
 function civicrm_api3_form_processor_instance_export($params) {
   $exporter = new \Civi\FormProcessor\Exporter\ExportToJson();
   $returnValues = array();
-  $returnValues['export'] = $exporter->export($params['id']);
+  $returnValues['export'] = (array) $exporter->export($params['id']);
+  if (!empty($params['to_file'])) {
+    // set export date
+    $data = $returnValues['export'];
+    $data['export_timestamp'] = date('Y-m-d H:i:s');
+    $data['export_system_url'] = CIVICRM_UF_BASEURL;
+
+    // if the path is a directory, use the name
+    if (is_dir($params['to_file'])) {
+      $params['to_file'] = $params['to_file'] . DIRECTORY_SEPARATOR . $data['name'] . '.json';
+    }
+    file_put_contents($params['to_file'], json_encode($data, JSON_PRETTY_PRINT));
+  }
   return $returnValues;
 }
 
 /**
- * FormProcessorInstance.Validatename API specification (optional)
+ * FormProcessorInstance.Export API specification (optional)
  * This is used for documentation and validation.
  *
  * @param array $spec description of fields supported by this API call
@@ -32,4 +44,10 @@ function _civicrm_api3_form_processor_instance_export_spec(&$spec) {
     'type' => CRM_Utils_Type::T_INT,
     'api.required' => true
   );
+  $spec['to_file'] = array(
+      'title' => E::ts('To File'),
+      'type' => CRM_Utils_Type::T_STRING,
+      'description' => E::ts('If a file path is given, the JSON configuration will be written there.'),
+      'api.required' => false
+  );
 }
\ No newline at end of file
diff --git a/api/v3/FormProcessorInstance/Import.php b/api/v3/FormProcessorInstance/Import.php
index 1928538584f5cb5fddeec15e2dcd5130eb64ac88..969db2d1026d45cb781dcca730999996665b7ffa 100644
--- a/api/v3/FormProcessorInstance/Import.php
+++ b/api/v3/FormProcessorInstance/Import.php
@@ -24,7 +24,45 @@ function _civicrm_api3_form_processor_instance_Import_spec(&$spec) {
 function civicrm_api3_form_processor_instance_Import($params) {
   $exporter = new \Civi\FormProcessor\Exporter\ExportToJson();
   $returnValues = array();
-  $returnValues['import'] = $exporter->importFromExtensions();
-  $returnValues['is_error'] = 0;
+
+  if (empty($params['file'])) {
+    // default behaviour
+    $returnValues['import'] = $exporter->importFromExtensions();
+    $returnValues['is_error'] = 0;
+
+  } else {
+    // caller provided a file to import:
+    $data = json_decode(file_get_contents($params['file']), true);
+    if (!empty($data['name'])) {
+      $status = \CRM_FormProcessor_BAO_FormProcessorInstance::getStatus($data['name']);
+      if ($status != \CRM_FormProcessor_Status::IN_CODE) {
+        // it's already overridden -> reset so we can override again
+        \CRM_FormProcessor_BAO_FormProcessorInstance::setStatus($data['name'], \CRM_FormProcessor_Status::IN_CODE);
+      }
+      $returnValues['import'] = $exporter->import($data, $params['file']);
+      $returnValues['import']['original_status'] = $status; // we might have adjusted it, so we know better
+      $returnValues['is_error'] = 0;
+
+    } else {
+      $returnValues = civicrm_api3_create_error("The file '{$params['file']}' doesn't contain a form processor specification.");
+    }
+  }
   return $returnValues;
 }
+
+/**
+ * FormProcessorInstance.Import API specification (optional)
+ * This is used for documentation and validation.
+ *
+ * @param array $spec description of fields supported by this API call
+ * @return void
+ * @see http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
+ */
+function _civicrm_api3_form_processor_instance_export_spec(&$spec) {
+  $spec['file'] = array(
+      'title' => E::ts('Specification File'),
+      'type' => CRM_Utils_Type::T_STRING,
+      'description' => E::ts('If a file path is given, the JSON configuration will be imported from there'),
+      'api.required' => false
+  );
+}