Skip to content

Use Typeform to prototype forms in fast iteration loops, then export the definition (input titles, input types, answer options, validations, logic jumps, etc.) to JSON for use in your development enviroment

License

Notifications You must be signed in to change notification settings

renderghost/typeform-definition-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typeform Logic Extractor

What is this?

A CLI tool to extract Typeform form content and logic into a usable text format.

Designing conditional forms is hard and no dedicated prototyping tools exist. Typeform is a great form designer, but you can't easily extract the definition and use it in your development workflow.

This script allows you to prototype and test your form using Typeform — create inputs, logic jumps, validation and more — then export the definition to JSON for use in your web or mobile app development workflow.

What It Does

Extracts ALL available question data from Typeform forms, including:

  • High-level form configuration
  • Question titles and descriptions
  • Input types (multiple choice, short text, email, etc.)
  • Answer options and validation configuration
  • Logic jumps and conditional branching

Important

This tool extracts form structure and logic, NOT user submission data or styling/customization data.

Features

  • Simple single-file Node.js implementation
  • Clean command line interface, with helpful flags
  • Progress messages
  • Robust error handling and helpful error messages
  • Raw JSON output saved to timestamped folders
  • Works with public forms (no 'Personal Access Token' needed)
  • Optional API token support for private forms, configurable via .env file

Requirements

  • Node.js 14.0.0 or higher

Installation

1. Clone this repository

git clone https://github.com/renderghost/typeform-logic-extractor.git
cd typeform-logic-extractor

2. Install dependencies

npm install

3. Create .env file

Important

Public forms work without using a 'Personal Access Token' token! You only need .env when working with private forms

cp .env.example .env

Get a 'Personal Access Token'

  1. Log in to your Typeform account
  2. Go to Account Settings → Personal tokens
  3. Or visit: https://admin.typeform.com/user/tokens
  4. Click "Generate a new token"
  5. Copy the token and add it to your .env file
TYPEFORM_API_TOKEN=your_token_here

Usage

URL Format

Note

Typeform URL pattern: https://mysite.typeform.com/to/abc123

Basic Usage

node typeform-extractor.js --url https://mysite.typeform.com/to/abc123

With Options

# Custom output directory
node typeform-extractor.js --url https://yoursite.typeform.com/to/abc123 --output ./my-forms

# Verbose mode with detailed progress
node typeform-extractor.js --url https://yoursite.typeform.com/to/abc123 --verbose

# Compact JSON format
node typeform-extractor.js --url https://yoursite.typeform.com/to/abc123 --format json

CLI Options

Flag Alias Description Default
--url -u Typeform URL (required) -
--output -o Output directory ./outputs
--format -f Output format: json or pretty pretty
--verbose - Show detailed progress messages false
--help -h Show help message -
--version -v Show version number -

Output

Progress Report

⟳ Parsing Typeform URL...
✓ Form ID: abc123
⟳ Fetching form data from Typeform API...
✓ Form data retrieved successfully
ℹ Form title: Customer Feedback Survey
ℹ Total fields: 5
ℹ Logic jumps: 2
⟳ Creating output directory...
✓ Output directory: ./outputs/2025-11-26_12-30-45
⟳ Saving form definition...
✓ Saved: form-definition.json
⟳ Generating metadata...
✓ Saved: form-metadata.json

✓ Extraction complete!
ℹ Files saved to: ./outputs/2025-11-26_12-30-45

JSON Files

The tool creates a timestamped subfolder in your output directory and saves two files:

form-definition.json

Contains the complete raw response from the Typeform API, including:

  • Form ID, title, and settings
  • All fields (questions) with their configurations
  • Logic jumps and conditional branching rules
  • Variables and hidden fields
  • Theme and workspace information

form-metadata.json

Contains extraction metadata:

  • Extraction timestamp
  • Form ID and source URL
  • Form title
  • Total number of fields
  • Logic jump information
  • List of field types used

Future Enhancements

  • Package manager support (Homebrew, npm global install)
  • Additional output formats (CSV, Markdown)

Reference

This tool uses the Typeform Create API to retrieve form definitions.

[!NOTE] Endpoint GET https://api.typeform.com/forms/{form_id}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Use Typeform to prototype forms in fast iteration loops, then export the definition (input titles, input types, answer options, validations, logic jumps, etc.) to JSON for use in your development enviroment

Topics

Resources

License

Stars

Watchers

Forks