<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.25.2</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>252</ContextCount>
  <ElementCount>288</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>false</FootnotesReported>
  <SegmentCount>64</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>7</UnitCount>
  <MyReports>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>0000001 - Document - Cover</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/Cover</Role>
      <ShortName>Cover</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>9952151 - Statement - CONDENSED CONSOLIDATED BALANCE SHEETS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CONDENSEDCONSOLIDATEDBALANCESHEETS</Role>
      <ShortName>CONDENSED CONSOLIDATED BALANCE SHEETS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>9952152 - Statement - CONDENSED CONSOLIDATED BALANCE SHEETS (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CONDENSEDCONSOLIDATEDBALANCESHEETSParenthetical</Role>
      <ShortName>CONDENSED CONSOLIDATED BALANCE SHEETS (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>9952153 - Statement - CONDENSED CONSOLIDATED STATEMENTS OF OPERATIONS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CONDENSEDCONSOLIDATEDSTATEMENTSOFOPERATIONS</Role>
      <ShortName>CONDENSED CONSOLIDATED STATEMENTS OF OPERATIONS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>9952154 - Statement - CONDENSED CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (LOSS)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CONDENSEDCONSOLIDATEDSTATEMENTSOFCOMPREHENSIVEINCOMELOSS</Role>
      <ShortName>CONDENSED CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (LOSS)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>9952155 - Statement - CONDENSED CONSOLIDATED STATEMENTS OF STOCKHOLDERS??? EQUITY</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CONDENSEDCONSOLIDATEDSTATEMENTSOFSTOCKHOLDERSEQUITY</Role>
      <ShortName>CONDENSED CONSOLIDATED STATEMENTS OF STOCKHOLDERS??? EQUITY</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>9952156 - Statement - CONDENSED CONSOLIDATED STATEMENTS OF CASH FLOWS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CONDENSEDCONSOLIDATEDSTATEMENTSOFCASHFLOWS</Role>
      <ShortName>CONDENSED CONSOLIDATED STATEMENTS OF CASH FLOWS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>9952157 - Disclosure - Organization and Description of Business</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/OrganizationandDescriptionofBusiness</Role>
      <ShortName>Organization and Description of Business</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>9952158 - Disclosure - Basis of Presentation and Summary of Significant Accounting Policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BasisofPresentationandSummaryofSignificantAccountingPolicies</Role>
      <ShortName>Basis of Presentation and Summary of Significant Accounting Policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>9952159 - Disclosure - Fair Value Measurements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/FairValueMeasurements</Role>
      <ShortName>Fair Value Measurements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>9952160 - Disclosure - Balance Sheet Components</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BalanceSheetComponents</Role>
      <ShortName>Balance Sheet Components</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>9952161 - Disclosure - Senior Secured Credit Facilities Agreement</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/SeniorSecuredCreditFacilitiesAgreement</Role>
      <ShortName>Senior Secured Credit Facilities Agreement</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>9952162 - Disclosure - Leases</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/Leases</Role>
      <ShortName>Leases</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>9952163 - Disclosure - Acquisition-related Intangible Assets, Net</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/AcquisitionrelatedIntangibleAssetsNet</Role>
      <ShortName>Acquisition-related Intangible Assets, Net</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>9952164 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CommitmentsandContingencies</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>9952165 - Disclosure - Stockholders??? Equity and Equity Incentive Plans</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/StockholdersEquityandEquityIncentivePlans</Role>
      <ShortName>Stockholders??? Equity and Equity Incentive Plans</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>9952166 - Disclosure - Net Income (Loss) Per Share</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/NetIncomeLossPerShare</Role>
      <ShortName>Net Income (Loss) Per Share</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>9952167 - Disclosure - Income Taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/IncomeTaxes</Role>
      <ShortName>Income Taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>9952168 - Disclosure - Segment and Geographical Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/SegmentandGeographicalInformation</Role>
      <ShortName>Segment and Geographical Information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>9952169 - Disclosure - 401(k) Plan</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/A401kPlan</Role>
      <ShortName>401(k) Plan</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>995445 - Disclosure - Insider Trading Arrangements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/ecd/role/InsiderTradingArrangements</Role>
      <ShortName>Insider Trading Arrangements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>9955511 - Disclosure - Basis of Presentation and Summary of Significant Accounting Policies (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BasisofPresentationandSummaryofSignificantAccountingPoliciesPolicies</Role>
      <ShortName>Basis of Presentation and Summary of Significant Accounting Policies (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://pubmatic.com/role/BasisofPresentationandSummaryofSignificantAccountingPolicies</ParentRole>
      <Position>22</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>9955512 - Disclosure - Basis of Presentation and Summary of Significant Accounting Policies (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BasisofPresentationandSummaryofSignificantAccountingPoliciesTables</Role>
      <ShortName>Basis of Presentation and Summary of Significant Accounting Policies (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/BasisofPresentationandSummaryofSignificantAccountingPolicies</ParentRole>
      <Position>23</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>9955513 - Disclosure - Fair Value Measurements (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/FairValueMeasurementsTables</Role>
      <ShortName>Fair Value Measurements (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/FairValueMeasurements</ParentRole>
      <Position>24</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>9955514 - Disclosure - Balance Sheet Components (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BalanceSheetComponentsTables</Role>
      <ShortName>Balance Sheet Components (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/BalanceSheetComponents</ParentRole>
      <Position>25</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>9955515 - Disclosure - Leases (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/LeasesTables</Role>
      <ShortName>Leases (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/Leases</ParentRole>
      <Position>26</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>9955516 - Disclosure - Acquisition-related Intangible Assets, Net (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/AcquisitionrelatedIntangibleAssetsNetTables</Role>
      <ShortName>Acquisition-related Intangible Assets, Net (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/AcquisitionrelatedIntangibleAssetsNet</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>9955517 - Disclosure - Stockholders??? Equity and Equity Incentive Plans (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/StockholdersEquityandEquityIncentivePlansTables</Role>
      <ShortName>Stockholders??? Equity and Equity Incentive Plans (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/StockholdersEquityandEquityIncentivePlans</ParentRole>
      <Position>28</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>9955518 - Disclosure - Net Income (Loss) Per Share (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/NetIncomeLossPerShareTables</Role>
      <ShortName>Net Income (Loss) Per Share (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/NetIncomeLossPerShare</ParentRole>
      <Position>29</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>9955519 - Disclosure - Segment and Geographical Information (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/SegmentandGeographicalInformationTables</Role>
      <ShortName>Segment and Geographical Information (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://pubmatic.com/role/SegmentandGeographicalInformation</ParentRole>
      <Position>30</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>9955520 - Disclosure - Basis of Presentation and Summary of Significant Accounting Policies - Concentration Risk Percentage (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BasisofPresentationandSummaryofSignificantAccountingPoliciesConcentrationRiskPercentageDetails</Role>
      <ShortName>Basis of Presentation and Summary of Significant Accounting Policies - Concentration Risk Percentage (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>9955521 - Disclosure - Basis of Presentation and Summary of Significant Accounting Policies - Allowance for Credit Losses (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BasisofPresentationandSummaryofSignificantAccountingPoliciesAllowanceforCreditLossesDetails</Role>
      <ShortName>Basis of Presentation and Summary of Significant Accounting Policies - Allowance for Credit Losses (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>9955522 - Disclosure - Fair Value Measurements (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/FairValueMeasurementsDetails</Role>
      <ShortName>Fair Value Measurements (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://pubmatic.com/role/FairValueMeasurementsTables</ParentRole>
      <Position>33</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>9955523 - Disclosure - Balance Sheet Components - Schedule of Marketable Securities (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BalanceSheetComponentsScheduleofMarketableSecuritiesDetails</Role>
      <ShortName>Balance Sheet Components - Schedule of Marketable Securities (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>9955524 - Disclosure - Balance Sheet Components - Schedule of Property, Equipment and Software, Net (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BalanceSheetComponentsScheduleofPropertyEquipmentandSoftwareNetDetails</Role>
      <ShortName>Balance Sheet Components - Schedule of Property, Equipment and Software, Net (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>35</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>9955525 - Disclosure - Balance Sheet Components - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BalanceSheetComponentsNarrativeDetails</Role>
      <ShortName>Balance Sheet Components - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>36</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>9955526 - Disclosure - Balance Sheet Components - Schedule of Accounts Payable (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BalanceSheetComponentsScheduleofAccountsPayableDetails</Role>
      <ShortName>Balance Sheet Components - Schedule of Accounts Payable (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>37</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>9955527 - Disclosure - Balance Sheet Components - Schedule of Accrued Liabilities (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/BalanceSheetComponentsScheduleofAccruedLiabilitiesDetails</Role>
      <ShortName>Balance Sheet Components - Schedule of Accrued Liabilities (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>38</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>9955528 - Disclosure - Senior Secured Credit Facilities Agreement (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/SeniorSecuredCreditFacilitiesAgreementDetails</Role>
      <ShortName>Senior Secured Credit Facilities Agreement (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://pubmatic.com/role/SeniorSecuredCreditFacilitiesAgreement</ParentRole>
      <Position>39</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>9955529 - Disclosure - Leases - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/LeasesNarrativeDetails</Role>
      <ShortName>Leases - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>40</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>9955530 - Disclosure - Leases - Lease Cost (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/LeasesLeaseCostDetails</Role>
      <ShortName>Leases - Lease Cost (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>41</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>9955531 - Disclosure - Leases - Lease Maturity (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/LeasesLeaseMaturityDetails</Role>
      <ShortName>Leases - Lease Maturity (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>9955532 - Disclosure - Acquisition-related Intangible Assets, Net - Acquisition-Related Intangible Assets, Net (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/AcquisitionrelatedIntangibleAssetsNetAcquisitionRelatedIntangibleAssetsNetDetails</Role>
      <ShortName>Acquisition-related Intangible Assets, Net - Acquisition-Related Intangible Assets, Net (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>9955533 - Disclosure - Acquisition-related Intangible Assets, Net - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/AcquisitionrelatedIntangibleAssetsNetNarrativeDetails</Role>
      <ShortName>Acquisition-related Intangible Assets, Net - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>9955534 - Disclosure - Acquisition-related Intangible Assets, Net - Estimated Future Amortization (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/AcquisitionrelatedIntangibleAssetsNetEstimatedFutureAmortizationDetails</Role>
      <ShortName>Acquisition-related Intangible Assets, Net - Estimated Future Amortization (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>9955535 - Disclosure - Commitments and Contingencies (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/CommitmentsandContingenciesDetails</Role>
      <ShortName>Commitments and Contingencies (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://pubmatic.com/role/CommitmentsandContingencies</ParentRole>
      <Position>46</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>9955536 - Disclosure - Stockholders??? Equity and Equity Incentive Plans - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/StockholdersEquityandEquityIncentivePlansNarrativeDetails</Role>
      <ShortName>Stockholders??? Equity and Equity Incentive Plans - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>9955537 - Disclosure - Stockholders??? Equity and Equity Incentive Plans - Schedule of Stock Option Activity and Related Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/StockholdersEquityandEquityIncentivePlansScheduleofStockOptionActivityandRelatedInformationDetails</Role>
      <ShortName>Stockholders??? Equity and Equity Incentive Plans - Schedule of Stock Option Activity and Related Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>48</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>9955538 - Disclosure - Stockholders??? Equity and Equity Incentive Plans - Schedule of Restricted Stock Units and Related Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/StockholdersEquityandEquityIncentivePlansScheduleofRestrictedStockUnitsandRelatedInformationDetails</Role>
      <ShortName>Stockholders??? Equity and Equity Incentive Plans - Schedule of Restricted Stock Units and Related Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>49</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>9955539 - Disclosure - Stockholders??? Equity and Equity Incentive Plans - Schedule of Stock-based Compensation Expense (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/StockholdersEquityandEquityIncentivePlansScheduleofStockbasedCompensationExpenseDetails</Role>
      <ShortName>Stockholders??? Equity and Equity Incentive Plans - Schedule of Stock-based Compensation Expense (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>9955540 - Disclosure - Net Income (Loss) Per Share - Schedule of Basic and Diluted Net Income per Share (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/NetIncomeLossPerShareScheduleofBasicandDilutedNetIncomeperShareDetails</Role>
      <ShortName>Net Income (Loss) Per Share - Schedule of Basic and Diluted Net Income per Share (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://pubmatic.com/role/NetIncomeLossPerShareTables</ParentRole>
      <Position>51</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>9955541 - Disclosure - Net Income (Loss) Per Share - Schedule of Antidilutive Securities Excluded from Computation of Earnings per Share (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/NetIncomeLossPerShareScheduleofAntidilutiveSecuritiesExcludedfromComputationofEarningsperShareDetails</Role>
      <ShortName>Net Income (Loss) Per Share - Schedule of Antidilutive Securities Excluded from Computation of Earnings per Share (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://pubmatic.com/role/NetIncomeLossPerShareTables</ParentRole>
      <Position>52</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>9955542 - Disclosure - Income Taxes (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/IncomeTaxesDetails</Role>
      <ShortName>Income Taxes (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://pubmatic.com/role/IncomeTaxes</ParentRole>
      <Position>53</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>9955543 - Disclosure - Segment and Geographical Information - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/SegmentandGeographicalInformationNarrativeDetails</Role>
      <ShortName>Segment and Geographical Information - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>54</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>9955544 - Disclosure - Segment and Geographical Information - Schedule of Segment Reporting Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/SegmentandGeographicalInformationScheduleofSegmentReportingInformationDetails</Role>
      <ShortName>Segment and Geographical Information - Schedule of Segment Reporting Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>55</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>9955545 - Disclosure - Segment and Geographical Information - Schedule of Revenue by Geographic Area Based on Publisher???s Billing Address (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/SegmentandGeographicalInformationScheduleofRevenuebyGeographicAreaBasedonPublishersBillingAddressDetails</Role>
      <ShortName>Segment and Geographical Information - Schedule of Revenue by Geographic Area Based on Publisher???s Billing Address (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>56</Position>
    </Report>
    <Report instance="pubm-20250630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>9955546 - Disclosure - 401(k) Plan (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://pubmatic.com/role/A401kPlanDetails</Role>
      <ShortName>401(k) Plan (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://pubmatic.com/role/A401kPlan</ParentRole>
      <Position>57</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File doctype="10-Q" isDefinitelyFs="true" isUsgaap="true" original="pubm-20250630.htm">pubm-20250630.htm</File>
    <File>pubm-20250630.xsd</File>
    <File>pubm-20250630_cal.xml</File>
    <File>pubm-20250630_def.xml</File>
    <File>pubm-20250630_lab.xml</File>
    <File>pubm-20250630_pre.xml</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy items="4">http://fasb.org/srt/2025</BaseTaxonomy>
    <BaseTaxonomy items="774">http://fasb.org/us-gaap/2025</BaseTaxonomy>
    <BaseTaxonomy items="24">http://xbrl.sec.gov/dei/2025</BaseTaxonomy>
    <BaseTaxonomy items="32">http://xbrl.sec.gov/ecd/2025</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
