Export and Verify a Migration Sample
Use the same checks after a CLI import or an API import. This walkthrough retrieves the three mapped documents, checks their metadata and downloaded bytes, and writes a small export connecting the original source IDs to the resulting files.
1. Use the original manifest and read credentials
Keep the prepared sample directory from Prepare a Migration Sample. Set FORMKIQ_API_URL, FORMKIQ_SITE_ID, and FORMKIQ_TOKEN as shown in the API walkthrough. If you used the CLI to import, you still need JWT API access for this verification script.
The verification command uses document and attribute reads and content downloads. It makes no API writes, creates no definitions, and deletes no documents. The actor needs permission to read the sample records and all required attributes.
2. Download and verify the three mapped records
Choose a new local output directory:
python3 migration_sample.py verify-export \
--directory migration-sample \
--output migration-sample-export
For each manifest record, the script:
- Retrieves the document by its mapped UUID and selected site.
- Compares its path and content type with the original manifest.
- Follows every attribute continuation token, including after an empty page, and compares the required sample values.
- Requests a content URL and downloads it without forwarding the API JWT.
- Compares the downloaded byte count and SHA-256 digest with the source file.
- Writes the bytes under the UUID filename and records the returned document details and attributes.
The script rechecks the local source files against their original manifest checksums before making requests. It does not derive local output paths from document names, and it does not save temporary signed URLs.
3. Review the export
On success, the output directory contains three <documentId>.bin files and manifest.json. The manifest records the site, batch, verification time, original source IDs, document IDs, content checksums, document details, and retrieved attributes.
Verified and exported 3 sample records. Other repository records were not inventoried.
A final manifest is written only after all three records pass. An interrupted or failed run can leave partial files without a manifest; inspect that directory before choosing a new output location for a retry. Existing output directories are never overwritten by this command.
This proves the selected sample's current content and required metadata matched at retrieval time. It does not establish repository completeness, point-in-time consistency during active writes, or correct access for other users. Test allowed and denied access with representative roles and verify any configured processing separately.
4. Separate configuration export from document export
The CLI can complement API content extraction by exporting selected site configuration. For example, with a configured CLI profile and a release supporting configuration export:
fk --export-config --attributes \
--site-id "$FORMKIQ_SITE_ID" \
--output migration-sample-config
This exports the selected site's attribute definitions, including definitions outside the sample if present. It does not export document content, document attribute values, identity-provider users, or a complete deployment. Other configuration types depend on the backend features and CLI release. Review the CLI configuration export reference.
| Task | Tool used here | Scope |
|---|---|---|
| Verify migrated content and metadata | API sample script | Three prepared IDs, current bytes, document details, and attributes |
| Export selected configuration | CLI | Explicitly selected configuration types for the site |
| Move a complete agreed collection to another system | An export and destination-import process | Full inventory, required versions and artifacts, identity/access mappings, governance, historical evidence, reconciliation, and cutover |
For a complete exit migration, follow Migrating Out of FormKiQ. Inventory every site and page in scope, handle deleted records as agreed, and include the required versions, artifacts, and evidence. The sample verifier does not perform that inventory.
Retain evidence and clean up
Keep the source manifest, CSVs, checkpoint, export manifest, and command results with the pilot's acceptance record. Decide separately which source fields should become typed attributes, how historical dates and identifiers will be retained, and how the destination will enforce access and governance.
Remove sample documents and definitions only after identifying the exact sample IDs and confirming that no other records depend on those definitions. Do not use a site-wide delete to clean up a sample in a shared site. A successful export does not authorize retiring the source repository; agree that decision through the cutover and rollback plan.