How to Automate Justworks Data Export (No API Required)

Feb 19

Introduction

Justworks is a PEO and HR platform used for payroll, benefits, compliance, and workforce management. While Justworks offers some API and integration options, payroll reporting and export features may be limited or only available in the web app. Browser automation can serve as an effective alternative for exporting employee data, payroll runs, benefits information, and compliance reports when API access is restricted or not available for your workflow.

Why Use Browser Automation for Justworks Data Export?

  • Limited or No API Access: Justworks' payroll and reporting features may not be fully exposed via a public or partner API for all modules
  • Dashboard-Only Reports: Custom reports, payroll summaries, and export options are often only available in the web portal
  • Historical Data: Access older payroll, benefits, and HR data beyond API or manual export limits
  • Custom Exports: Generate reports by date range, department, or employee when the portal doesn't offer an API
  • Payroll and Tax: Export pay runs, tax documents, and deduction reports for accounting and compliance
  • Benefits and Compliance: Pull benefits enrollment and compliance data when no API is available
  • Employee Directory and HR: Bulk or custom employee exports for sync with other systems

Setting Up Justworks Data Export Automation

Here's how to automate data collection from Justworks using browser automation:



import { chromium } from 'playwright';

const response = await fetch("https://api.anchorbrowser.io/api/sessions", {
  method: "POST",
  headers: {
    "anchor-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    'headless': false,
    'proxy': {
      'type': 'residential',
      'country': 'US'
    }
  }),
});

const { id } = await response.json();
const connectionString = `wss://connect.anchorbrowser.io?apiKey=YOUR_API_KEY&sessionId=${id}`;

const browser = await chromium.connectOverCDP(connectionString);
const context = browser.contexts()[0];
const ai = context.serviceWorkers()[0];
const page = context.pages()[0];

// Navigate to Justworks
await page.goto("https://app.justworks.com");

// Login with AI agent
await ai.evaluate(JSON.stringify({
  prompt: 'Log in to Justworks using the provided credentials. Wait for the dashboard to fully load.'
}));



Exporting Employee and HR Data

Automate the export of employee and HR data from Justworks:



const exportJustworksEmployees = async (page, ai, options) => {
  await ai.evaluate(JSON.stringify({
    prompt: 'Navigate to the People or Team section, then to the employee list or Reports'
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: `Apply filters if needed. Then run or export the report for ${options.reportType || 'employee data'} (e.g., CSV or Excel).`
  }));
  
  const download = await page.waitForEvent('download');
  return await download.path();
};



Exporting Payroll and Pay Runs

Export payroll runs and pay history when no API is available:



const exportJustworksPayroll = async (page, ai, dateRange) => {
  await ai.evaluate(JSON.stringify({
    prompt: 'Navigate to the Payroll section, then to Pay Runs or Payroll History'
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: `Set the date or pay period filter to ${dateRange.start} to ${dateRange.end}`
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: 'Click Export or Download, select CSV or Excel if available, and wait for the download to complete.'
  }));
  
  const download = await page.waitForEvent('download');
  return await download.path();
};



Benefits and Compliance Reports

Pull benefits and compliance data from Justworks:



const exportJustworksBenefits = async (page, ai) => {
  await ai.evaluate(JSON.stringify({
    prompt: 'Navigate to the Benefits section, then to Reports or Export'
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: 'Export or download the benefits report (enrollment, deductions, etc.). Wait for the download to complete.'
  }));
  
  const download = await page.waitForEvent('download');
  return await download.path();
};

const exportJustworksCompliance = async (page, ai, reportType) => {
  await ai.evaluate(JSON.stringify({
    prompt: 'Navigate to the Compliance or Reports section'
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: `Select and export the ${reportType} report. Wait for the download.`
  }));
  
  const download = await page.waitForEvent('download');
  return await download.path();
};



Tax Documents and Payroll Reports

Download tax documents and payroll reports:



const exportJustworksTaxReports = async (page, ai, reportType, yearOrPeriod) => {
  await ai.evaluate(JSON.stringify({
    prompt: 'Navigate to the Payroll Tax or Reports section'
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: `Select ${reportType} for ${yearOrPeriod} and trigger the export or download`
  }));
  
  const download = await page.waitForEvent('download');
  return await download.path();
};



Best Practices for Justworks Portal Automation

  • Security: Use secure credential storage and support 2FA or SSO if Justworks requires it
  • PII and Payroll: Treat employee and payroll data as sensitive; ensure access controls and encryption
  • Rate Limiting: Add delays between requests to avoid lockouts or triggering security controls
  • Error Handling: Implement retries for transient failures and session timeouts
  • Regular Updates: Justworks may update the portal; monitor UI changes and adjust automation accordingly
  • Terms of Use: Comply with Justworks' terms of use and any contractual restrictions on automated access

Handling Justworks Authentication

Justworks typically uses email/password; some accounts use SSO. Example flow:



const handleJustworksAuth = async (page, ai, credentials) => {
  await page.goto('https://app.justworks.com');
  
  await ai.evaluate(JSON.stringify({
    prompt: `Enter email: ${credentials.email} and password: ${credentials.password}, then click Login or Sign in`
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: 'If 2FA or verification is required, enter the code from the provided method. Choose "Remember this device" if offered.'
  }));
  
  await page.waitForLoadState('networkidle');
};



Resources

Conclusion

Browser automation provides a flexible alternative to Justworks API access for employee, payroll, benefits, and compliance data export. By using browser automation, you can automate data export when the Justworks portal does not expose a full API for your needs. With attention to security and terms of use, you can streamline Justworks data workflows.

Start automating your Justworks data collection and simplify your HR and PEO reporting.

Other hubs

See all
No hubs found

Stay ahead in browser automation

We respect your inbox. Privacy policy

Welcome aboard! Thanks for signing up
Oops! Something went wrong while submitting the form.