Segment Reporting [Abstract] Schedule of Segment Reporting Information, by Segment [Table] Schedule of Segment Reporting Information, by Segment [Table] Consolidation Items [Axis] Consolidation Items [Axis] Consolidation Items [Domain] Consolidation Items [Domain] Operating Segments Operating Segments [Member] Corporate Corporate, Non-Segment [Member] Segments [Axis] Segments [Axis] Segments [Domain] Segments [Domain] Consumer Operations Consumer Operations [Member] Consumer Operations [Member] Drug Development Drug Development [Member] Drug Development [Member] Segment Reporting Information [Line Items] Segment Reporting Information [Line Items] Number of reportable segments Number of Reportable Segments Total revenue Revenue, Net Interest income, net Interest Income, Operating Loss from operations Operating Income (Loss) Equity [Abstract] Restricted common stock activity Schedule of Share-based Compensation, Restricted Stock and Restricted Stock Units Activity [Table Text Block] Shares reserved for future issuance Schedule of Stock by Class [Table Text Block] Statement of Stockholders' Equity [Abstract] Statement [Table] Statement [Table] Class of Stock [Axis] Class of Stock [Axis] Class of Stock [Domain] Class of Stock [Domain] Series A Preferred Stock Series A Preferred Stock [Member] Series B Preferred Stock Series B Preferred Stock [Member] Equity Components [Axis] Equity Components [Axis] Equity Component [Domain] Equity Component [Domain] Preferred Stock Preferred Stock [Member] Common Stock Common Stock [Member] Additional Paid-In Capital Additional Paid-in Capital [Member] Accumulated Other Comprehensive Loss AOCI Attributable to Parent [Member] Accumulated Deficit Retained Earnings [Member] Statement [Line Items] Statement [Line Items] Increase (Decrease) in Stockholders' Equity [Roll Forward] Increase (Decrease) in Stockholders' Equity [Roll Forward] Preferred stock, shares outstanding, beginning balance Preferred Stock, Shares Outstanding Equity, beginning balance Stockholders' Equity Attributable to Parent Common stock, shares outstanding, beginning balance Common Stock, Shares, Outstanding Conversion of preferred stock to common stock (in shares) Stock Issued During Period, Shares, Conversion of Convertible Securities Conversion of preferred stock to common stock Stock Issued During Period, Value, Conversion of Convertible Securities Issuance of stock/IPO proceeds, net of issuance costs (in shares) Stock Issued During Period, Shares, New Issues Issuance of stock/IPO proceeds, net of issuance costs Stock Issued During Period, Value, New Issues Sale of restricted common stock to founders Adjustments To Additional Paid In Capital, Sale Of Restricted Common Stock Adjustments To Additional Paid In Capital, Sale Of Restricted Common Stock Vesting of restricted common stock (in shares) Stock Issued During Period, Shares, Restricted Stock Award, Gross Vesting of restricted common stock Stock Issued During Period, Value, Restricted Stock Award, Gross Issuance of common stock from option exercises (in shares) Share-based Compensation Arrangement by Share-based Payment Award, Options, Exercises in Period Issuance of common stock from option exercises Stock Issued During Period, Value, Stock Options Exercised Stock-based compensation expense Adjustments to Additional Paid in Capital, Share-based Compensation, Requisite Service Period Recognition Unrealized gain (loss) on available-for-sale securities Other Comprehensive Income (Loss), Available-for-sale Securities Adjustment, Net of Tax, Portion Attributable to Parent Net loss Net Income (Loss) Attributable to Parent Preferred stock, shares outstanding, ending balance Equity, ending balance Common stock, shares outstanding, ending balance Disclosure of Compensation Related Costs, Share-based Payments [Abstract] Stock-based compensation Disclosure of Compensation Related Costs, Share-based Payments [Text Block] Income Tax Disclosure [Abstract] Deferred tax assets: Deferred Tax Assets, Gross [Abstract] U.S. and state net operating loss carryforwards Deferred Tax Assets, Operating Loss Carryforwards Accruals and other temporary differences Deferred Tax Assets, Tax Deferred Expense, Reserves and Accruals Amortization Deferred Tax Assets, Property, Plant and Equipment Stock-based compensation Deferred Tax Assets, Tax Deferred Expense, Compensation and Benefits, Share-based Compensation Cost Tax credit carryforward Deferred Tax Assets, Tax Credit Carryforwards Total deferred tax assets Deferred Tax Assets, Gross Less valuation allowance Deferred Tax Assets, Valuation Allowance Deferred tax assets Deferred Tax Assets, Net of Valuation Allowance Deferred tax liabilities: Deferred Tax Liabilities, Gross [Abstract] Stock-based compensation Deferred Tax Liabilities, Tax Deferred Expense, Compensation And Benefits, Share-Based Compensation Cost Amount before allocation of valuation allowances of deferred tax liability attributable to deductible temporary differences from share-based compensation. Depreciation Deferred Tax Liabilities, Property, Plant and Equipment Accruals and other temporary differences Deferred Tax Liabilities, Deferred Expense, Reserves and Accruals Deferred tax liabilities Deferred Tax Liabilities, Gross Net deferred tax assets Deferred Tax Assets, Net Commitments and Contingencies Disclosure [Abstract] Commitments and contingencies Commitments and Contingencies Disclosure [Text Block] Property, Plant and Equipment [Abstract] Property, Plant and Equipment [Table] Property, Plant and Equipment [Table] Property, Plant and Equipment, Type [Axis] Property, Plant and Equipment, Type [Axis] Property, Plant and Equipment, Type [Domain] Property, Plant and Equipment, Type [Domain] Computers and computer equipment Computer Equipment [Member] Laboratory equipment Technology Equipment [Member] Manufacturing equipment Equipment [Member] Website development costs Software and Software Development Costs [Member] Capital in progress Capital in Progress [Member] Capital in Progress [Member] Property, Plant and Equipment [Line Items] Property, Plant and Equipment [Line Items] Total property and equipment Property, Plant and Equipment, Gross Accumulated depreciation Accumulated Depreciation, Depletion and Amortization, Property, Plant, and Equipment Property and equipment, net Property, Plant and Equipment, Net Depreciation expense Depreciation Issuance costs Adjustments to Additional Paid in Capital, Stock Issued, Issuance Costs Accounting Policies [Abstract] Range [Axis] Range [Axis] Range [Domain] Range [Domain] Minimum Minimum [Member] Maximum Maximum [Member] Estimated useful life Property, Plant and Equipment, Useful Life Quarterly Financial Information Disclosure [Abstract] Net product revenue Sales Revenue, Goods, Net Other revenue Other Revenue, Net Total revenue Costs and expenses: Operating Expenses [Abstract] Cost of product revenue Cost of Goods Sold Research and development Research and Development Expense Selling, general and administrative General and Administrative Expense Total costs and expenses Operating Expenses Loss from operations Income (Loss) from Continuing Operations before Income Taxes, Noncontrolling Interest Net loss Net loss per share attributable to common stockholders - basic and diluted (in usd per share) Earnings Per Share, Basic and Diluted Weighted-average number of common shares outstanding — basic and diluted Weighted Average Number of Shares Outstanding, Basic and Diluted Subsequent Events [Abstract] Subsequent events Subsequent Events [Text Block] Fair Value Disclosures [Abstract] Fair value measurements Fair Value Disclosures [Text Block] Effective Income Tax Rate Reconciliation, Percent [Abstract] Effective Income Tax Rate Reconciliation, Percent [Abstract] Federal income tax expense at statutory rate (as a percent) Effective Income Tax Rate Reconciliation, at Federal Statutory Income Tax Rate, Percent State income tax, net of federal benefit (as a percent) Effective Income Tax Rate Reconciliation, State and Local Income Taxes, Percent Permanent differences (as a percent) Effective Income Tax Rate Reconciliation, Foreign Income Tax Rate Differential, Percent Stock compensation (as a percent) Effective Income Tax Rate Reconciliation, Nondeductible Expense, Share-based Compensation Cost, Percent Research credits (as a percent) Effective Income Tax Rate Reconciliation, Tax Credit, Research, Percent Other, net (as a percent) Effective Income Tax Rate Reconciliation,Other Reconciling Items, Percent Change in valuation allowance (as a percent) Effective Income Tax Rate Reconciliation, Change in Deferred Tax Assets Valuation Allowance, Percent Effective tax rate (as a percent) Effective Income Tax Rate Reconciliation, Percent Summary of significant accounting policies Significant Accounting Policies [Text Block] Statement of Comprehensive Income [Abstract] Other Comprehensive gain (loss): Other Comprehensive Income (Loss), Net of Tax [Abstract] Unrealized gain (loss) on available-for-sale securities Other comprehensive gain Other Comprehensive Income (Loss), Net of Tax Comprehensive loss Comprehensive Income (Loss), Net of Tax, Attributable to Parent Long-term Purchase Commitment [Table] Long-term Purchase Commitment [Table] Subsequent Event Type [Axis] Subsequent Event Type [Axis] Subsequent Event Type [Domain] Subsequent Event Type [Domain] Subsequent Event Subsequent Event [Member] Name of Property [Axis] Name of Property [Axis] Name of Property [Domain] Name of Property [Domain] 800 Boylston St 800 Boylston St [Member] 800 Boylston St [Member] Long-term Purchase Commitment [Line Items] Long-term Purchase Commitment [Line Items] Operating leases, increase in future minimum payments due Operating Leases, Increase (Decrease) in Future Minimum Payments Due Operating Leases, Increase (Decrease) in Future Minimum Payments Due Rent expense Operating Leases, Rent Expense, Net Percent of gross sales due to related parties Related Party Transaction, Percentage Of Gross Sales Due To Related Parties Related Party Transaction, Percentage of Gross Sales due to Related Parties Royalty expense Royalty Expense Royalties payable Accrued Royalties Minimum future lease payments Schedule of Future Minimum Rental Payments for Operating Leases [Table Text Block] Payables and Accruals [Abstract] Accrued expenses and other current liabilities Accounts Payable, Accrued Liabilities, and Other Liabilities Disclosure, Current [Text Block] Subsequent Event [Table] Subsequent Event [Table] Subsequent Event [Line Items] Subsequent Event [Line Items] Area of Real Estate Property Area of Real Estate Property Security deposit Security Deposit Common stock Stockholders' Equity Note Disclosure [Text Block] Schedule of Stock by Class [Table] Schedule of Stock by Class [Table] Series A convertible preferred stock Class of Stock [Line Items] Class of Stock [Line Items] Preferred stock, authorized (shares) Preferred Stock, Shares Authorized Preferred stock, par value (in usd per share) Preferred Stock, Par or Stated Value Per Share Convertible preferred stock, automatic conversion, minimum share price (in usd per share) Convertible Preferred Stock, Automatic Conversion, Minimum Share Price Convertible Preferred Stock, Automatic Conversion, Minimum Share Price Net proceeds from issuance of convertible preferred stock Proceeds from Issuance of Convertible Preferred Stock Preferred stock, carrying value Preferred Stock, Value, Issued Segment Information Segment Reporting Disclosure [Text Block] Schedule of Share-based Compensation Arrangements by Share-based Payment Award [Table] Schedule of Share-based Compensation Arrangements by Share-based Payment Award [Table] Title of Individual [Axis] Title of Individual [Axis] Relationship to Entity [Domain] Relationship to Entity [Domain] Non-employee Consultants and Advisers Non-employee Consultants and Advisers [Member] Non-employee Consultants and Advisers [Member] Award Type [Axis] Award Type [Axis] Equity Award [Domain] Equity Award [Domain] Unvested restricted common stock Restricted Stock [Member] Share-based Compensation Arrangement by Share-based Payment Award [Line Items] Share-based Compensation Arrangement by Share-based Payment Award [Line Items] Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Nonvested, Number of Shares [Roll Forward] Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Nonvested, Number of Shares [Roll Forward] Beginning balance, non-vested, number of shares Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Nonvested, Number Issued, number of shares Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Grants in Period Vested, number of shares Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Vested in Period Forfeited, number of shares Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Forfeited in Period Ending balance, non-vested, number of shares Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Nonvested, Weighted Average Grant Date Fair Value [Abstract] Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Nonvested, Weighted Average Grant Date Fair Value [Abstract] Beginning balance, non-vested, weighted average grant date fair value (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Nonvested, Weighted Average Grant Date Fair Value Issued, weighted average grant date fair value (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Grants in Period, Weighted Average Grant Date Fair Value Vested, weighted average grant date fair value (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Vested in Period, Weighted Average Grant Date Fair Value Forfeited, weighted average grant date fair value (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Forfeitures, Weighted Average Grant Date Fair Value Ending balance, non-vested, weighted average grant date fair value (in usd per share) Schedule of effective income tax rate reconciliation Schedule of Effective Income Tax Rate Reconciliation [Table Text Block] Schedule of deferred tax assets and liabilities Schedule of Deferred Tax Assets and Liabilities [Table Text Block] Basis of presentation Basis of Accounting, Policy [Policy Text Block] Use of estimates Use of Estimates, Policy [Policy Text Block] Principles of consolidation Consolidation, Policy [Policy Text Block] Concentrations of risk, credit risk and off-balance sheet risk Concentration Risk, Credit Risk, Policy [Policy Text Block] Segment information Segment Reporting, Policy [Policy Text Block] Revenue Revenue Recognition, Policy [Policy Text Block] Revenue, Discounts Revenue Recognition, Discounts [Policy Text Block] Accounts receivable and allowance for doubtful accounts Receivables, Trade and Other Accounts Receivable, Allowance for Doubtful Accounts, Policy [Policy Text Block] Cost of product revenue Cost of Sales, Policy [Policy Text Block] Inventory Inventory, Policy [Policy Text Block] Advertising expense Advertising Costs, Policy [Policy Text Block] Shipping and handling costs Shipping and Handling Cost, Policy [Policy Text Block] Property and equipment Property, Plant and Equipment, Policy [Policy Text Block] Impairment of long-lived assets Impairment or Disposal of Long-Lived Assets, Policy [Policy Text Block] Research and development expenses Research and Development Expense, Policy [Policy Text Block] Stock-based compensation expense Compensation Related Costs, Policy [Policy Text Block] Income taxes Income Tax, Policy [Policy Text Block] Net loss per share attributable to common stockholders Earnings Per Share, Policy [Policy Text Block] Comprehensive loss Comprehensive Income, Policy [Policy Text Block] Recent accounting pronouncements New Accounting Pronouncements, Policy [Policy Text Block] Subsequent events Subsequent Events, Policy [Policy Text Block] Fair value measurements Fair Value Measurement, Policy [Policy Text Block] Cash and Cash Equivalents [Abstract] Schedule of Marketable Securities Available-for-sale Securities [Table Text Block] Plan Name [Axis] Plan Name [Axis] Plan Name [Domain] Plan Name [Domain] Flex Pharma, Inc. 2014 Equity Incentive Plan Flex Pharma, Inc. 2014 Equity Incentive Plan [Member] Flex Pharma, Inc. 2014 Equity Incentive Plan [Member] Non-employee Stock Options Non-employee Stock Options [Member] Non-employee stock options [Member] Options to purchase common stock Employee Stock Option [Member] Performance Shares Performance Shares [Member] Shares authorized Share-based Compensation Arrangement by Share-based Payment Award, Number of Shares Authorized Shares remaining available for grant of stock awards Share-based Compensation Arrangement by Share-based Payment Award, Number of Shares Available for Grant Shares granted to non-employee consultants and members of the Scientific Advisory Board Share-based Compensation Arrangement By Share-Based Payment Award, Options, Grants In Period, Non-Employee Share-based Compensation Arrangement by Share-based Payment Award, Options, Grants in Period, Non-Employee Stock options, vesting period Share-based Compensation Arrangement by Share-based Payment Award, Award Vesting Period Stock options, contractual term Share-based Compensation Arrangement by Share-based Payment Award, Expiration Period Stock-based compensation expense Allocated Share-based Compensation Expense Shares granted Share-based Compensation Arrangement by Share-based Payment Award, Options, Grants in Period, Gross Shares granted, weighted-average grant date fair value (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Options, Grants in Period, Weighted Average Grant Date Fair Value Shares exercised Shares exercised, weighted average exercise price (in usd per share) Share-based Compensation Arrangements by Share-based Payment Award, Options, Exercises in Period, Weighted Average Exercise Price Stock options exercised, intrinsic value Share-based Compensation Arrangement by Share-based Payment Award, Options, Exercises in Period, Intrinsic Value Unrecognized compensation cost Employee Service Share-based Compensation, Nonvested Awards, Compensation Not yet Recognized, Stock Options Unrecognized compensation cost, recognition period Employee Service Share-based Compensation, Nonvested Awards, Compensation Cost Not yet Recognized, Period for Recognition Statement of Financial Position [Abstract] Assets Assets [Abstract] Current assets: Assets, Current [Abstract] Cash and cash equivalents Cash Marketable securities Marketable Securities, Current Accounts receivable Accounts Receivable, Net, Current Inventory Inventory, Net Prepaid expenses and other current assets Prepaid Expense and Other Assets, Current Total current assets Assets, Current Marketable securities Marketable Securities, Noncurrent Property and equipment, net Other assets Other Assets, Noncurrent Restricted cash Restricted Cash and Cash Equivalents, Noncurrent Total assets Assets Liabilities and stockholders' equity Liabilities and Equity [Abstract] Current liabilities: Liabilities, Current [Abstract] Accounts payable Accounts Payable, Current Accrued expenses and other current liabilities Accrued Expenses And Other Current Liabilities Accrued Expenses And Other Current Liabilities Deferred revenue Deferred Revenue, Current Deferred rent, current portion Deferred Rent Credit, Current Total current liabilities Liabilities, Current Deferred rent, net of current portion Deferred Rent Credit, Noncurrent Other long term liabilities Other Liabilities, Noncurrent Total liabilities Liabilities Stockholders' equity: Stockholders' Equity Attributable to Parent [Abstract] Preferred stock, $0.0001 par value; 10,000,000 shares authorized at December 31, 2016 and December 31, 2015; none issued or outstanding at December 31, 2016 and December 31, 2015 Common stock, $0.0001 par value; 100,000,000 shares authorized at December 31, 2016 and December 31, 2015, 17,970,590 and 17,943,880 shares issued at December 31, 2016 and December 31, 2015, respectively, and 16,773,798 and 15,741,618 shares outstanding at December 31, 2016 and December 31, 2015, respectively Common Stock, Value, Issued Additional paid-in capital Additional Paid in Capital Accumulated other comprehensive loss Accumulated Other Comprehensive Income (Loss), Net of Tax Accumulated deficit Retained Earnings (Accumulated Deficit) Total stockholders' equity Total liabilities and stockholders' equity Liabilities and Equity Quarterly financial information (unaudited) Quarterly Financial Information [Text Block] Preferred stock, issued (shares) Preferred Stock, Shares Issued Preferred stock, shares outstanding (shares) Common stock, par value (in usd per share) Common Stock, Par or Stated Value Per Share Common stock, shares authorized (shares) Common Stock, Shares Authorized Common stock, shares issued (shares) Common Stock, Shares, Issued Common stock, shares outstanding (shares) Property and equipment, net Property, Plant and Equipment Disclosure [Text Block] Stock-based compensation awards Share Based Compensation Award, Shares Reserved For Future Issuance Share-Based Compensation Award, Shares Reserved for Future Issuance Vesting of restricted common stock Common Stock, Capital Shares Reserved for Future Issuance Employee stock purchase plan Shares Held in Employee Stock Option Plan, Committed-to-be-Released Total Shares Reserved For Future Issuance Shares Reserved for Future Issue Convertible preferred stock Preferred Stock [Text Block] Accumulated Other Comprehensive Income (Loss), Net of Tax [Roll Forward] AOCI Attributable to Parent, Net of Tax [Roll Forward] Accumulated Other Comprehensive Loss, beginning balance Accumulated Other Comprehensive Loss, ending balance Depreciation over estimated useful life Property, Plant and Equipment [Table Text Block] Reclassification out of Accumulated Other Comprehensive Income Reclassification out of Accumulated Other Comprehensive Income [Table Text Block] 2016 Operating Leases, Future Minimum Payments Due, Next Twelve Months 2017 Operating Leases, Future Minimum Payments, Due in Two Years Total minimum lease payments Operating Leases, Future Minimum Payments Due Shares Share-based Compensation Arrangement by Share-based Payment Award, Options, Outstanding [Roll Forward] Shares outstanding, beginning balance Share-based Compensation Arrangement by Share-based Payment Award, Options, Outstanding, Number Shares exercised Shares canceled or forfeited Share-based Compensation Arrangement by Share-based Payment Award, Options, Forfeitures in Period Shares outstanding, ending balance Shares exercisable Share-based Compensation Arrangement by Share-based Payment Award, Options, Exercisable, Number Shares vested or expected to vest Share-based Compensation Arrangement by Share-based Payment Award, Options, Vested and Expected to Vest, Outstanding, Number Weighted-Average Exercise Price Share-based Compensation Arrangement by Share-based Payment Award, Options, Outstanding, Weighted Average Exercise Price [Abstract] Shares outstanding, beginning balance, weighted average exercise price (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Options, Outstanding, Weighted Average Exercise Price Shares granted, weighted average exercise price (in usd per share) Share-based Compensation Arrangements by Share-based Payment Award, Options, Grants in Period, Weighted Average Exercise Price Shares canceled or forfeited, weighted average exercise price (in usd per share) Share-based Compensation Arrangements by Share-based Payment Award, Options, Forfeitures in Period, Weighted Average Exercise Price Shares outstanding, ending balance, weighted average exercise price (in usd per share) Shares exercisable, weighted average exercise price (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Options, Exercisable, Weighted Average Exercise Price Shares vested or expected to vest, weighted average exercise price (in usd per share) Share-based Compensation Arrangement by Share-based Payment Award, Options, Vested and Expected to Vest, Outstanding, Weighted Average Exercise Price Share-based Compensation Arrangement by Share-based Payment Award, Options, Additional Disclosures [Abstract] Share-based Compensation Arrangement by Share-based Payment Award, Options, Additional Disclosures [Abstract] Outstanding, weighted average remaining contractual term Share-based Compensation Arrangement by Share-based Payment Award, Options, Outstanding, Weighted Average Remaining Contractual Term Exercisable, weighted average remaining contractual term Share-based Compensation Arrangement by Share-based Payment Award, Options, Exercisable, Weighted Average Remaining Contractual Term Vested or expected to vest, weighted average remaining contractual term Share-based Compensation Arrangement by Share-based Payment Award, Options, Vested and Expected to Vest, Outstanding, Weighted Average Remaining Contractual Term Outstanding, aggregate intrinsic value Share-based Compensation Arrangement by Share-based Payment Award, Options, Outstanding, Intrinsic Value Exercisable, aggregate intrinsic value Share-based Compensation Arrangement by Share-based Payment Award, Options, Exercisable, Intrinsic Value Vested or expected to vest, aggregate intrinsic value Share-based Compensation Arrangement by Share-based Payment Award, Options, Vested and Expected to Vest, Outstanding, Aggregate Intrinsic Value Expected volatility (as a percent) Share-based Compensation Arrangement by Share-based Payment Award, Fair Value Assumptions, Expected Volatility Rate Risk-free interest rate, minimum (as a percent) Share-based Compensation Arrangement by Share-based Payment Award, Fair Value Assumptions, Risk Free Interest Rate, Minimum Risk-free interest rate, maximum (as a percent) Share-based Compensation Arrangement by Share-based Payment Award, Fair Value Assumptions, Risk Free Interest Rate, Maximum Expected term (in years) Share-based Compensation Arrangement by Share-based Payment Award, Fair Value Assumptions, Expected Term Expected dividend yield (as a percent) Share-based Compensation Arrangement by Share-based Payment Award, Fair Value Assumptions, Expected Dividend Rate Vesting [Axis] Vesting [Axis] Vesting [Domain] Vesting [Domain] Vests upon issuance Share-based Compensation Award, Tranche One [Member] Vests ratably over four years Share-based Compensation Award, Tranche Two [Member] Restricted common stock, shares sold Restricted common stock, price per share (in usd per share) Sale of Stock, Price Per Share Proceeds from sale of restricted common stock to founders Proceeds From Sale Of Restricted Common Stock Proceeds From Sale Of Restricted Common Stock Restricted common stock, percent vested Share-based Compensation Arrangement by Share-based Payment Award, Award Vesting Rights, Percentage Restricted common stock, vesting period Restricted common stock, repurchase period Stock Repurchase Program, Period in Force Restricted common stock, repurchase price Treasury Stock Acquired, Average Cost Per Share Restricted common stock, shares outstanding Share-based Compensation Arrangement by Share-based Payment Award, Non-Option Equity Instruments, Outstanding, Number Restricted common stock, fair value of shares vested Share-based Compensation Arrangement by Share-based Payment Award, Equity Instruments Other than Options, Vested in Period, Fair Value Stock issued under Employee Stock Purchase Plan Stock Issued During Period, Shares, Employee Stock Purchase Plans Earnings Per Share [Abstract] Schedule of Antidilutive Securities Excluded from Computation of Earnings Per Share [Table] Schedule of Antidilutive Securities Excluded from Computation of Earnings Per Share [Table] Antidilutive Securities [Axis] Antidilutive Securities [Axis] Antidilutive Securities, Name [Domain] Antidilutive Securities, Name [Domain] Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items] Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items] Antidilutive securities excluded from computation of earnings per share Antidilutive Securities Excluded from Computation of Earnings Per Share, Amount Schedule of Available-for-sale Securities [Table] Schedule of Available-for-sale Securities [Table] Balance Sheet Location [Axis] Balance Sheet Location [Axis] Balance Sheet Location [Domain] Balance Sheet Location [Domain] Current Assets Current Assets [Member] Current Assets [Member] Noncurrent Assets Noncurrent Assets [Member] Noncurrent Assets [Member] Major Types of Debt and Equity Securities [Axis] Major Types of Debt and Equity Securities [Axis] Major Types of Debt and Equity Securities [Domain] Major Types of Debt and Equity Securities [Domain] Corporate debt securities Corporate Debt Securities [Member] Commercial paper Commercial Paper [Member] U.S. government agency securities US Government Agencies Debt Securities [Member] Schedule of Available-for-sale Securities [Line Items] Schedule of Available-for-sale Securities [Line Items] Marketable securities: Marketable Securities [Abstract] Amortized Cost Available-for-sale Securities, Amortized Cost Basis Unrealized Gains Available-for-sale Securities, Accumulated Gross Unrealized Gain, before Tax Unrealized Losses Available-for-sale Securities, Accumulated Gross Unrealized Loss, before Tax Fair Value Available-for-sale Securities Number of debt securities held Available-for-sale, Securities in Unrealized Loss Positions, Qualitative Disclosure, Number of Positions Aggregate fair value of debt securities in an unrealized loss position Available-for-sale Securities, Continuous Unrealized Loss Position, Fair Value Net loss per share Earnings Per Share [Text Block] Inventory Disclosure [Abstract] Raw materials Inventory, Raw Materials, Net of Reserves Finished goods Inventory, Work in Process, Net of Reserves Total inventory Write-off of inventory Inventory Write-down Operating Loss Carryforwards [Table] Operating Loss Carryforwards [Table] Scenario [Axis] Scenario [Axis] Scenario, Unspecified [Domain] Scenario, Unspecified [Domain] Scenario, Forecast Scenario, Forecast [Member] Adjustments for New Accounting Pronouncements [Axis] Adjustments for New Accounting Pronouncements [Axis] Type of Adoption [Domain] Type of Adoption [Domain] Accounting Standards Update 2016-09 Accounting Standards Update 2016-09 [Member] Accounting Standards Update 2016-09 [Member] Income Tax Authority [Axis] Income Tax Authority [Axis] Income Tax Authority [Domain] Income Tax Authority [Domain] U.S. Federal Domestic Tax Authority [Member] U.S. State State and Local Jurisdiction [Member] U.S. Federal and State Domestic Tax Authority and State and Local Jurisdiction [Member] Domestic Tax Authority and State and Local Jurisdiction [Member] Income Taxes [Line Items] Operating Loss Carryforwards [Line Items] Net operating loss carryforward Operating Loss Carryforwards Operating loss carryforward tax affected Operating Loss Carryforwards, Tax Affected Operating Loss Carryforwards, Tax Affected Operating loss carryforwards that will increase additional paid in capital if used to reduce income taxes payable Adjustments to Additional Paid in Capital, Operating Loss Carryforwards If Used to Reduce Income Tax Payable Adjustments to Additional Paid in Capital, Operating Loss Carryforwards If Used to Reduce Income Tax Payable Research and development tax credit carryforwards Deferred Tax Assets, Tax Credit Carryforwards, Research Deferred tax assets Deferred tax assets, valuation allowance Increase (decrease) in valuation allowance Valuation Allowance, Deferred Tax Asset, Increase (Decrease), Amount Related Party Transactions [Abstract] Related parties Related Party Transactions Disclosure [Text Block] Document And Entity Information [Abstract] Document and Entity Information [Abstract] Entity Registrant Name Entity Registrant Name Entity Central Index Key Entity Central Index Key Current Fiscal Year End Date Current Fiscal Year End Date Entity Filer Category Entity Filer Category Document Type Document Type Document Period End Date Document Period End Date Document Fiscal Year Focus Document Fiscal Year Focus Document Fiscal Period Focus Document Fiscal Period Focus Amendment Flag Amendment Flag Entity Common Stock, Shares Outstanding Entity Common Stock, Shares Outstanding Entity Well-known Seasoned Issuer Entity Well-known Seasoned Issuer Entity Voluntary Filers Entity Voluntary Filers Entity Current Reporting Status Entity Current Reporting Status Entity Public Float Entity Public Float Income taxes Income Tax Disclosure [Text Block] Schedule of Related Party Transactions, by Related Party [Table] Schedule of Related Party Transactions, by Related Party [Table] Related Party [Axis] Related Party [Axis] Related Party [Domain] Related Party [Domain] Affiliated Entity Affiliated Entity [Member] Related Party Transaction [Line Items] Related Party Transaction [Line Items] License fees received Revenue from Related Parties Schedule of Segment Reporting Information Schedule of Segment Reporting Information, by Segment [Table Text Block] Summary of stock option activity Schedule of Share-based Compensation, Stock Options, Activity [Table Text Block] Schedule of fair value assumptions Schedule of Share-based Payment Award, Stock Options, Valuation Assumptions [Table Text Block] Summary of stock-based compensation expense Schedule of Employee Service Share-based Compensation, Allocation of Recognized Period Costs [Table Text Block] Property and equipment, net Schedule of Employee Service Share-based Compensation, Allocation of Recognized Period Costs [Table] Schedule of Employee Service Share-based Compensation, Allocation of Recognized Period Costs [Table] Income Statement Location [Axis] Income Statement Location [Axis] Income Statement Location [Domain] Income Statement Location [Domain] Research and development Research and Development Expense [Member] Selling, general and administrative General and Administrative Expense [Member] Employee Service Share-Based Compensation Allocation of Recognized Period Costs [Line Items] Share-based Compensation Arrangement by Share-based Payment Award, Compensation Cost [Line Items] Organization, Consolidation and Presentation of Financial Statements [Abstract] Subsidiary or Equity Method Investee, Sale of Stock by Subsidiary or Equity Investee [Table] Subsidiary or Equity Method Investee, Sale of Stock by Subsidiary or Equity Investee [Table] Sale of Stock [Axis] Sale of Stock [Axis] Sale of Stock [Domain] Sale of Stock [Domain] IPO IPO [Member] Over-Allotment Option Over-Allotment Option [Member] Subsidiary, Sale of Stock [Line Items] Subsidiary, Sale of Stock [Line Items] Common stock, shares issued Common stock, price per share (in usd per share) Shares Issued, Price Per Share Proceeds from initial public offering, net of offering costs Proceeds from Issuance Initial Public Offering Payments of stock issuance costs Payments of Stock Issuance Costs Accumulated deficit Cash, cash equivalents, and marketable securities Cash, Cash Equivalents, and Marketable Securities Cash, Cash Equivalents, and Marketable Securities Schedule of Restricted Cash and Cash Equivalents [Table] Schedule of Restricted Cash and Cash Equivalents [Table] Credit Facility [Axis] Restricted Cash and Cash Equivalents [Axis] Credit Facility [Domain] Cash and Cash Equivalents [Domain] Letter of Credit Letter of Credit [Member] Restricted Cash and Cash Equivalents Items [Line Items] Restricted Cash and Cash Equivalents Items [Line Items] Statement of Cash Flows [Abstract] Operating activities Net Cash Provided by (Used in) Operating Activities [Abstract] Adjustments to reconcile net loss to net cash used in operating activities: Adjustments to Reconcile Net Income (Loss) to Cash Provided by (Used in) Operating Activities [Abstract] Depreciation expense Stock-based compensation expense Share-based Compensation Amortization of premium on investments Investment Income, Amortization of Premium Other non-cash items Other Noncash Expense Changes in operating assets and liabilities: Increase (Decrease) in Operating Capital [Abstract] Restricted cash Increase (Decrease) in Restricted Cash for Operating Activities Accounts receivable Increase (Decrease) in Accounts Receivable Inventory Increase (Decrease) in Inventories Prepaid expenses and other current assets Increase (Decrease) in Prepaid Expense and Other Assets Other assets Increase (Decrease) in Other Noncurrent Assets Accounts payable Increase (Decrease) in Accounts Payable Accrued expenses and other current liabilities Increase (Decrease) in Accrued Liabilities Deferred revenue Increase (Decrease) in Deferred Revenue Deferred rent Increase (Decrease) in Deferred Liabilities Other long term liabilities Increase (Decrease) in Other Noncurrent Liabilities Net cash used in operating activities Net Cash Provided by (Used in) Operating Activities Investing activities Net Cash Provided by (Used in) Investing Activities [Abstract] Purchases of marketable securities Payments to Acquire Marketable Securities Proceeds from maturities and sales of marketable securities Proceeds from Sale and Maturity of Marketable Securities Purchases of property and equipment Payments to Acquire Property, Plant, and Equipment Proceeds from sales of property and equipment Proceeds from Sale of Property, Plant, and Equipment Net cash used in investing activities Net Cash Provided by (Used in) Investing Activities Financing activities Net Cash Provided by (Used in) Financing Activities [Abstract] Proceeds from issuance of convertible preferred stock, net of issuance costs Proceeds from exercise of common stock Proceeds from Stock Options Exercised Proceeds from early exercise of common stock Proceeds from Early Exercise of Stock Options Proceeds from Early Exercise of Stock Options Deferred IPO issuance costs Deferred IPO Issuance Cost Deferred IPO Issuance Cost Net cash provided by financing activities Net Cash Provided by (Used in) Financing Activities Net (decrease) increase in cash and cash equivalents Cash, Period Increase (Decrease) Cash and cash equivalents at beginning of period Cash and cash equivalents at end of period Supplemental cash flow information Supplemental Cash Flow Information [Abstract] Property and equipment purchases included in accounts payable and accrued expense Property And Equipment Purchases In Accrued Expense Property and Equipment Purchases In Accrued Expense IPO issuance costs paid in cash through December 31, 2014 Initial Public Offering Costs Paid Initial Public Offering Costs Paid IPO issuance costs included in accounts payable and accrued expenses Deferred Initial Public Offering Issuance Costs In Accounts Payable and Accrued Expenses Deferred Initial Public Offering Issuance Costs In Accounts Payable and Accrued Expenses Issuance of Series A convertible preferred stock in satisfaction of accounts payable Issuance Of Convertible Preferred Stock In Accounts Payable Issuance Of Convertible Preferred Stock In Accounts Payable Summary of Cash Equivalents and Marketable Securities Measured at Fair Value on a Recurring Basis Fair Value, Assets Measured on Recurring Basis [Table Text Block] Entity Location [Table] Entity Location [Table] Geographical [Axis] Geographical [Axis] Geographical [Domain] Geographical [Domain] United States UNITED STATES Entity Location [Line Items] Entity Location [Line Items] Number of operating segments Number of Operating Segments Number of geographic segments Number Of Geographic Segments Number Of Geographic Segments Revenue recognition, refund period Revenue Recognition, Refund Period Revenue Recognition, Refund Period Shipping and handling costs Shipping, Handling and Transportation Costs Advertising expenses Advertising Expense IPO proceeds, net of issuance costs Common stock, number of shares issued from conversion of preferred stock (in shares) Conversion of Stock, Shares Converted IPO issuance costs Deferred Offering Costs IPO underwriting discounts and commissions Underwriting Discounts and Commissions, Initial Public Offering Underwriting Discounts and Commissions, Initial Public Offering Reverse stock split conversion ratio Stockholders' Equity Note, Stock Split, Conversion Ratio Accrued expenses Schedule of Accrued Liabilities [Table Text Block] Other current liabilities Other Current Liabilities [Table Text Block] Inventory Inventory Disclosure [Text Block] Schedule of quarterly financial information Quarterly Financial Information [Table Text Block] Income Statement [Abstract] Loss from operations Net loss attributable to common stockholders Net Income (Loss) Available to Common Stockholders, Basic Cash equivalents and marketable securities Cash, Cash Equivalents, and Marketable Securities [Text Block] Organization and operations Organization, Consolidation and Presentation of Financial Statements Disclosure [Text Block] Restricted cash Cash and Cash Equivalents Disclosure [Text Block] Fair Value Measurements, Recurring and Nonrecurring [Table] Fair Value Measurements, Recurring and Nonrecurring [Table] Measurement Frequency [Axis] Measurement Frequency [Axis] Fair Value, Measurement Frequency [Domain] Fair Value, Measurement Frequency [Domain] Fair Value, Measurements, Recurring Fair Value, Measurements, Recurring [Member] Corporate debt securities Fair Value, Hierarchy [Axis] Fair Value, Hierarchy [Axis] Fair Value Hierarchy [Domain] Fair Value Hierarchy [Domain] Level 1 Fair Value, Inputs, Level 1 [Member] Level 2 Fair Value, Inputs, Level 2 [Member] Level 3 Fair Value, Inputs, Level 3 [Member] Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] Cash equivalents Cash and Cash Equivalents, Fair Value Disclosure Marketable securities Total assets Assets, Fair Value Disclosure Schedule of antidilutive securities excluded from computation of earnings per share Schedule of Antidilutive Securities Excluded from Computation of Earnings Per Share [Table Text Block] Payroll and employee-related costs Employee-related Liabilities, Current Research and development costs Accrued Research And Development Expense, Current Accrued Research and Development Expense, Current Professional fees Accrued Professional Fees, Current Consumer product-related costs Accrued Marketing Costs, Current Other Other Accrued Liabilities, Current Total Schedule of Inventory, Net Schedule of Inventory, Current [Table Text Block]