
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@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
# Install optional peer dependencies if you plan to use React hooks
yarn add @tanstack/react-query react react-dom
[!NOTE] This package is published as an ES Module (ESM) only. For applications using CommonJS, use
await import("@gusto/embedded-api")to import and use this package.
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.getInfo({});
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.getInfo({});
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,
},
},
});
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.
achTransactionsGetAll - Get all ACH transactions for a companybankAccountsCreate - Create a company bank accountbankAccountsCreateFromPlaidToken - Create a bank account from a plaid processor tokenbankAccountsDeleteV1CompaniesCompanyIdBankAccountsBankAccountId - Delete a company bank accountbankAccountsGet - Get all company bank accountsbankAccountsVerify - Verify a company bank accountcompaniesAcceptTermsOfService - Accept terms of service for a company usercompaniesCreateAdmin - Create an admin for the companycompaniesCreatePartnerManaged - Create a partner managed companycompaniesFinishOnboarding - Finish company onboardingcompaniesGet - Get a companycompaniesGetCustomFields - Get the custom fields of a companycompaniesGetOnboardingStatus - Get the company's onboarding statuscompaniesListAdmins - Get all the admins at a companycompaniesMigrate - Migrate company to embedded payrollcompaniesRetrieveTermsOfService - Retrieve terms of service status for a company usercompaniesSuspensionsGet - Get suspensions for this companycompaniesSuspensionsSuspend - Suspend a company's accountcompaniesUpdate - Update a companycompanyAttachmentGetDownloadUrl - Get a temporary url to download the Company Attachment filecompanyAttachmentsCreate - Create Company Attachment and Upload FilecompanyAttachmentsGetDetails - Get Company Attachment DetailscompanyAttachmentsGetList - Get List of Company AttachmentscompanyBenefitsCreate - 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.companyBenefitsGetSupported - Get a supported benefit by IDcompanyBenefitsGetV1CompanyBenefitsCompanyBenefitIdContributionExclusions - Get contribution exclusions for a company benefitcompanyBenefitsList - Get benefits for a companycompanyBenefitsPutV1CompanyBenefitsCompanyBenefitIdContributionExclusions - Update contribution exclusions for a company benefitcompanyBenefitsUpdate - Update a company benefitcompanyBenefitsUpdateEmployeeBenefits - Bulk update employee benefits for a company benefitcompanyFormsGet - Get a company formcompanyFormsGetAll - Get all company formscompanyFormsGetPdf - Get a company form pdfcompanyFormsSign - Sign a company formcontractorDocumentsGet - Get a contractor documentcontractorDocumentsGetAll - Get all contractor documentscontractorDocumentsGetPdf - Get the contractor document pdfcontractorDocumentsSign - Sign a contractor documentcontractorFormsGenerate1099 - Generate a 1099 form [DEMO]contractorFormsGet - Get a contractor formcontractorFormsGetPdf - Get the contractor form pdfcontractorFormsList - Get all contractor formscontractorPaymentGroupsCreate - Create a contractor payment groupcontractorPaymentGroupsDelete - Cancel a contractor payment groupcontractorPaymentGroupsFund - Fund a contractor payment group [DEMO]contractorPaymentGroupsGet - Get a contractor payment groupcontractorPaymentGroupsGetList - Get contractor payment groups for a companycontractorPaymentGroupsGetV1ContractorPaymentGroupsIdPartnerDisbursements - Get partner disbursements for a contractor payment groupcontractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursements - Update partner disbursements for a contractor payment groupcontractorPaymentGroupsPreview - Preview a contractor payment groupcontractorPaymentMethodGet - Get a contractor's payment methodcontractorPaymentMethodGetBankAccounts - Get all contractor bank accountscontractorPaymentMethodsCreateBankAccount - Create a contractor bank accountcontractorPaymentMethodUpdate - Update a contractor's payment methodcontractorPaymentsCreate - Create a contractor paymentcontractorPaymentsDelete - Cancel a contractor paymentcontractorPaymentsFund - Fund a contractor payment [DEMO]contractorPaymentsGet - Get a single contractor paymentcontractorPaymentsGetReceipt - Get a single contractor payment receiptcontractorPaymentsList - Get contractor payments for a companycontractorsCreate - Create a contractorcontractorsDelete - Delete a contractorcontractorsGet - Get a contractorcontractorsGetAddress - Get a contractor addresscontractorsGetOnboardingStatus - Get the contractor's onboarding statuscontractorsGetV1CompaniesCompanyIdContractorsPaymentDetails - List contractor payment detailscontractorsList - 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 departmentdepartmentsGetAll - Get all departments of a companydepartmentsRemovePeople - Remove people from a departmentdepartmentsUpdate - Update a departmentearningTypesCreate - Create a custom earning typeearningTypesDelete - Deactivate an earning typeearningTypesList - Get all earning types for a companyearningTypesUpdate - Update an earning typeemployeeAddressesCreate - Create an employee's home addressemployeeAddressesCreateWorkAddress - Create an employee work addressemployeeAddressesDelete - Delete an employee's home addressemployeeAddressesDeleteWorkAddress - Delete an employee's work addressemployeeAddressesGet - Get an employee's home addressesemployeeAddressesGetWorkAddresses - Get an employee's work addressesemployeeAddressesRetrieveHomeAddress - Get an employee's home addressemployeeAddressesRetrieveWorkAddress - Get an employee work addressemployeeAddressesUpdate - Update an employee's home addressemployeeAddressesUpdateWorkAddress - Update an employee work addressemployeeBenefitsCreate - Create an employee benefitemployeeBenefitsCreateYtdBenefitAmountsFromDifferentCompany - Create year-to-date benefit amounts from a different companyemployeeBenefitsDelete - Delete an employee benefitemployeeBenefitsGet - Get all benefits for an employeeemployeeBenefitsGetYtdBenefitAmountsFromDifferentCompany - Get year-to-date benefit amounts from a different companyemployeeBenefitsRetrieve - Get an employee benefitemployeeBenefitsUpdate - 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 rehireemployeeEmploymentsGetTerminations - Get terminations for an employeeemployeeEmploymentsRehire - Update an employee rehireemployeeEmploymentsUpdateTermination - Update an employee terminationemployeeFormsGenerateW2 - Generate a W2 form [DEMO]employeeFormsGet - Get an employee formemployeeFormsGetPdf - Get the employee form pdfemployeeFormsList - Get all employee formsemployeeFormsSign - Sign an employee formemployeePaymentMethodCreate - 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 an employeeemployeesGetCustomFields - Get an employee's custom fieldsemployeesGetOnboardingStatus - Get the employee's onboarding statusemployeesGetTimeOffActivities - Get employee time off activitiesemployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails - Get employee payment details for a companyemployeesList - Get employees of a companyemployeesUpdate - Update an employee.employeesUpdateOnboardingDocumentsConfig - 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 taxeseventsGet - Get all eventsexternalPayrollsCalculateTaxes - Get tax suggestions for an external payrollexternalPayrollsCreate - Create a new external payroll for a companyexternalPayrollsDelete - Delete an external payrollexternalPayrollsFinalizeTaxLiabilities - Finalize tax liabilities options and convert into processed payrollsexternalPayrollsGet - Get external payrolls for a companyexternalPayrollsListTaxLiabilities - Get tax liabilitiesexternalPayrollsRetrieve - Get an external payrollexternalPayrollsUpdate - Update an external payrollexternalPayrollsUpdateTaxLiabilities - Update tax liabilitiesfederalTaxDetailsGet - Get Federal Tax DetailsfederalTaxDetailsUpdate - Update Federal Tax DetailsflowsCreate - Create a flowgarnishmentsCreate - Create a garnishmentgarnishmentsGet - Get a garnishmentgarnishmentsGetChildSupportData - Get child support garnishment datagarnishmentsList - Get garnishments for an employeegarnishmentsUpdate - Update a garnishmentgeneratedDocumentsGet - Get a generated documenthistoricalEmployeesUpdate - Update a historical employeeholidayPayPoliciesAddEmployees - 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 documentsi9VerificationDeleteDocument - 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 documentsi9VerificationUpdate - Create or update an employee's I-9 authorizationindustrySelectionGet - Get a company industry selectionindustrySelectionUpdate - Update a company industry selectioninformationRequestsGetInformationRequests - Get all information requests for a companyintrospectionGetInfo - Get info about the current access tokenintrospectionRefreshToken - Refresh access tokeninvoicesGet - Retrieve invoicing data for companiesjobsAndCompensationsCreateCompensation - Create a compensationjobsAndCompensationsCreateJob - Create a jobjobsAndCompensationsDelete - Delete an individual jobjobsAndCompensationsDeleteCompensation - Delete a compensationjobsAndCompensationsGetCompensation - 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 company locationslocationsGetMinimumWages - Get minimum wages for a locationlocationsRetrieve - Get a locationlocationsUpdate - Update a locationnotificationsGetCompanyNotifications - Get notifications for companynotificationsGetDetails - 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 payrollpayrollsCreateOffCycle - Create an off-cycle payrollpayrollsDelete - Delete a payrollpayrollsGeneratePrintableChecks - Generate printable payroll checks (pdf)payrollsGet - Get a single payrollpayrollsGetApprovedReversals - Get approved payroll reversalspayrollsGetBlockers - Get all payroll blockers for a companypayrollsGetPayStub - Get an employee pay stub (pdf)payrollsGetPayStubs - Get an employee's pay stubspayrollsGetReceipt - Get a single payroll receiptpayrollsGetV1CompaniesCompanyIdPayrollsIdPartnerDisbursements - Get partner disbursements for a payrollpayrollsList - Get all payrolls for a companypayrollsPatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursements - Update partner disbursements for a payrollpayrollsPrepare - 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 schedulepaySchedulesGetAll - Get the pay schedules for a companypaySchedulesGetAssignments - Get pay schedule assignments for a companypaySchedulesGetPayPeriods - Get pay periods for a companypaySchedulesGetPreview - Preview pay schedule datespaySchedulesGetUnprocessedTerminationPeriods - Get termination pay periods for a companypaySchedulesPreviewAssignment - Preview pay schedule assignments for a companypaySchedulesUpdate - Update a pay schedulerecoveryCasesGet - Get all recovery cases for a companyrecoveryCasesRedebit - Initiate a redebit for a recovery casereportsCreateCustom - Create a custom reportreportsGetReportsRequestUuid - Get a reportreportsGetTemplate - Get a report templatereportsPostPayrollsPayrollUuidReportsGeneralLedger - Create a general ledger reportsignatoriesCreate - Create a signatorysignatoriesDelete - Delete a signatorysignatoriesInvite - Invite a signatorysignatoriesList - Get all company signatoriessignatoriesUpdate - Update a signatorytaxRequirementsGet - Get State Tax RequirementstaxRequirementsGetAll - Get All Tax Requirement StatestaxRequirementsUpdateState - Update State Tax RequirementstimeOffPoliciesAddEmployees - Add employees to a time off policytimeOffPoliciesCalculateAccruingTimeOffHours - Calculate accruing time off hourstimeOffPoliciesCreate - Create a time off policytimeOffPoliciesDeactivate - Deactivate a time off policytimeOffPoliciesGet - Get a time off policytimeOffPoliciesGetAll - Get all time off policiestimeOffPoliciesRemoveEmployees - Remove employees from a time off policytimeOffPoliciesUpdate - Update a time off policytimeOffPoliciesUpdateBalance - Update employee time off hour balanceswebhooksCreateSubscription - Create a webhook subscriptionwebhooksDeleteSubscription - Delete a webhook subscriptionwebhooksGetSubscription - Get a webhook subscriptionwebhooksGetV1WebhooksHealthCheck - Get the webhooks health statuswebhooksListSubscriptions - List webhook subscriptionswebhooksRequestVerificationToken - Request the webhook subscription verification_tokenwebhooksUpdateSubscription - Update a webhook subscriptionwebhooksVerify - Verify the webhook subscriptionwireInRequestsGet - Get a single Wire In RequestwireInRequestsList - Get all Wire In Requests for a companywireInRequestsSubmit - 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.
useAchTransactionsGetAll - Get all ACH transactions for a companyuseBankAccountsCreateFromPlaidTokenMutation - Create a bank account from a plaid processor tokenuseBankAccountsCreateMutation - Create a company bank accountuseBankAccountsDeleteV1CompaniesCompanyIdBankAccountsBankAccountIdMutation - Delete a company bank accountuseBankAccountsGet - Get all company bank accountsuseBankAccountsVerifyMutation - Verify a company bank accountuseCompaniesAcceptTermsOfServiceMutation - Accept terms of service for a company useruseCompaniesCreateAdminMutation - Create an admin for the companyuseCompaniesCreatePartnerManagedMutation - Create a partner managed companyuseCompaniesFinishOnboardingMutation - Finish company onboardinguseCompaniesGet - Get a companyuseCompaniesGetCustomFields - Get the custom fields of a companyuseCompaniesGetOnboardingStatus - Get the company's onboarding statususeCompaniesListAdmins - Get all the admins at a companyuseCompaniesMigrateMutation - Migrate company to embedded payrolluseCompaniesRetrieveTermsOfServiceMutation - Retrieve terms of service status for a company useruseCompaniesSuspensionsGet - Get suspensions for this companyuseCompaniesSuspensionsSuspendMutation - Suspend a company's accountuseCompaniesUpdateMutation - Update a companyuseCompanyAttachmentGetDownloadUrl - Get a temporary url to download the Company Attachment fileuseCompanyAttachmentsCreateMutation - Create Company Attachment and Upload FileuseCompanyAttachmentsGetDetails - Get Company Attachment DetailsuseCompanyAttachmentsGetList - Get List of Company AttachmentsuseCompanyBenefitsCreateMutation - 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.useCompanyBenefitsGetSupported - Get a supported benefit by IDuseCompanyBenefitsGetV1CompanyBenefitsCompanyBenefitIdContributionExclusions - Get contribution exclusions for a company benefituseCompanyBenefitsList - Get benefits for a companyuseCompanyBenefitsPutV1CompanyBenefitsCompanyBenefitIdContributionExclusionsMutation - Update contribution exclusions for a company benefituseCompanyBenefitsUpdateEmployeeBenefitsMutation - Bulk update employee benefits for a company benefituseCompanyBenefitsUpdateMutation - Update a company benefituseCompanyFormsGet - Get a company formuseCompanyFormsGetAll - Get all company formsuseCompanyFormsGetPdf - Get a company form pdfuseCompanyFormsSignMutation - Sign a company formuseContractorDocumentsGet - Get a contractor documentuseContractorDocumentsGetAll - Get all contractor documentsuseContractorDocumentsGetPdf - Get the contractor document pdfuseContractorDocumentsSignMutation - Sign a contractor documentuseContractorFormsGenerate1099Mutation - Generate a 1099 form [DEMO]useContractorFormsGet - Get a contractor formuseContractorFormsGetPdf - Get the contractor form pdfuseContractorFormsList - Get all contractor formsuseContractorPaymentGroupsCreateMutation - Create a contractor payment groupuseContractorPaymentGroupsDeleteMutation - Cancel a contractor payment groupuseContractorPaymentGroupsFundMutation - Fund a contractor payment group [DEMO]useContractorPaymentGroupsGet - Get a contractor payment groupuseContractorPaymentGroupsGetList - Get contractor payment groups for a companyuseContractorPaymentGroupsGetV1ContractorPaymentGroupsIdPartnerDisbursements - Get partner disbursements for a contractor payment groupuseContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutation - Update partner disbursements for a contractor payment groupuseContractorPaymentGroupsPreviewMutation - Preview a contractor payment groupuseContractorPaymentMethodGet - Get a contractor's payment methoduseContractorPaymentMethodGetBankAccounts - Get all contractor bank accountsuseContractorPaymentMethodsCreateBankAccountMutation - Create a contractor bank accountuseContractorPaymentMethodUpdateMutation - Update a contractor's payment methoduseContractorPaymentsCreateMutation - Create a contractor paymentuseContractorPaymentsDeleteMutation - Cancel a contractor paymentuseContractorPaymentsFundMutation - Fund a contractor payment [DEMO]useContractorPaymentsGet - Get a single contractor paymentuseContractorPaymentsGetReceipt - Get a single contractor payment receiptuseContractorPaymentsList - Get contractor payments for a companyuseContractorsCreateMutation - Create a contractoruseContractorsDeleteMutation - Delete a contractoruseContractorsGet - Get a contractoruseContractorsGetAddress - Get a contractor addressuseContractorsGetOnboardingStatus - Get the contractor's onboarding statususeContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails - List contractor payment detailsuseContractorsList - 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 departmentuseDepartmentsGetAll - Get all departments of a companyuseDepartmentsRemovePeopleMutation - Remove people from a departmentuseDepartmentsUpdateMutation - Update a departmentuseEarningTypesCreateMutation - Create a custom earning typeuseEarningTypesDeleteMutation - Deactivate an earning typeuseEarningTypesList - Get all earning types for a companyuseEarningTypesUpdateMutation - Update an earning typeuseEmployeeAddressesCreateMutation - Create an employee's home addressuseEmployeeAddressesCreateWorkAddressMutation - Create an employee work addressuseEmployeeAddressesDeleteMutation - Delete an employee's home addressuseEmployeeAddressesDeleteWorkAddressMutation - Delete an employee's work addressuseEmployeeAddressesGet - Get an employee's home addressesuseEmployeeAddressesGetWorkAddresses - Get an employee's work addressesuseEmployeeAddressesRetrieveHomeAddress - Get an employee's home addressuseEmployeeAddressesRetrieveWorkAddress - Get an employee work addressuseEmployeeAddressesUpdateMutation - Update an employee's home addressuseEmployeeAddressesUpdateWorkAddressMutation - Update an employee work addressuseEmployeeBenefitsCreateMutation - Create an employee benefituseEmployeeBenefitsCreateYtdBenefitAmountsFromDifferentCompanyMutation - Create year-to-date benefit amounts from a different companyuseEmployeeBenefitsDeleteMutation - Delete an employee benefituseEmployeeBenefitsGet - Get all benefits for an employeeuseEmployeeBenefitsGetYtdBenefitAmountsFromDifferentCompany - Get year-to-date benefit amounts from a different companyuseEmployeeBenefitsRetrieve - Get an employee benefituseEmployeeBenefitsUpdateMutation - 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 rehireuseEmployeeEmploymentsGetTerminations - Get terminations for an employeeuseEmployeeEmploymentsRehireMutation - Update an employee rehireuseEmployeeEmploymentsUpdateTerminationMutation - Update an employee terminationuseEmployeeFormsGenerateW2Mutation - Generate a W2 form [DEMO]useEmployeeFormsGet - Get an employee formuseEmployeeFormsGetPdf - Get the employee form pdfuseEmployeeFormsList - Get all employee formsuseEmployeeFormsSignMutation - Sign an employee formuseEmployeePaymentMethodCreateMutation - 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 an employeeuseEmployeesGetCustomFields - Get an employee's custom fieldsuseEmployeesGetOnboardingStatus - Get the employee's onboarding statususeEmployeesGetTimeOffActivities - Get employee time off activitiesuseEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails - Get employee payment details for a companyuseEmployeesList - Get employees of a companyuseEmployeesUpdateMutation - Update an employee.useEmployeesUpdateOnboardingDocumentsConfigMutation - 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 taxesuseEventsGet - Get all eventsuseExternalPayrollsCalculateTaxes - Get tax suggestions for an external payrolluseExternalPayrollsCreateMutation - Create a new external payroll for a companyuseExternalPayrollsDeleteMutation - Delete an external payrolluseExternalPayrollsFinalizeTaxLiabilitiesMutation - Finalize tax liabilities options and convert into processed payrollsuseExternalPayrollsGet - Get external payrolls for a companyuseExternalPayrollsListTaxLiabilities - Get tax liabilitiesuseExternalPayrollsRetrieve - Get an external payrolluseExternalPayrollsUpdateMutation - Update an external payrolluseExternalPayrollsUpdateTaxLiabilitiesMutation - Update tax liabilitiesuseFederalTaxDetailsGet - Get Federal Tax DetailsuseFederalTaxDetailsUpdateMutation - Update Federal Tax DetailsuseFlowsCreateMutation - Create a flowuseGarnishmentsCreateMutation - Create a garnishmentuseGarnishmentsGet - Get a garnishmentuseGarnishmentsGetChildSupportData - Get child support garnishment datauseGarnishmentsList - Get garnishments for an employeeuseGarnishmentsUpdateMutation - Update a garnishmentuseGeneratedDocumentsGet - Get a generated documentuseHistoricalEmployeesUpdateMutation - Update a historical employeeuseHolidayPayPoliciesAddEmployeesMutation - 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 documentsuseI9VerificationDeleteDocumentMutation - 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 documentsuseI9VerificationUpdateMutation - Create or update an employee's I-9 authorizationuseIndustrySelectionGet - Get a company industry selectionuseIndustrySelectionUpdateMutation - Update a company industry selectionuseInformationRequestsGetInformationRequests - Get all information requests for a companyuseIntrospectionGetInfo - Get info about the current access tokenuseIntrospectionRefreshTokenMutation - Refresh access tokenuseInvoicesGet - Retrieve invoicing data for companiesuseJobsAndCompensationsCreateCompensationMutation - Create a compensationuseJobsAndCompensationsCreateJobMutation - Create a jobuseJobsAndCompensationsDeleteCompensationMutation - Delete a compensationuseJobsAndCompensationsDeleteMutation - 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 company locationsuseLocationsGetMinimumWages - Get minimum wages for a locationuseLocationsRetrieve - Get a locationuseLocationsUpdateMutation - Update a locationuseNotificationsGetCompanyNotifications - Get notifications for companyuseNotificationsGetDetails - 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 payrollusePayrollsCreateOffCycleMutation - Create an off-cycle payrollusePayrollsDeleteMutation - Delete a payrollusePayrollsGeneratePrintableChecksMutation - Generate printable payroll checks (pdf)usePayrollsGet - Get a single payrollusePayrollsGetApprovedReversals - Get approved payroll reversalsusePayrollsGetBlockers - Get all payroll blockers for a companyusePayrollsGetPayStub - Get an employee pay stub (pdf)usePayrollsGetPayStubs - Get an employee's pay stubsusePayrollsGetReceipt - Get a single payroll receiptusePayrollsGetV1CompaniesCompanyIdPayrollsIdPartnerDisbursements - Get partner disbursements for a payrollusePayrollsList - Get all payrolls for a companyusePayrollsPatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursementsMutation - Update partner disbursements for a payrollusePayrollsPrepareMutation - 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 scheduleusePaySchedulesGetAll - Get the pay schedules for a companyusePaySchedulesGetAssignments - Get pay schedule assignments for a companyusePaySchedulesGetPayPeriods - Get pay periods for a companyusePaySchedulesGetPreview - Preview pay schedule datesusePaySchedulesGetUnprocessedTerminationPeriods - Get termination pay periods for a companyusePaySchedulesPreviewAssignmentMutation - Preview pay schedule assignments for a companyusePaySchedulesUpdateMutation - Update a pay scheduleuseRecoveryCasesGet - Get all recovery cases for a companyuseRecoveryCasesRedebitMutation - Initiate a redebit for a recovery caseuseReportsCreateCustomMutation - Create a custom reportuseReportsGetReportsRequestUuid - Get a reportuseReportsGetTemplate - Get a report templateuseReportsPostPayrollsPayrollUuidReportsGeneralLedgerMutation - Create a general ledger reportuseSignatoriesCreateMutation - Create a signatoryuseSignatoriesDeleteMutation - Delete a signatoryuseSignatoriesInviteMutation - Invite a signatoryuseSignatoriesList - Get all company signatoriesuseSignatoriesUpdateMutation - Update a signatoryuseTaxRequirementsGet - Get State Tax RequirementsuseTaxRequirementsGetAll - Get All Tax Requirement StatesuseTaxRequirementsUpdateStateMutation - Update State Tax RequirementsuseTimeOffPoliciesAddEmployeesMutation - Add employees to a time off policyuseTimeOffPoliciesCalculateAccruingTimeOffHoursMutation - Calculate accruing time off hoursuseTimeOffPoliciesCreateMutation - Create a time off policyuseTimeOffPoliciesDeactivateMutation - Deactivate a time off policyuseTimeOffPoliciesGet - Get a time off policyuseTimeOffPoliciesGetAll - Get all time off policiesuseTimeOffPoliciesRemoveEmployeesMutation - Remove employees from a time off policyuseTimeOffPoliciesUpdateBalanceMutation - Update employee time off hour balancesuseTimeOffPoliciesUpdateMutation - Update a time off policyuseWebhooksCreateSubscriptionMutation - Create a webhook subscriptionuseWebhooksDeleteSubscriptionMutation - Delete a webhook subscriptionuseWebhooksGetSubscription - Get a webhook subscriptionuseWebhooksGetV1WebhooksHealthCheck - Get the webhooks health statususeWebhooksListSubscriptions - List webhook subscriptionsuseWebhooksRequestVerificationToken - Request the webhook subscription verification_tokenuseWebhooksUpdateSubscriptionMutation - Update a webhook subscriptionuseWebhooksVerifyMutation - Verify the webhook subscriptionuseWireInRequestsGet - Get a single Wire In RequestuseWireInRequestsList - Get all Wire In Requests for a companyuseWireInRequestsSubmitMutation - 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: {
document: await openAsBlob("example.file"),
category: "gep_notice",
},
});
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.getInfo({}, {
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});
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.getInfo({});
console.log(result);
}
run();
GustoEmbeddedError is the base class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
|---|---|---|
error.message | string | Error message |
error.httpMeta.response | Response | HTTP response. Access to headers and more. |
error.httpMeta.request | Request | HTTP request. Access to headers and more. |
error.data$ | Optional. Some errors may contain structured data. See Error Classes. |
import { GustoEmbedded } from "@gusto/embedded-api";
import { GustoEmbeddedError } from "@gusto/embedded-api/models/errors/gustoembeddederror.js.js";
import { UnprocessableEntityErrorObject } from "@gusto/embedded-api/models/errors/unprocessableentityerrorobject.js";
const gustoEmbedded = new GustoEmbedded();
async function run() {
try {
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,
},
},
});
console.log(result);
} catch (error) {
// The base class for HTTP error responses
if (error instanceof GustoEmbeddedError) {
console.log(error.message);
console.log(error.httpMeta.response.status);
console.log(error.httpMeta.response.headers);
console.log(error.httpMeta.request);
// Depending on the method different errors may be thrown
if (error instanceof UnprocessableEntityErrorObject) {
console.log(error.data$.errors); // EntityErrorObject[]
}
}
}
}
run();
Primary error:
GustoEmbeddedError: The base class for HTTP error responses.Network errors:
ConnectionError: HTTP client was unable to make a request to a server.RequestTimeoutError: HTTP request timed out due to an AbortSignal signal.RequestAbortedError: HTTP request was aborted by the client.InvalidRequestError: Any input used to create a request is invalid.UnexpectedClientError: Unrecognised or unexpected error.Inherit from GustoEmbeddedError:
UnprocessableEntityErrorObject: Unprocessable Entity This may happen when the body of your request contains errors such as invalid_attribute_value, or the request fails due to an invalid_operation. See the Errors Categories guide for more details. Applicable to 139 of 261 methods.*NotFoundErrorObject: Not Found The requested resource does not exist. Make sure the provided ID/UUID is valid. Status code 404. Applicable to 4 of 261 methods.*UnprocessableEntityErrorObject1: Unprocessable Entity This may happen when the body of your request contains errors such as invalid_attribute_value, or the request fails due to an invalid_operation. See the Errors Categories guide for more details. Status code 422. Applicable to 4 of 261 methods.*PayrollBlockersError: Payroll Blockers Error For detailed information, see the Payroll Blockers guide. Status code 422. Applicable to 4 of 261 methods.*DeleteV1CompanyBenefitsCompanyBenefitIdResponseBody: Unprocessable Entity. Status code 422. Applicable to 1 of 261 methods.*CompanySuspensionCreationErrors: Unprocessable Entity This may happen when the body of your request contains errors such as invalid_attribute_value, or the request fails due to an invalid_operation. See the Errors Categories guide for more details. Status code 422. Applicable to 1 of 261 methods.*ResponseValidationError: Type mismatch between the data returned from the server and the structure expected by the SDK. See error.rawValue for the raw value and error.pretty() for a nicely formatted multi-line string.* Check the method documentation to see if the error is applicable.
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 | Description |
|---|---|---|
demo | https://api.gusto-demo.com | Demo |
prod | https://api.gusto.com | Prod |
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.getInfo({});
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.getInfo({});
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: 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 562 weekly downloads. As such, @gusto/embedded-api popularity was classified as not 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.