Developer-friendly & type-safe Typescript SDK specifically catered to leverage *apideck* API.
npm install @apideck/unifyDeveloper-friendly & type-safe Typescript SDK specifically catered to leverage apideck API.
Apideck: The Apideck OpenAPI Spec: SDK Optimized
For more information about the API: Apideck Developer Docs
The SDK can be installed with either npm, pnpm, bun or yarn package managers.
``bash`
npm add @apideck/unify
`bash`
pnpm add @apideck/unify
`bash`
bun add @apideck/unify
`bash`
yarn add @apideck/unify
For supported JavaScript runtimes, please consult RUNTIMES.md.
`typescript
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.accounting.taxRates.list({
serviceId: "salesforce",
filter: {
assets: true,
equity: true,
expenses: true,
liabilities: true,
revenue: true,
},
passThrough: {
"search": "San Francisco",
},
fields: "id,updated_at",
});
for await (const page of result) {
console.log(page);
}
}
run();
`
Available methods
* get - Get Aged Creditors
* get - Get Aged Debtors
* list - List Attachments
* upload - Upload attachment
* get - Get Attachment
* delete - Delete Attachment
* download - Download Attachment
* get - Get BalanceSheet
* list - List Bank Accounts
* create - Create Bank Account
* get - Get Bank Account
* update - Update Bank Account
* delete - Delete Bank Account
* list - List Bank Feed Accounts
* create - Create Bank Feed Account
* get - Get Bank Feed Account
* update - Update Bank Feed Account
* delete - Delete Bank Feed Account
* list - List Bank Feed Statements
* create - Create Bank Feed Statement
* get - Get Bank Feed Statement
* update - Update Bank Feed Statement
* delete - Delete Bank Feed Statement
* list - List Bill Payments
* create - Create Bill Payment
* get - Get Bill Payment
* update - Update Bill Payment
* delete - Delete Bill Payment
* list - List Bills
* create - Create Bill
* get - Get Bill
* update - Update Bill
* delete - Delete Bill
* list - List Categories
* get - Get Category
* get - Get company info
* list - List Credit Notes
* create - Create Credit Note
* get - Get Credit Note
* update - Update Credit Note
* delete - Delete Credit Note
* list - List Customers
* create - Create Customer
* get - Get Customer
* update - Update Customer
* delete - Delete Customer
* list - List Departments
* create - Create Department
* get - Get Department
* update - Update Department
* delete - Delete Department
* list - List Expenses
* create - Create Expense
* get - Get Expense
* update - Update Expense
* delete - Delete Expense
* list - List Invoice Items
* create - Create Invoice Item
* get - Get Invoice Item
* update - Update Invoice Item
* delete - Delete Invoice Item
* list - List Invoices
* create - Create Invoice
* get - Get Invoice
* update - Update Invoice
* delete - Delete Invoice
* list - List Journal Entries
* create - Create Journal Entry
* get - Get Journal Entry
* update - Update Journal Entry
* delete - Delete Journal Entry
* list - List Ledger Accounts
* create - Create Ledger Account
* get - Get Ledger Account
* update - Update Ledger Account
* delete - Delete Ledger Account
* list - List Locations
* create - Create Location
* get - Get Location
* update - Update Location
* delete - Delete Location
* list - List Payments
* create - Create Payment
* get - Get Payment
* update - Update Payment
* delete - Delete Payment
* get - Get Profit and Loss
* list - List projects
* create - Create project
* get - Get project
* update - Update project
* delete - Delete project
* list - List Purchase Orders
* create - Create Purchase Order
* get - Get Purchase Order
* update - Update Purchase Order
* delete - Delete Purchase Order
* list - List Quotes
* create - Create Quote
* get - Get Quote
* update - Update Quote
* delete - Delete Quote
* list - List Subsidiaries
* create - Create Subsidiary
* get - Get Subsidiary
* update - Update Subsidiary
* delete - Delete Subsidiary
* list - List Suppliers
* create - Create Supplier
* get - Get Supplier
* update - Update Supplier
* delete - Delete Supplier
* list - List Tax Rates
* create - Create Tax Rate
* get - Get Tax Rate
* update - Update Tax Rate
* delete - Delete Tax Rate
* list - List Tracking Categories
* create - Create Tracking Category
* get - Get Tracking Category
* update - Update Tracking Category
* delete - Delete Tracking Category
* list - List Applicants
* create - Create Applicant
* get - Get Applicant
* update - Update Applicant
* delete - Delete Applicant
* list - List Applications
* create - Create Application
* get - Get Application
* update - Update Application
* delete - Delete Application
* list - List Jobs
* get - Get Job
* get - Get API Resource Coverage
* get - Get API Resource
* list - List APIs
* get - Get API
* get - Get Connector Doc content
* get - Get Connector Resource
* list - List Connectors
* get - Get Connector
* list - List activities
* create - Create activity
* get - Get activity
* update - Update activity
* delete - Delete activity
* list - List companies
* create - Create company
* get - Get company
* update - Update company
* delete - Delete company
* list - List contacts
* create - Create contact
* get - Get contact
* update - Update contact
* delete - Delete contact
* list - List custom objects
* create - Create custom object
* get - Get custom object
* update - Update custom object
* delete - Delete custom object
* list - List custom object schemas
* create - Create custom object schema
* get - Get custom object schema
* update - Update custom object schema
* delete - Delete custom object schema
* list - List leads
* create - Create lead
* get - Get lead
* update - Update lead
* delete - Delete lead
* list - List notes
* create - Create note
* get - Get note
* update - Update note
* delete - Delete note
* list - List opportunities
* create - Create opportunity
* get - Get opportunity
* update - Update opportunity
* delete - Delete opportunity
* list - List pipelines
* create - Create pipeline
* get - Get pipeline
* update - Update pipeline
* delete - Delete pipeline
* list - List users
* create - Create user
* get - Get user
* update - Update user
* delete - Delete user
* list - List Customers
* get - Get Customer
* list - List Orders
* get - Get Order
* list - List Products
* get - Get Product
* get - Get Store
* list - List DriveGroups
* create - Create DriveGroup
* get - Get DriveGroup
* update - Update DriveGroup
* delete - Delete DriveGroup
* list - List Drives
* create - Create Drive
* get - Get Drive
* update - Update Drive
* delete - Delete Drive
* list - List Files
* search - Search Files
* get - Get File
* update - Rename or move File
* delete - Delete File
* download - Download File
* export - Export File
* create - Create Folder
* get - Get Folder
* update - Rename or move Folder
* delete - Delete Folder
* copy - Copy Folder
* list - List Shared Links
* create - Create Shared Link
* get - Get Shared Link
* update - Update Shared Link
* delete - Delete Shared Link
* create - Start Upload Session
* get - Get Upload Session
* upload - Upload part of File to Upload Session
* delete - Abort Upload Session
* finish - Finish Upload Session
* list - List Companies
* create - Create Company
* get - Get Company
* update - Update Company
* delete - Delete Company
* list - List Departments
* create - Create Department
* get - Get Department
* update - Update Department
* delete - Delete Department
* list - List Employee Payrolls
* get - Get Employee Payroll
* list - List Employees
* create - Create Employee
* get - Get Employee
* update - Update Employee
* delete - Delete Employee
* list - List Employee Schedules
* list - List Payroll
* get - Get Payroll
* list - List Time Off Requests
* create - Create Time Off Request
* get - Get Time Off Request
* update - Update Time Off Request
* delete - Delete Time Off Request
* list - List Collections
* get - Get Collection
* list - List Tags
* list - List Comments
* create - Create Comment
* get - Get Comment
* update - Update Comment
* delete - Delete Comment
* list - List Tickets
* create - Create Ticket
* get - Get Ticket
* update - Update Ticket
* delete - Delete Ticket
* list - List Users
* get - Get user
* list - List Messages
* create - Create Message
* get - Get Message
* update - Update Message
* delete - Delete Message
* update - Update consent state
* list - Get consent records
* list - List connection custom mappings
* list - Get all connections
* get - Get connection
* update - Update connection
* delete - Deletes a connection
* imports - Import connection
* token - Authorize Access Token
* list - Get resource settings
* update - Update settings
* list - Consumer request counts
* create - Create consumer
* list - Get all consumers
* get - Get consumer
* update - Update consumer
* delete - Delete consumer
* state - Create Callback State
* list - Get resource custom fields
* list - List custom mappings
* list - Get all consumer request logs
* create - Create Session
* state - Validate Connection State
* list - List event logs
* list - List webhook subscriptions
* create - Create webhook subscription
* get - Get webhook subscription
* update - Update webhook subscription
* delete - Delete webhook subscription
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.
- accountingAgedCreditorsGet - Get Aged Creditors
- accountingAgedDebtorsGet - Get Aged Debtors
- accountingAttachmentsDelete - Delete Attachment
- accountingAttachmentsDownload - Download Attachment
- accountingAttachmentsGet - Get Attachment
- accountingAttachmentsList - List Attachments
- accountingAttachmentsUpload - Upload attachment
- accountingBalanceSheetGet - Get BalanceSheet
- accountingBankAccountsCreate - Create Bank Account
- accountingBankAccountsDelete - Delete Bank Account
- accountingBankAccountsGet - Get Bank Account
- accountingBankAccountsList - List Bank Accounts
- accountingBankAccountsUpdate - Update Bank Account
- accountingBankFeedAccountsCreate - Create Bank Feed Account
- accountingBankFeedAccountsDelete - Delete Bank Feed Account
- accountingBankFeedAccountsGet - Get Bank Feed Account
- accountingBankFeedAccountsList - List Bank Feed Accounts
- accountingBankFeedAccountsUpdate - Update Bank Feed Account
- accountingBankFeedStatementsCreate - Create Bank Feed Statement
- accountingBankFeedStatementsDelete - Delete Bank Feed Statement
- accountingBankFeedStatementsGet - Get Bank Feed Statement
- accountingBankFeedStatementsList - List Bank Feed Statements
- accountingBankFeedStatementsUpdate - Update Bank Feed Statement
- accountingBillPaymentsCreate - Create Bill Payment
- accountingBillPaymentsDelete - Delete Bill Payment
- accountingBillPaymentsGet - Get Bill Payment
- accountingBillPaymentsList - List Bill Payments
- accountingBillPaymentsUpdate - Update Bill Payment
- accountingBillsCreate - Create Bill
- accountingBillsDelete - Delete Bill
- accountingBillsGet - Get Bill
- accountingBillsList - List Bills
- accountingBillsUpdate - Update Bill
- accountingCategoriesGet - Get Category
- accountingCategoriesList - List Categories
- accountingCompanyInfoGet - Get company info
- accountingCreditNotesCreate - Create Credit Note
- accountingCreditNotesDelete - Delete Credit Note
- accountingCreditNotesGet - Get Credit Note
- accountingCreditNotesList - List Credit Notes
- accountingCreditNotesUpdate - Update Credit Note
- accountingCustomersCreate - Create Customer
- accountingCustomersDelete - Delete Customer
- accountingCustomersGet - Get Customer
- accountingCustomersList - List Customers
- accountingCustomersUpdate - Update Customer
- accountingDepartmentsCreate - Create Department
- accountingDepartmentsDelete - Delete Department
- accountingDepartmentsGet - Get Department
- accountingDepartmentsList - List Departments
- accountingDepartmentsUpdate - Update Department
- accountingExpensesCreate - Create Expense
- accountingExpensesDelete - Delete Expense
- accountingExpensesGet - Get Expense
- accountingExpensesList - List Expenses
- accountingExpensesUpdate - Update Expense
- accountingInvoiceItemsCreate - Create Invoice Item
- accountingInvoiceItemsDelete - Delete Invoice Item
- accountingInvoiceItemsGet - Get Invoice Item
- accountingInvoiceItemsList - List Invoice Items
- accountingInvoiceItemsUpdate - Update Invoice Item
- accountingInvoicesCreate - Create Invoice
- accountingInvoicesDelete - Delete Invoice
- accountingInvoicesGet - Get Invoice
- accountingInvoicesList - List Invoices
- accountingInvoicesUpdate - Update Invoice
- accountingJournalEntriesCreate - Create Journal Entry
- accountingJournalEntriesDelete - Delete Journal Entry
- accountingJournalEntriesGet - Get Journal Entry
- accountingJournalEntriesList - List Journal Entries
- accountingJournalEntriesUpdate - Update Journal Entry
- accountingLedgerAccountsCreate - Create Ledger Account
- accountingLedgerAccountsDelete - Delete Ledger Account
- accountingLedgerAccountsGet - Get Ledger Account
- accountingLedgerAccountsList - List Ledger Accounts
- accountingLedgerAccountsUpdate - Update Ledger Account
- accountingLocationsCreate - Create Location
- accountingLocationsDelete - Delete Location
- accountingLocationsGet - Get Location
- accountingLocationsList - List Locations
- accountingLocationsUpdate - Update Location
- accountingPaymentsCreate - Create Payment
- accountingPaymentsDelete - Delete Payment
- accountingPaymentsGet - Get Payment
- accountingPaymentsList - List Payments
- accountingPaymentsUpdate - Update Payment
- accountingProfitAndLossGet - Get Profit and Loss
- accountingProjectsCreate - Create project
- accountingProjectsDelete - Delete project
- accountingProjectsGet - Get project
- accountingProjectsList - List projects
- accountingProjectsUpdate - Update project
- accountingPurchaseOrdersCreate - Create Purchase Order
- accountingPurchaseOrdersDelete - Delete Purchase Order
- accountingPurchaseOrdersGet - Get Purchase Order
- accountingPurchaseOrdersList - List Purchase Orders
- accountingPurchaseOrdersUpdate - Update Purchase Order
- accountingQuotesCreate - Create Quote
- accountingQuotesDelete - Delete Quote
- accountingQuotesGet - Get Quote
- accountingQuotesList - List Quotes
- accountingQuotesUpdate - Update Quote
- accountingSubsidiariesCreate - Create Subsidiary
- accountingSubsidiariesDelete - Delete Subsidiary
- accountingSubsidiariesGet - Get Subsidiary
- accountingSubsidiariesList - List Subsidiaries
- accountingSubsidiariesUpdate - Update Subsidiary
- accountingSuppliersCreate - Create Supplier
- accountingSuppliersDelete - Delete Supplier
- accountingSuppliersGet - Get Supplier
- accountingSuppliersList - List Suppliers
- accountingSuppliersUpdate - Update Supplier
- accountingTaxRatesCreate - Create Tax Rate
- accountingTaxRatesDelete - Delete Tax Rate
- accountingTaxRatesGet - Get Tax Rate
- accountingTaxRatesList - List Tax Rates
- accountingTaxRatesUpdate - Update Tax Rate
- accountingTrackingCategoriesCreate - Create Tracking Category
- accountingTrackingCategoriesDelete - Delete Tracking Category
- accountingTrackingCategoriesGet - Get Tracking Category
- accountingTrackingCategoriesList - List Tracking Categories
- accountingTrackingCategoriesUpdate - Update Tracking Category
- atsApplicantsCreate - Create Applicant
- atsApplicantsDelete - Delete Applicant
- atsApplicantsGet - Get Applicant
- atsApplicantsList - List Applicants
- atsApplicantsUpdate - Update Applicant
- atsApplicationsCreate - Create Application
- atsApplicationsDelete - Delete Application
- atsApplicationsGet - Get Application
- atsApplicationsList - List Applications
- atsApplicationsUpdate - Update Application
- atsJobsGet - Get Job
- atsJobsList - List Jobs
- connectorApiResourceCoverageGet - Get API Resource Coverage
- connectorApiResourcesGet - Get API Resource
- connectorApisGet - Get API
- connectorApisList - List APIs
- connectorConnectorDocsGet - Get Connector Doc content
- connectorConnectorResourcesGet - Get Connector Resource
- connectorConnectorsGet - Get Connector
- connectorConnectorsList - List Connectors
- crmActivitiesCreate - Create activity
- crmActivitiesDelete - Delete activity
- crmActivitiesGet - Get activity
- crmActivitiesList - List activities
- crmActivitiesUpdate - Update activity
- crmCompaniesCreate - Create company
- crmCompaniesDelete - Delete company
- crmCompaniesGet - Get company
- crmCompaniesList - List companies
- crmCompaniesUpdate - Update company
- crmContactsCreate - Create contact
- crmContactsDelete - Delete contact
- crmContactsGet - Get contact
- crmContactsList - List contacts
- crmContactsUpdate - Update contact
- crmCustomObjectSchemasCreate - Create custom object schema
- crmCustomObjectSchemasDelete - Delete custom object schema
- crmCustomObjectSchemasGet - Get custom object schema
- crmCustomObjectSchemasList - List custom object schemas
- crmCustomObjectSchemasUpdate - Update custom object schema
- crmCustomObjectsCreate - Create custom object
- crmCustomObjectsDelete - Delete custom object
- crmCustomObjectsGet - Get custom object
- crmCustomObjectsList - List custom objects
- crmCustomObjectsUpdate - Update custom object
- crmLeadsCreate - Create lead
- crmLeadsDelete - Delete lead
- crmLeadsGet - Get lead
- crmLeadsList - List leads
- crmLeadsUpdate - Update lead
- crmNotesCreate - Create note
- crmNotesDelete - Delete note
- crmNotesGet - Get note
- crmNotesList - List notes
- crmNotesUpdate - Update note
- crmOpportunitiesCreate - Create opportunity
- crmOpportunitiesDelete - Delete opportunity
- crmOpportunitiesGet - Get opportunity
- crmOpportunitiesList - List opportunities
- crmOpportunitiesUpdate - Update opportunity
- crmPipelinesCreate - Create pipeline
- crmPipelinesDelete - Delete pipeline
- crmPipelinesGet - Get pipeline
- crmPipelinesList - List pipelines
- crmPipelinesUpdate - Update pipeline
- crmUsersCreate - Create user
- crmUsersDelete - Delete user
- crmUsersGet - Get user
- crmUsersList - List users
- crmUsersUpdate - Update user
- ecommerceCustomersGet - Get Customer
- ecommerceCustomersList - List Customers
- ecommerceOrdersGet - Get Order
- ecommerceOrdersList - List Orders
- ecommerceProductsGet - Get Product
- ecommerceProductsList - List Products
- ecommerceStoresGet - Get Store
- fileStorageDriveGroupsCreate - Create DriveGroup
- fileStorageDriveGroupsDelete - Delete DriveGroup
- fileStorageDriveGroupsGet - Get DriveGroup
- fileStorageDriveGroupsList - List DriveGroups
- fileStorageDriveGroupsUpdate - Update DriveGroup
- fileStorageDrivesCreate - Create Drive
- fileStorageDrivesDelete - Delete Drive
- fileStorageDrivesGet - Get Drive
- fileStorageDrivesList - List Drives
- fileStorageDrivesUpdate - Update Drive
- fileStorageFilesDelete - Delete File
- fileStorageFilesDownload - Download File
- fileStorageFilesExport - Export File
- fileStorageFilesGet - Get File
- fileStorageFilesList - List Files
- fileStorageFilesSearch - Search Files
- fileStorageFilesUpdate - Rename or move File
- fileStorageFoldersCopy - Copy Folder
- fileStorageFoldersCreate - Create Folder
- fileStorageFoldersDelete - Delete Folder
- fileStorageFoldersGet - Get Folder
- fileStorageFoldersUpdate - Rename or move Folder
- fileStorageSharedLinksCreate - Create Shared Link
- fileStorageSharedLinksDelete - Delete Shared Link
- fileStorageSharedLinksGet - Get Shared Link
- fileStorageSharedLinksList - List Shared Links
- fileStorageSharedLinksUpdate - Update Shared Link
- fileStorageUploadSessionsCreate - Start Upload Session
- fileStorageUploadSessionsDelete - Abort Upload Session
- fileStorageUploadSessionsFinish - Finish Upload Session
- fileStorageUploadSessionsGet - Get Upload Session
- fileStorageUploadSessionsUpload - Upload part of File to Upload Session
- hrisCompaniesCreate - Create Company
- hrisCompaniesDelete - Delete Company
- hrisCompaniesGet - Get Company
- hrisCompaniesList - List Companies
- hrisCompaniesUpdate - Update Company
- hrisDepartmentsCreate - Create Department
- hrisDepartmentsDelete - Delete Department
- hrisDepartmentsGet - Get Department
- hrisDepartmentsList - List Departments
- hrisDepartmentsUpdate - Update Department
- hrisEmployeePayrollsGet - Get Employee Payroll
- hrisEmployeePayrollsList - List Employee Payrolls
- hrisEmployeeSchedulesList - List Employee Schedules
- hrisEmployeesCreate - Create Employee
- hrisEmployeesDelete - Delete Employee
- hrisEmployeesGet - Get Employee
- hrisEmployeesList - List Employees
- hrisEmployeesUpdate - Update Employee
- hrisPayrollsGet - Get Payroll
- hrisPayrollsList - List Payroll
- hrisTimeOffRequestsCreate - Create Time Off Request
- hrisTimeOffRequestsDelete - Delete Time Off Request
- hrisTimeOffRequestsGet - Get Time Off Request
- hrisTimeOffRequestsList - List Time Off Requests
- hrisTimeOffRequestsUpdate - Update Time Off Request
- issueTrackingCollectionsGet - Get Collection
- issueTrackingCollectionsList - List Collections
- issueTrackingCollectionTagsList - List Tags
- issueTrackingCollectionTicketCommentsCreate - Create Comment
- issueTrackingCollectionTicketCommentsDelete - Delete Comment
- issueTrackingCollectionTicketCommentsGet - Get Comment
- issueTrackingCollectionTicketCommentsList - List Comments
- issueTrackingCollectionTicketCommentsUpdate - Update Comment
- issueTrackingCollectionTicketsCreate - Create Ticket
- issueTrackingCollectionTicketsDelete - Delete Ticket
- issueTrackingCollectionTicketsGet - Get Ticket
- issueTrackingCollectionTicketsList - List Tickets
- issueTrackingCollectionTicketsUpdate - Update Ticket
- issueTrackingCollectionUsersGet - Get user
- issueTrackingCollectionUsersList - List Users
- smsMessagesCreate - Create Message
- smsMessagesDelete - Delete Message
- smsMessagesGet - Get Message
- smsMessagesList - List Messages
- smsMessagesUpdate - Update Message
- vaultConnectionConsentsList - Get consent records
- vaultConnectionConsentUpdate - Update consent state
- vaultConnectionCustomMappingsList - List connection custom mappings
- vaultConnectionsDelete - Deletes a connection
- vaultConnectionSettingsList - Get resource settings
- vaultConnectionSettingsUpdate - Update settings
- vaultConnectionsGet - Get connection
- vaultConnectionsImports - Import connection
- vaultConnectionsList - Get all connections
- vaultConnectionsToken - Authorize Access Token
- vaultConnectionsUpdate - Update connection
- vaultConsumerRequestCountsList - Consumer request counts
- vaultConsumersCreate - Create consumer
- vaultConsumersDelete - Delete consumer
- vaultConsumersGet - Get consumer
- vaultConsumersList - Get all consumers
- vaultConsumersUpdate - Update consumer
- vaultCreateCallbackState - Create Callback State
- vaultCustomFieldsList - Get resource custom fields
- vaultCustomMappingsList - List custom mappings
- vaultLogsList - Get all consumer request logs
- vaultSessionsCreate - Create Session
- vaultValidateConnectionState - Validate Connection State
- webhookEventLogsList - List event logs
- webhookWebhooksCreate - Create webhook subscription
- webhookWebhooksDelete - Delete webhook subscription
- webhookWebhooksGet - Get webhook subscription
- webhookWebhooksList - List webhook subscriptions
- webhookWebhooksUpdate - Update webhook subscription
Some of the endpoints in this SDK support pagination. To use pagination, you
make your SDK calls as usual, but the returned response object will also be an
async iterable that can be consumed using the [for await...of][for-await-of]
syntax.
[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
Here's an example of one such pagination call:
`typescript
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.accounting.taxRates.list({
serviceId: "salesforce",
filter: {
assets: true,
equity: true,
expenses: true,
liabilities: true,
revenue: true,
},
passThrough: {
"search": "San Francisco",
},
fields: "id,updated_at",
});
for await (const page of result) {
console.log(page);
}
}
run();
`
Certain 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 openAsBlob function in node:fs.Bun.file
> - Bun: The native function produces a file handle that can be used for streaming file uploads.File
> - Browsers: All supported browsers return an instance to a when reading the value from an element.fileFrom
> - Node.js v18: A file stream can be created using the helper from fetch-blob/from.js.
`typescript
import { Apideck } from "@apideck/unify";
import { openAsBlob } from "node:fs";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.accounting.attachments.upload({
referenceType: "invoice",
referenceId: "123456",
xApideckMetadata:
"{\"name\":\"document.pdf\",\"description\":\"Invoice attachment\"}",
serviceId: "salesforce",
requestBody: await openAsBlob("example.file"),
});
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:
`typescript
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.accounting.taxRates.list({
serviceId: "salesforce",
filter: {
assets: true,
equity: true,
expenses: true,
liabilities: true,
revenue: true,
},
passThrough: {
"search": "San Francisco",
},
fields: "id,updated_at",
}, {
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});
for await (const page of result) {
console.log(page);
}
}
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:
`typescript
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
retryConfig: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.accounting.taxRates.list({
serviceId: "salesforce",
filter: {
assets: true,
equity: true,
expenses: true,
liabilities: true,
revenue: true,
},
passThrough: {
"search": "San Francisco",
},
fields: "id,updated_at",
});
for await (const page of result) {
console.log(page);
}
}
run();
`
ApideckError 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. |
typescript
import { Apideck } from "@apideck/unify";
import * as errors from "@apideck/unify/models/errors";const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
try {
const result = await apideck.accounting.taxRates.list({
serviceId: "salesforce",
filter: {
assets: true,
equity: true,
expenses: true,
liabilities: true,
revenue: true,
},
passThrough: {
"search": "San Francisco",
},
fields: "id,updated_at",
});
for await (const page of result) {
console.log(page);
}
} catch (error) {
// The base class for HTTP error responses
if (error instanceof errors.ApideckError) {
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 errors.BadRequestResponse) {
console.log(error.data$.statusCode); // number
console.log(error.data$.error); // string
console.log(error.data$.typeName); // string
console.log(error.data$.message); // string
console.log(error.data$.detail); // errors.Detail
}
}
}
}
run();
`$3
Primary errors:
* ApideckError: The base class for HTTP error responses.
* UnauthorizedResponse: Unauthorized. Status code 401.
* PaymentRequiredResponse: Payment Required. Status code 402.
NotFoundResponse: The specified resource was not found. Status code 404.
BadRequestResponse: Bad Request. Status code 400.
UnprocessableResponse: Unprocessable. Status code 422`. Less common errors (6)