
Research
Shai-Hulud Descends to Hades: Miasma Worm Campaign Spreads with New PyPI Wave
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.
@gusto/embedded-api
Advanced tools
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *gusto-embedded* API.
Developer-friendly & type-safe Typescript SDK specifically catered to leverage gusto-embedded API.
[!IMPORTANT] This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.
Gusto API: Welcome to Gusto's Embedded Payroll API documentation!
The SDK can be installed with either npm, pnpm, bun or yarn package managers.
npm add @gusto/embedded-api
# Install optional peer dependencies if you plan to use React hooks
npm add @tanstack/react-query react react-dom
pnpm add @gusto/embedded-api
# Install optional peer dependencies if you plan to use React hooks
pnpm add @tanstack/react-query react react-dom
bun add @gusto/embedded-api
# Install optional peer dependencies if you plan to use React hooks
bun add @tanstack/react-query react react-dom
yarn add @gusto/embedded-api zod
# Install optional peer dependencies if you plan to use React hooks
yarn add @tanstack/react-query react react-dom
# Note that Yarn does not install peer dependencies automatically. You will need
# to install zod as shown above.
For supported JavaScript runtimes, please consult RUNTIMES.md.
import { GustoEmbedded } from "@gusto/embedded-api";
const gustoEmbedded = new GustoEmbedded({
companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});
async function run() {
const result = await gustoEmbedded.introspection.getTokenInfo({});
// Handle the result
console.log(result);
}
run();
This SDK supports the following security scheme globally:
| Name | Type | Scheme | Environment Variable |
|---|---|---|---|
companyAccessAuth | http | HTTP Bearer | GUSTOEMBEDDED_COMPANY_ACCESS_AUTH |
To authenticate with the API the companyAccessAuth parameter must be set when initializing the SDK client instance. For example:
import { GustoEmbedded } from "@gusto/embedded-api";
const gustoEmbedded = new GustoEmbedded({
companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});
async function run() {
const result = await gustoEmbedded.introspection.getTokenInfo({});
// Handle the result
console.log(result);
}
run();
Some operations in this SDK require the security scheme to be specified at the request level. For example:
import { GustoEmbedded } from "@gusto/embedded-api";
const gustoEmbedded = new GustoEmbedded();
async function run() {
const result = await gustoEmbedded.companies.createPartnerManaged({
systemAccessAuth: process.env["GUSTOEMBEDDED_SYSTEM_ACCESS_AUTH"] ?? "",
}, {
requestBody: {
user: {
firstName: "Frank",
lastName: "Ocean",
email: "frank@example.com",
phone: "2345558899",
},
company: {
name: "Frank's Ocean, LLC",
tradeName: "Frank’s Ocean",
ein: "123456789",
contractorOnly: false,
},
},
});
// Handle the result
console.log(result);
}
run();
All the methods listed above are available as standalone functions. These functions are ideal for use in applications running in the browser, serverless runtimes or other environments where application bundle size is a primary concern. When using a bundler to build your application, all unused functionality will be either excluded from the final bundle or tree-shaken away.
To read more about standalone functions, check FUNCTIONS.md.
achTransactionsGet - Get all ACH transactions for a companybankAccountsCreate - Create a company bank accountbankAccountsCreateFromProcessorToken - Create a bank account from a plaid processor tokenbankAccountsList - Get all company bank accountsbankAccountsVerify - Verify a company bank accountcompaniesAcceptTermsOfService - Accept terms of service for a company usercompaniesBenefitsList - Get benefits for a companycompaniesCreateAdmin - Create an admin for the companycompaniesCreatePartnerManaged - Create a partner managed companycompaniesFinishOnboarding - Finish company onboardingcompaniesFormsList - Get all company formscompaniesGet - Get a companycompaniesGetAdmins - Get all the admins at a companycompaniesGetCustomFields - Get the custom fields of a companycompaniesGetOnboardingStatus - Get the company's onboarding statuscompaniesMigrate - Migrate company to embedded payrollcompaniesRetrieveTermsOfService - Retrieve terms of service status for a company usercompaniesUpdate - Update a companycompanyAttachmentGetDownloadUrl - Get a temporary url to download the Company Attachment filecompanyAttachmentsCreate - Create Company Attachment and Upload FilecompanyAttachmentsGetAll - Get List of Company AttachmentscompanyAttachmentsGetDetails - Get Company Attachment DetailscompanyBenefitsBulkUpdateEmployeeBenefits - Bulk update employee benefits for a company benefitcompanyBenefitsCreate - Create a company benefitcompanyBenefitsDelete - Delete a company benefitcompanyBenefitsGet - Get a company benefitcompanyBenefitsGetAll - Get all benefits supported by GustocompanyBenefitsGetEmployeeBenefits - Get all employee benefits for a company benefitcompanyBenefitsGetRequirements - Get benefit fields requirements by IDcompanyBenefitsGetSummary - Get company benefit summary by company benefit id.companyBenefitsGetSupportedBenefit - Get a supported benefit by IDcompanyBenefitsUpdate - Update a company benefitcompanyFormsGet - Get a company formcompanyFormsGetPdf - Get a company form pdfcompanyFormsSign - Sign a company formcontractorDocumentsGet - Get a contractor documentcontractorDocumentsGetPdf - Get the contractor document pdfcontractorDocumentsList - Get all contractor documentscontractorDocumentsSign - Sign a contractor documentcontractorFormsGenerate1099 - Generate a 1099 form [DEMO]contractorFormsGet - Get a contractor formcontractorFormsGetAll - Get all contractor formscontractorFormsGetPdf - Get the contractor form pdfcontractorPaymentGroupsCreate - Create a contractor payment groupcontractorPaymentGroupsDelete - Cancel a contractor payment groupcontractorPaymentGroupsFund - Fund a contractor payment group [DEMO]contractorPaymentGroupsGet - Fetch a contractor payment groupcontractorPaymentGroupsList - Get contractor payment groups for a companycontractorPaymentGroupsPreview - Preview a contractor payment groupcontractorPaymentMethodCreateBankAccount - Create a contractor bank accountcontractorPaymentMethodGet - Get a contractor's payment methodcontractorPaymentMethodGetBankAccounts - Get all contractor bank accountscontractorPaymentMethodUpdatePaymentMethod - Update a contractor's payment methodcontractorPaymentsCancel - Cancel a contractor paymentcontractorPaymentsCreate - Create a contractor paymentcontractorPaymentsFund - Fund a contractor payment [DEMO]contractorPaymentsGet - Get a single contractor paymentcontractorPaymentsGetPayments - Get contractor payments for a companycontractorPaymentsGetReceipt - Get a single contractor payment receiptcontractorsCreate - Create a contractorcontractorsDelete - Delete a contractorcontractorsGet - Get a contractorcontractorsGetAddress - Get a contractor addresscontractorsGetOnboardingStatus - Get the contractor's onboarding statuscontractorsList - Get contractors of a companycontractorsUpdate - Update a contractorcontractorsUpdateAddress - Update a contractor's addresscontractorsUpdateOnboardingStatus - Change the contractor's onboarding statusdepartmentsAddPeople - Add people to a departmentdepartmentsCreate - Create a departmentdepartmentsDelete - Delete a departmentdepartmentsGet - Get a departmentdepartmentsList - Get all departments of a companydepartmentsRemovePeople - Remove people from a departmentdepartmentsUpdate - Update a departmentearningTypesCreate - Create a custom earning typeearningTypesDeactivate - Deactivate an earning typeearningTypesGetAll - Get all earning types for a companyearningTypesUpdate - Update an earning typeemployeeAddressesCreate - Create an employee's home addressemployeeAddressesDelete - Delete an employee's work addressemployeeAddressesGet - Get an employee's work addressesemployeeAddressesGetHomeAddress - Get an employee's home addressemployeeAddressesGetHomeAddresses - Get an employee's home addressesemployeeAddressesGetWorkAddress - Get an employee work addressemployeeAddressesRemoveHomeAddress - Delete an employee's home addressemployeeAddressesUpdateHomeAddress - Update an employee's home addressemployeeAddressesUpdateWorkAddress - Update an employee work addressemployeeAddressesWorkAddressesCreate - Create an employee work addressemployeeBenefitsCreateBenefit - Create an employee benefitemployeeBenefitsCreateYtdAmountsFromDifferentCompany - Create year-to-date benefit amounts from a different companyemployeeBenefitsDelete - Delete an employee benefitemployeeBenefitsGet - Get an employee benefitemployeeBenefitsGetAll - Get all benefits for an employeeemployeeBenefitsGetEmployeeYtdBenefitAmountsFromDifferentCompany - Get year-to-date benefit amounts from a different companyemployeeBenefitsUpdate - Update an employee benefitemployeeEmploymentsCreateRehire - Create an employee rehireemployeeEmploymentsCreateTermination - Create an employee terminationemployeeEmploymentsDeleteRehire - Delete an employee rehireemployeeEmploymentsDeleteTermination - Delete an employee terminationemployeeEmploymentsGetHistory - Get employment history for an employeeemployeeEmploymentsGetRehire - Get an employee rehireemployeeEmploymentsGetTermination - Get terminations for an employeeemployeeEmploymentsUpdateRehire - Update an employee rehireemployeeEmploymentsUpdateTermination - Update an employee terminationemployeeFormsGenerateW2 - Generate a W2 form [DEMO]employeeFormsGetAll - Get all employee formsemployeeFormsGetForm - Get an employee formemployeeFormsGetPdf - Get the employee form pdfemployeeFormsSign - Sign an employee formemployeePaymentMethodCreateBankAccount - Create an employee bank accountemployeePaymentMethodDeleteBankAccount - Delete an employee bank accountemployeePaymentMethodGet - Get an employee's payment methodemployeePaymentMethodsGetBankAccounts - Get all employee bank accountsemployeePaymentMethodUpdate - Update an employee's payment methodemployeePaymentMethodUpdateBankAccount - Update an employee bank accountemployeesCreate - Create an employeeemployeesCreateHistorical - Create a historical employeeemployeesDelete - Delete an onboarding employeeemployeesGet - Get employees of a companyemployeesGetCustomFields - Get an employee's custom fieldsemployeesGetOnboardingStatus - Get the employee's onboarding statusemployeesGetTimeOffActivities - Get employee time off activitiesemployeesRetrieve - Get an employeeemployeesUpdate - Update an employeeemployeesUpdateHistorical - Update a historical employeeemployeesUpdateOnboardingDocumentsConfig - Update an employee's onboarding documents configemployeesUpdateOnboardingStatus - Update the employee's onboarding statusemployeeTaxSetupGetFederalTaxes - Get an employee's federal taxesemployeeTaxSetupGetStateTaxes - Get an employee's state taxesemployeeTaxSetupUpdateFederalTaxes - Update an employee's federal taxesemployeeTaxSetupUpdateStateTaxes - Update an employee's state taxeseventsList - Get all eventsexternalPayrollsCreate - Create a new external payroll for a companyexternalPayrollsDelete - Delete an external payrollexternalPayrollsFinalizeTaxLiabilities - Finalize tax liabilities options and convert into processed payrollsexternalPayrollsGet - Get an external payrollexternalPayrollsGetTaxLiabilities - Get tax liabilitiesexternalPayrollsGetTaxSuggestions - Get tax suggestions for an external payrollexternalPayrollsList - Get external payrolls for a companyexternalPayrollsUpdate - Update an external payrollexternalPayrollsUpdateTaxLiabilities - Update tax liabilitiesfederalTaxDetailsGet - Get Federal Tax DetailsfederalTaxDetailsUpdate - Update Federal Tax DetailsflowsCreate - Create a flowgarnishmentsCreate - Create a garnishmentgarnishmentsFetch - Get a garnishmentgarnishmentsGet - Get garnishments for an employeegarnishmentsGetChildSupport - Get child support garnishment datagarnishmentsUpdate - Update a garnishmentgeneratedDocumentsGet - Get a generated documentholidayPayPoliciesAddEmployees - Add employees to a company's holiday pay policyholidayPayPoliciesCreate - Create a holiday pay policy for a companyholidayPayPoliciesDelete - Delete a company's holiday pay policyholidayPayPoliciesGet - Get a company's holiday pay policyholidayPayPoliciesRemoveEmployees - Remove employees from a company's holiday pay policyholidayPayPoliciesUpdate - Update a company's holiday pay policyi9VerificationCreateDocuments - Create an employee's I-9 authorization verification documentsi9VerificationCreateOrUpdate - Create or update an employee's I-9 authorizationi9VerificationDeleteDocument - Delete an employee's I-9 verification documenti9VerificationEmployerSign - Employer sign an employee's Form I-9i9VerificationGetAuthorization - Get an employee's I-9 authorizationi9VerificationGetDocumentOptions - Get an employee's I-9 verification document optionsi9VerificationGetDocuments - Get an employee's I-9 verification documentsindustrySelectionGet - Get a company industry selectionindustrySelectionUpdate - Update a company industry selectionintrospectionGetTokenInfo - Get info about the current access tokenintrospectionRefreshAccessToken - Refresh access tokeninvoicesGet - Retrieve invoicing data for companiesjobsAndCompensationsCreateCompensation - Create a compensationjobsAndCompensationsCreateJob - Create a jobjobsAndCompensationsDeleteCompensation - Delete a compensationjobsAndCompensationsDeleteJob - Delete an individual jobjobsAndCompensationsGetCompensation - Get a compensationjobsAndCompensationsGetCompensations - Get compensations for a jobjobsAndCompensationsGetJob - Get a jobjobsAndCompensationsGetJobs - Get jobs for an employeejobsAndCompensationsUpdate - Update a jobjobsAndCompensationsUpdateCompensation - Update a compensationlocationsCreate - Create a company locationlocationsGet - Get a locationlocationsGetAll - Get company locationslocationsGetMinimumWages - Get minimum wages for a locationlocationsUpdate - Update a locationnotificationsGet - Get a notification's detailspaymentConfigsGet - Get a company's payment configspaymentConfigsUpdate - Update a company's payment configspayrollsCalculate - Calculate a payrollpayrollsCalculateGrossUp - Calculate gross uppayrollsCancel - Cancel a payrollpayrollsCreate - Create an off-cycle payrollpayrollsDelete - Delete a payrollpayrollsGeneratePrintableChecks - Generate printable payroll checks (pdf)payrollsGet - Get a single payrollpayrollsGetAll - Get all payrolls for a companypayrollsGetBlockers - Get all payroll blockers for a companypayrollsGetPayStub - Get an employee pay stub (pdf)payrollsGetPayStubs - Get an employee's pay stubspayrollsGetReceipt - Get a single payroll receiptpayrollsGetReversals - Get approved payroll reversalspayrollsPrepareForUpdate - Prepare a payroll for updatepayrollsSkip - Skip a payrollpayrollsSubmit - Submit payrollpayrollsUpdate - Update a payroll by IDpaySchedulesAssign - Assign pay schedules for a companypaySchedulesCreate - Create a new pay schedulepaySchedulesGet - Get a pay schedulepaySchedulesGetAssignments - Get pay schedule assignments for a companypaySchedulesGetForCompany - Get the pay schedules for a companypaySchedulesList - Get pay periods for a companypaySchedulesListUnprocessedTerminationPeriods - Get termination pay periods for a companypaySchedulesPreview - Preview pay schedule datespaySchedulesPreviewAssignment - Preview pay schedule assignments for a companypaySchedulesUpdate - Update a pay schedulerecoveryCasesGetAll - Get all recovery cases for a companyrecoveryCasesRedebit - Initiate a redebit for a recovery casereportsCreate - Create a custom reportreportsGet - Get a reportreportsGetTemplate - Get a report templatesignatoriesCreate - Create a signatorysignatoriesDelete - Delete a signatorysignatoriesGet - Get all company signatoriessignatoriesInvite - Invite a signatorysignatoriesUpdate - Update a signatorytaxRequirementsGetAll - Get All Tax Requirement StatestaxRequirementsGetByState - Get State Tax RequirementstaxRequirementsUpdate - Update State Tax RequirementstimeOffPoliciesAddEmployees - Add employees to a time off policytimeOffPoliciesCalculateAccruingHours - Calculate accruing time off hourstimeOffPoliciesCreate - Create a time off policytimeOffPoliciesDeactivate - Deactivate a time off policytimeOffPoliciesGet - Get all time off policiestimeOffPoliciesRemoveEmployees - Remove employees from a time off policytimeOffPoliciesRetrieve - Get a time off policytimeOffPoliciesUpdate - Update a time off policytimeOffPoliciesUpdateBalance - Update employee time off hour balanceswebhooksCreateSubscription - Create a webhook subscriptionwebhooksDelete - Delete a webhook subscriptionwebhooksGet - Get a webhook subscriptionwebhooksListSubscriptions - List webhook subscriptionswebhooksRequestVerificationToken - Request the webhook subscription verification_tokenwebhooksUpdateSubscription - Update a webhook subscriptionwebhooksVerifySubscription - Verify the webhook subscriptionwireInRequestsGet - Get a single Wire In RequestwireInRequestsGetAll - Get all Wire In Requests for a companywireInRequestsSubmitRequest - Submit a wire in requestReact hooks built on TanStack Query are included in this SDK. These hooks and the utility functions provided alongside them can be used to build rich applications that pull data from the API using one of the most popular asynchronous state management library.
To learn about this feature and how to get started, check REACT_QUERY.md.
[!WARNING]
This feature is currently in preview and is subject to breaking changes within the current major version of the SDK as we gather user feedback on it.
useAchTransactionsGet - Get all ACH transactions for a companyuseBankAccountsCreateFromProcessorTokenMutation - Create a bank account from a plaid processor tokenuseBankAccountsCreateMutation - Create a company bank accountuseBankAccountsList - Get all company bank accountsuseBankAccountsVerifyMutation - Verify a company bank accountuseCompaniesAcceptTermsOfServiceMutation - Accept terms of service for a company useruseCompaniesBenefitsList - Get benefits for a companyuseCompaniesCreateAdminMutation - Create an admin for the companyuseCompaniesCreatePartnerManagedMutation - Create a partner managed companyuseCompaniesFinishOnboardingMutation - Finish company onboardinguseCompaniesFormsList - Get all company formsuseCompaniesGet - Get a companyuseCompaniesGetAdmins - Get all the admins at a companyuseCompaniesGetCustomFields - Get the custom fields of a companyuseCompaniesGetOnboardingStatus - Get the company's onboarding statususeCompaniesMigrateMutation - Migrate company to embedded payrolluseCompaniesRetrieveTermsOfServiceMutation - Retrieve terms of service status for a company useruseCompaniesUpdateMutation - Update a companyuseCompanyAttachmentGetDownloadUrl - Get a temporary url to download the Company Attachment fileuseCompanyAttachmentsCreateMutation - Create Company Attachment and Upload FileuseCompanyAttachmentsGetAll - Get List of Company AttachmentsuseCompanyAttachmentsGetDetails - Get Company Attachment DetailsuseCompanyBenefitsBulkUpdateEmployeeBenefitsMutation - Bulk update employee benefits for a company benefituseCompanyBenefitsCreateMutation - Create a company benefituseCompanyBenefitsDeleteMutation - Delete a company benefituseCompanyBenefitsGet - Get a company benefituseCompanyBenefitsGetAll - Get all benefits supported by GustouseCompanyBenefitsGetEmployeeBenefits - Get all employee benefits for a company benefituseCompanyBenefitsGetRequirements - Get benefit fields requirements by IDuseCompanyBenefitsGetSummary - Get company benefit summary by company benefit id.useCompanyBenefitsGetSupportedBenefit - Get a supported benefit by IDuseCompanyBenefitsUpdateMutation - Update a company benefituseCompanyFormsGet - Get a company formuseCompanyFormsGetPdf - Get a company form pdfuseCompanyFormsSignMutation - Sign a company formuseContractorDocumentsGet - Get a contractor documentuseContractorDocumentsGetPdf - Get the contractor document pdfuseContractorDocumentsList - Get all contractor documentsuseContractorDocumentsSignMutation - Sign a contractor documentuseContractorFormsGenerate1099Mutation - Generate a 1099 form [DEMO]useContractorFormsGet - Get a contractor formuseContractorFormsGetAll - Get all contractor formsuseContractorFormsGetPdf - Get the contractor form pdfuseContractorPaymentGroupsCreateMutation - Create a contractor payment groupuseContractorPaymentGroupsDeleteMutation - Cancel a contractor payment groupuseContractorPaymentGroupsFundMutation - Fund a contractor payment group [DEMO]useContractorPaymentGroupsGet - Fetch a contractor payment groupuseContractorPaymentGroupsList - Get contractor payment groups for a companyuseContractorPaymentGroupsPreviewMutation - Preview a contractor payment groupuseContractorPaymentMethodCreateBankAccountMutation - Create a contractor bank accountuseContractorPaymentMethodGet - Get a contractor's payment methoduseContractorPaymentMethodGetBankAccounts - Get all contractor bank accountsuseContractorPaymentMethodUpdatePaymentMethodMutation - Update a contractor's payment methoduseContractorPaymentsCancelMutation - Cancel a contractor paymentuseContractorPaymentsCreateMutation - Create a contractor paymentuseContractorPaymentsFundMutation - Fund a contractor payment [DEMO]useContractorPaymentsGet - Get a single contractor paymentuseContractorPaymentsGetPayments - Get contractor payments for a companyuseContractorPaymentsGetReceipt - Get a single contractor payment receiptuseContractorsCreateMutation - Create a contractoruseContractorsDeleteMutation - Delete a contractoruseContractorsGet - Get a contractoruseContractorsGetAddress - Get a contractor addressuseContractorsGetOnboardingStatus - Get the contractor's onboarding statususeContractorsList - Get contractors of a companyuseContractorsUpdateAddressMutation - Update a contractor's addressuseContractorsUpdateMutation - Update a contractoruseContractorsUpdateOnboardingStatusMutation - Change the contractor's onboarding statususeDepartmentsAddPeopleMutation - Add people to a departmentuseDepartmentsCreateMutation - Create a departmentuseDepartmentsDeleteMutation - Delete a departmentuseDepartmentsGet - Get a departmentuseDepartmentsList - Get all departments of a companyuseDepartmentsRemovePeopleMutation - Remove people from a departmentuseDepartmentsUpdateMutation - Update a departmentuseEarningTypesCreateMutation - Create a custom earning typeuseEarningTypesDeactivateMutation - Deactivate an earning typeuseEarningTypesGetAll - Get all earning types for a companyuseEarningTypesUpdateMutation - Update an earning typeuseEmployeeAddressesCreateMutation - Create an employee's home addressuseEmployeeAddressesDeleteMutation - Delete an employee's work addressuseEmployeeAddressesGet - Get an employee's work addressesuseEmployeeAddressesGetHomeAddress - Get an employee's home addressuseEmployeeAddressesGetHomeAddresses - Get an employee's home addressesuseEmployeeAddressesGetWorkAddress - Get an employee work addressuseEmployeeAddressesRemoveHomeAddressMutation - Delete an employee's home addressuseEmployeeAddressesUpdateHomeAddressMutation - Update an employee's home addressuseEmployeeAddressesUpdateWorkAddressMutation - Update an employee work addressuseEmployeeAddressesWorkAddressesCreateMutation - Create an employee work addressuseEmployeeBenefitsCreateBenefitMutation - Create an employee benefituseEmployeeBenefitsCreateYtdAmountsFromDifferentCompanyMutation - Create year-to-date benefit amounts from a different companyuseEmployeeBenefitsDeleteMutation - Delete an employee benefituseEmployeeBenefitsGet - Get an employee benefituseEmployeeBenefitsGetAll - Get all benefits for an employeeuseEmployeeBenefitsGetEmployeeYtdBenefitAmountsFromDifferentCompany - Get year-to-date benefit amounts from a different companyuseEmployeeBenefitsUpdateMutation - Update an employee benefituseEmployeeEmploymentsCreateRehireMutation - Create an employee rehireuseEmployeeEmploymentsCreateTerminationMutation - Create an employee terminationuseEmployeeEmploymentsDeleteRehireMutation - Delete an employee rehireuseEmployeeEmploymentsDeleteTerminationMutation - Delete an employee terminationuseEmployeeEmploymentsGetHistory - Get employment history for an employeeuseEmployeeEmploymentsGetRehire - Get an employee rehireuseEmployeeEmploymentsGetTermination - Get terminations for an employeeuseEmployeeEmploymentsUpdateRehireMutation - Update an employee rehireuseEmployeeEmploymentsUpdateTerminationMutation - Update an employee terminationuseEmployeeFormsGenerateW2Mutation - Generate a W2 form [DEMO]useEmployeeFormsGetAll - Get all employee formsuseEmployeeFormsGetForm - Get an employee formuseEmployeeFormsGetPdf - Get the employee form pdfuseEmployeeFormsSignMutation - Sign an employee formuseEmployeePaymentMethodCreateBankAccountMutation - Create an employee bank accountuseEmployeePaymentMethodDeleteBankAccountMutation - Delete an employee bank accountuseEmployeePaymentMethodGet - Get an employee's payment methoduseEmployeePaymentMethodsGetBankAccounts - Get all employee bank accountsuseEmployeePaymentMethodUpdateBankAccountMutation - Update an employee bank accountuseEmployeePaymentMethodUpdateMutation - Update an employee's payment methoduseEmployeesCreateHistoricalMutation - Create a historical employeeuseEmployeesCreateMutation - Create an employeeuseEmployeesDeleteMutation - Delete an onboarding employeeuseEmployeesGet - Get employees of a companyuseEmployeesGetCustomFields - Get an employee's custom fieldsuseEmployeesGetOnboardingStatus - Get the employee's onboarding statususeEmployeesGetTimeOffActivities - Get employee time off activitiesuseEmployeesRetrieve - Get an employeeuseEmployeesUpdateHistoricalMutation - Update a historical employeeuseEmployeesUpdateMutation - Update an employeeuseEmployeesUpdateOnboardingDocumentsConfigMutation - Update an employee's onboarding documents configuseEmployeesUpdateOnboardingStatusMutation - Update the employee's onboarding statususeEmployeeTaxSetupGetFederalTaxes - Get an employee's federal taxesuseEmployeeTaxSetupGetStateTaxes - Get an employee's state taxesuseEmployeeTaxSetupUpdateFederalTaxesMutation - Update an employee's federal taxesuseEmployeeTaxSetupUpdateStateTaxesMutation - Update an employee's state taxesuseEventsList - Get all eventsuseExternalPayrollsCreateMutation - Create a new external payroll for a companyuseExternalPayrollsDeleteMutation - Delete an external payrolluseExternalPayrollsFinalizeTaxLiabilitiesMutation - Finalize tax liabilities options and convert into processed payrollsuseExternalPayrollsGet - Get an external payrolluseExternalPayrollsGetTaxLiabilities - Get tax liabilitiesuseExternalPayrollsGetTaxSuggestions - Get tax suggestions for an external payrolluseExternalPayrollsList - Get external payrolls for a companyuseExternalPayrollsUpdateMutation - Update an external payrolluseExternalPayrollsUpdateTaxLiabilitiesMutation - Update tax liabilitiesuseFederalTaxDetailsGet - Get Federal Tax DetailsuseFederalTaxDetailsUpdateMutation - Update Federal Tax DetailsuseFlowsCreateMutation - Create a flowuseGarnishmentsCreateMutation - Create a garnishmentuseGarnishmentsFetch - Get a garnishmentuseGarnishmentsGet - Get garnishments for an employeeuseGarnishmentsGetChildSupport - Get child support garnishment datauseGarnishmentsUpdateMutation - Update a garnishmentuseGeneratedDocumentsGet - Get a generated documentuseHolidayPayPoliciesAddEmployeesMutation - Add employees to a company's holiday pay policyuseHolidayPayPoliciesCreateMutation - Create a holiday pay policy for a companyuseHolidayPayPoliciesDeleteMutation - Delete a company's holiday pay policyuseHolidayPayPoliciesGet - Get a company's holiday pay policyuseHolidayPayPoliciesRemoveEmployeesMutation - Remove employees from a company's holiday pay policyuseHolidayPayPoliciesUpdateMutation - Update a company's holiday pay policyuseI9VerificationCreateDocumentsMutation - Create an employee's I-9 authorization verification documentsuseI9VerificationCreateOrUpdateMutation - Create or update an employee's I-9 authorizationuseI9VerificationDeleteDocumentMutation - Delete an employee's I-9 verification documentuseI9VerificationEmployerSignMutation - Employer sign an employee's Form I-9useI9VerificationGetAuthorization - Get an employee's I-9 authorizationuseI9VerificationGetDocumentOptions - Get an employee's I-9 verification document optionsuseI9VerificationGetDocuments - Get an employee's I-9 verification documentsuseIndustrySelectionGet - Get a company industry selectionuseIndustrySelectionUpdateMutation - Update a company industry selectionuseIntrospectionGetTokenInfo - Get info about the current access tokenuseIntrospectionRefreshAccessTokenMutation - Refresh access tokenuseInvoicesGet - Retrieve invoicing data for companiesuseJobsAndCompensationsCreateCompensationMutation - Create a compensationuseJobsAndCompensationsCreateJobMutation - Create a jobuseJobsAndCompensationsDeleteCompensationMutation - Delete a compensationuseJobsAndCompensationsDeleteJobMutation - Delete an individual jobuseJobsAndCompensationsGetCompensation - Get a compensationuseJobsAndCompensationsGetCompensations - Get compensations for a jobuseJobsAndCompensationsGetJob - Get a jobuseJobsAndCompensationsGetJobs - Get jobs for an employeeuseJobsAndCompensationsUpdateCompensationMutation - Update a compensationuseJobsAndCompensationsUpdateMutation - Update a jobuseLocationsCreateMutation - Create a company locationuseLocationsGet - Get a locationuseLocationsGetAll - Get company locationsuseLocationsGetMinimumWages - Get minimum wages for a locationuseLocationsUpdateMutation - Update a locationuseNotificationsGet - Get a notification's detailsusePaymentConfigsGet - Get a company's payment configsusePaymentConfigsUpdateMutation - Update a company's payment configsusePayrollsCalculateGrossUpMutation - Calculate gross upusePayrollsCalculateMutation - Calculate a payrollusePayrollsCancelMutation - Cancel a payrollusePayrollsCreateMutation - Create an off-cycle payrollusePayrollsDeleteMutation - Delete a payrollusePayrollsGeneratePrintableChecksMutation - Generate printable payroll checks (pdf)usePayrollsGet - Get a single payrollusePayrollsGetAll - Get all payrolls for a companyusePayrollsGetBlockers - Get all payroll blockers for a companyusePayrollsGetPayStub - Get an employee pay stub (pdf)usePayrollsGetPayStubs - Get an employee's pay stubsusePayrollsGetReceipt - Get a single payroll receiptusePayrollsGetReversals - Get approved payroll reversalsusePayrollsPrepareForUpdateMutation - Prepare a payroll for updateusePayrollsSkipMutation - Skip a payrollusePayrollsSubmitMutation - Submit payrollusePayrollsUpdateMutation - Update a payroll by IDusePaySchedulesAssignMutation - Assign pay schedules for a companyusePaySchedulesCreateMutation - Create a new pay scheduleusePaySchedulesGet - Get a pay scheduleusePaySchedulesGetAssignments - Get pay schedule assignments for a companyusePaySchedulesGetForCompany - Get the pay schedules for a companyusePaySchedulesList - Get pay periods for a companyusePaySchedulesListUnprocessedTerminationPeriods - Get termination pay periods for a companyusePaySchedulesPreview - Preview pay schedule datesusePaySchedulesPreviewAssignmentMutation - Preview pay schedule assignments for a companyusePaySchedulesUpdateMutation - Update a pay scheduleuseRecoveryCasesGetAll - Get all recovery cases for a companyuseRecoveryCasesRedebitMutation - Initiate a redebit for a recovery caseuseReportsCreateMutation - Create a custom reportuseReportsGet - Get a reportuseReportsGetTemplate - Get a report templateuseSignatoriesCreateMutation - Create a signatoryuseSignatoriesDeleteMutation - Delete a signatoryuseSignatoriesGet - Get all company signatoriesuseSignatoriesInviteMutation - Invite a signatoryuseSignatoriesUpdateMutation - Update a signatoryuseTaxRequirementsGetAll - Get All Tax Requirement StatesuseTaxRequirementsGetByState - Get State Tax RequirementsuseTaxRequirementsUpdateMutation - Update State Tax RequirementsuseTimeOffPoliciesAddEmployeesMutation - Add employees to a time off policyuseTimeOffPoliciesCalculateAccruingHoursMutation - Calculate accruing time off hoursuseTimeOffPoliciesCreateMutation - Create a time off policyuseTimeOffPoliciesDeactivateMutation - Deactivate a time off policyuseTimeOffPoliciesGet - Get all time off policiesuseTimeOffPoliciesRemoveEmployeesMutation - Remove employees from a time off policyuseTimeOffPoliciesRetrieve - Get a time off policyuseTimeOffPoliciesUpdateBalanceMutation - Update employee time off hour balancesuseTimeOffPoliciesUpdateMutation - Update a time off policyuseWebhooksCreateSubscriptionMutation - Create a webhook subscriptionuseWebhooksDeleteMutation - Delete a webhook subscriptionuseWebhooksGet - Get a webhook subscriptionuseWebhooksListSubscriptions - List webhook subscriptionsuseWebhooksRequestVerificationToken - Request the webhook subscription verification_tokenuseWebhooksUpdateSubscriptionMutation - Update a webhook subscriptionuseWebhooksVerifySubscriptionMutation - Verify the webhook subscriptionuseWireInRequestsGet - Get a single Wire In RequestuseWireInRequestsGetAll - Get all Wire In Requests for a companyuseWireInRequestsSubmitRequestMutation - Submit a wire in requestCertain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
[!TIP]
Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
- Node.js v20+: Since v20, Node.js comes with a native
openAsBlobfunction innode:fs.- Bun: The native
Bun.filefunction produces a file handle that can be used for streaming file uploads.- Browsers: All supported browsers return an instance to a
Filewhen reading the value from an<input type="file">element.- Node.js v18: A file stream can be created using the
fileFromhelper fromfetch-blob/from.js.
import { GustoEmbedded } from "@gusto/embedded-api";
import { openAsBlob } from "node:fs";
const gustoEmbedded = new GustoEmbedded({
companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});
async function run() {
const result = await gustoEmbedded.companyAttachments.create({
companyId: "<id>",
requestBody: {
category: "gep_notice",
document: await openAsBlob("example.file"),
},
});
// Handle the result
console.log(result);
}
run();
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
import { GustoEmbedded } from "@gusto/embedded-api";
const gustoEmbedded = new GustoEmbedded({
companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});
async function run() {
const result = await gustoEmbedded.introspection.getTokenInfo({}, {
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});
// Handle the result
console.log(result);
}
run();
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
import { GustoEmbedded } from "@gusto/embedded-api";
const gustoEmbedded = new GustoEmbedded({
retryConfig: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});
async function run() {
const result = await gustoEmbedded.introspection.getTokenInfo({});
// Handle the result
console.log(result);
}
run();
Some methods specify known errors which can be thrown. All the known errors are enumerated in the models/errors/errors.ts module. The known errors for a method are documented under the Errors tables in SDK docs. For example, the createPartnerManaged method may throw the following errors:
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnprocessableEntityErrorObject | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
If the method throws an error and it is not captured by the known errors, it will default to throwing a APIError.
import { GustoEmbedded } from "@gusto/embedded-api";
import {
SDKValidationError,
UnprocessableEntityErrorObject,
} from "@gusto/embedded-api/models/errors";
const gustoEmbedded = new GustoEmbedded();
async function run() {
let result;
try {
result = await gustoEmbedded.companies.createPartnerManaged({
systemAccessAuth: process.env["GUSTOEMBEDDED_SYSTEM_ACCESS_AUTH"] ?? "",
}, {
requestBody: {
user: {
firstName: "Frank",
lastName: "Ocean",
email: "frank@example.com",
phone: "2345558899",
},
company: {
name: "Frank's Ocean, LLC",
tradeName: "Frank’s Ocean",
ein: "123456789",
contractorOnly: false,
},
},
});
// Handle the result
console.log(result);
} catch (err) {
switch (true) {
// The server response does not match the expected SDK schema
case (err instanceof SDKValidationError): {
// Pretty-print will provide a human-readable multi-line error message
console.error(err.pretty());
// Raw value may also be inspected
console.error(err.rawValue);
return;
}
case (err instanceof UnprocessableEntityErrorObject): {
// Handle err.data$: UnprocessableEntityErrorObjectData
console.error(err);
return;
}
default: {
// Other errors such as network errors, see HTTPClientErrors for more details
throw err;
}
}
}
}
run();
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The SDKValidationError that is thrown as a result will capture the raw value that failed validation in an attribute called rawValue. Additionally, a pretty() method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the models/errors/httpclienterrors.ts module:
| HTTP Client Error | Description |
|---|---|
| RequestAbortedError | HTTP request was aborted by the client |
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
| ConnectionError | HTTP client was unable to make a request to a server |
| InvalidRequestError | Any input used to create a request is invalid |
| UnexpectedClientError | Unrecognised or unexpected error |
You can override the default server globally by passing a server name to the server: keyof typeof ServerList optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
| Name | Server |
|---|---|
demo | https://api.gusto-demo.com |
prod | https://api.gusto.com |
import { GustoEmbedded } from "@gusto/embedded-api";
const gustoEmbedded = new GustoEmbedded({
server: "prod",
companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});
async function run() {
const result = await gustoEmbedded.introspection.getTokenInfo({});
// Handle the result
console.log(result);
}
run();
The default server can also be overridden globally by passing a URL to the serverURL: string optional parameter when initializing the SDK client instance. For example:
import { GustoEmbedded } from "@gusto/embedded-api";
const gustoEmbedded = new GustoEmbedded({
serverURL: "https://api.gusto-demo.com",
companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});
async function run() {
const result = await gustoEmbedded.introspection.getTokenInfo({});
// Handle the result
console.log(result);
}
run();
The TypeScript SDK makes API calls using an HTTPClient that wraps the native
Fetch API. This
client is a thin wrapper around fetch and provides the ability to attach hooks
around the request lifecycle that can be used to modify the request or handle
errors and response.
The HTTPClient constructor takes an optional fetcher argument that can be
used to integrate a third-party HTTP client or when writing tests to mock out
the HTTP client and feed in fixtures.
The following example shows how to use the "beforeRequest" hook to to add a
custom header and a timeout to requests and how to use the "requestError" hook
to log errors:
import { GustoEmbedded } from "@gusto/embedded-api";
import { HTTPClient } from "@gusto/embedded-api/lib/http";
const httpClient = new HTTPClient({
// fetcher takes a function that has the same signature as native `fetch`.
fetcher: (request) => {
return fetch(request);
}
});
httpClient.addHook("beforeRequest", (request) => {
const nextRequest = new Request(request, {
signal: request.signal || AbortSignal.timeout(5000)
});
nextRequest.headers.set("x-custom-header", "custom value");
return nextRequest;
});
httpClient.addHook("requestError", (error, request) => {
console.group("Request Error");
console.log("Reason:", `${error}`);
console.log("Endpoint:", `${request.method} ${request.url}`);
console.groupEnd();
});
const sdk = new GustoEmbedded({ httpClient });
You can setup your SDK to emit debug logs for SDK requests and responses.
You can pass a logger that matches console's interface as an SDK option.
[!WARNING] Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
import { GustoEmbedded } from "@gusto/embedded-api";
const sdk = new GustoEmbedded({ debugLogger: console });
You can also enable a default debug logger by setting an environment variable GUSTOEMBEDDED_DEBUG to true.
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
FAQs
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *gusto-embedded* API.
The npm package @gusto/embedded-api receives a total of 10,125 weekly downloads. As such, @gusto/embedded-api popularity was classified as popular.
We found that @gusto/embedded-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.