@qontoctl/core
v0.10.2
Published
Core library for Qonto API integration
Maintainers
Readme
@qontoctl/core
Core library for Qonto API integration — HTTP client, authentication, configuration, and typed service functions.
Part of the QontoCtl project.
Installation
npm install @qontoctl/coreUsage
import { resolveConfig, buildApiKeyAuthorization, HttpClient, getOrganization } from "@qontoctl/core";
// Resolve configuration from file or environment
const { config, endpoint } = await resolveConfig();
// Build authorization headers
const authorization = buildApiKeyAuthorization(config.apiKey);
// Create an HTTP client
const client = new HttpClient({ baseUrl: endpoint, authorization });
// Fetch organization details
const org = await getOrganization(client);API
Configuration
resolveConfig(options?): Promise<ConfigResult>— resolve credentials from config files and environment variablesloadConfigFile(path)— load a YAML configuration filevalidateConfig(config)— validate configuration structureapplyEnvOverlay(config, prefix?)— overlay environment variable overridesisValidProfileName(name)— check if a profile name is validsaveOAuthTokens(path, tokens)— save OAuth tokens to a config filesaveOAuthClientCredentials(path, credentials)— save OAuth client credentials to a config fileclearOAuthTokens(path)— remove OAuth tokens from a config fileConfigError— error thrown on configuration validation failures or missing credentials
Authentication
buildApiKeyAuthorization(credentials)— build authorization headers from API key credentialsbuildOAuthAuthorization(tokens)— build authorization headers from OAuth tokensgenerateCodeVerifier()— generate a PKCE code verifiergenerateCodeChallenge(verifier)— generate a PKCE code challenge from a verifierexchangeCode(params)— exchange an authorization code for tokensrefreshAccessToken(params)— refresh an expired access tokenrevokeToken(params)— revoke an OAuth tokenAuthError— error thrown when credentials are missing or invalid
HTTP Client
HttpClient— HTTP client for the Qonto API with rate-limit handlingQontoApiError— typed error for Qonto API error responsesQontoRateLimitError— error for rate-limit (429) responsesQontoScaRequiredError— error for SCA-required (403) responses
SCA (Strong Customer Authentication)
getScaSession(client, scaId)— retrieve an SCA session by IDpollScaSession(client, scaId, options?)— poll an SCA session until completionexecuteWithSca(fn, callbacks, options?)— execute an API call with SCA handlingmockScaDecision(client, scaId, decision)— mock an SCA decision (sandbox only)ScaDeniedError— error when SCA is denied by the userScaTimeoutError— error when SCA polling times out
Constants
API_BASE_URL— production API base URL (https://thirdparty.qonto.com)SANDBOX_BASE_URL— sandbox API base URL (https://thirdparty-sandbox.staging.qonto.co)CONFIG_DIR— default config directory path (~/.qontoctl)OAUTH_AUTH_URL/OAUTH_AUTH_SANDBOX_URL— OAuth authorization endpointsOAUTH_TOKEN_URL/OAUTH_TOKEN_SANDBOX_URL— OAuth token endpointsOAUTH_REVOKE_URL/OAUTH_REVOKE_SANDBOX_URL— OAuth revoke endpoints
Services
getOrganization(client)— fetch organization detailsgetBankAccount(client, id)— fetch a bank account by IDcreateBankAccount(client, params)— create a new bank accountupdateBankAccount(client, id, params)— update a bank accountcloseBankAccount(client, id)— close a bank accountgetIbanCertificate(client, id)— download IBAN certificate PDFresolveDefaultBankAccount(client)— resolve the default bank accountgetTransaction(client, id)— fetch a transaction by IDbuildTransactionQueryParams(params)— build query parameters for transaction listinggetBeneficiary(client, id)— fetch a beneficiary by IDcreateBeneficiary(client, params)— create a SEPA beneficiaryupdateBeneficiary(client, id, params)— update a beneficiarytrustBeneficiaries(client, ids)— trust beneficiariesuntrustBeneficiaries(client, ids)— untrust beneficiariesbuildBeneficiaryQueryParams(params)— build query parameters for beneficiary listinggetTransfer(client, id)— fetch a transfer by IDcreateTransfer(client, params)— create a SEPA transfercancelTransfer(client, id)— cancel a pending transfergetTransferProof(client, id)— download transfer proof PDFverifyPayee(client, params)— verify a payee (VoP)bulkVerifyPayee(client, entries)— bulk verify payeesbuildTransferQueryParams(params)— build query parameters for transfer listingcreateInternalTransfer(client, params)— create an internal transfergetBulkTransfer(client, id)— fetch a bulk transfer by IDgetRecurringTransfer(client, id)— fetch a recurring transfer by IDgetClientInvoice(client, id)— fetch a client invoice by IDcreateClientInvoice(client, params)— create a draft client invoiceupdateClientInvoice(client, id, params)— update a draft client invoicedeleteClientInvoice(client, id)— delete a draft client invoicefinalizeClientInvoice(client, id)— finalize a client invoicesendClientInvoice(client, id)— send a client invoice via emailmarkClientInvoicePaid(client, id)— mark a client invoice as paidunmarkClientInvoicePaid(client, id)— unmark paid statuscancelClientInvoice(client, id)— cancel a finalized client invoiceuploadClientInvoiceFile(client, id, file)— upload a file to a client invoicegetClientInvoiceUpload(client, id, uploadId)— get upload detailsbuildClientInvoiceQueryParams(params)— build query parameters for client invoice listinggetSupplierInvoice(client, id)— fetch a supplier invoice by IDbulkCreateSupplierInvoices(client, entries)— bulk create supplier invoicesbuildSupplierInvoiceQueryParams(params)— build query parameters for supplier invoice listinguploadAttachment(client, file)— upload an attachmentgetAttachment(client, id)— fetch attachment detailslistTransactionAttachments(client, transactionId)— list transaction attachmentsaddTransactionAttachment(client, transactionId, attachmentId)— add attachment to transactionremoveAllTransactionAttachments(client, transactionId)— remove all transaction attachmentsremoveTransactionAttachment(client, transactionId, attachmentId)— remove specific attachmentgetEInvoicingSettings(client)— fetch e-invoicing settings
Types
Configuration: QontoctlConfig, ApiKeyCredentials, OAuthCredentials, ConfigResult, ResolveOptions, LoadResult, ValidationResult, TokenUpdate
Auth: OAuthTokens, Authorization
HTTP: HttpClientOptions, HttpClientLogger, QueryParams, QueryParamValue, QontoApiErrorEntry
SCA: ScaSession, ScaSessionStatus, ScaMethod, PollScaSessionOptions, ExecuteWithScaCallbacks, ExecuteWithScaOptions
API: Organization, BankAccount, PaginationMeta, Transaction, TransactionLabel, ListTransactionsParams, Statement, StatementFile, Label, Membership
Beneficiaries: Beneficiary, ListBeneficiariesParams, CreateBeneficiaryParams, UpdateBeneficiaryParams
Transfers: Transfer, ListTransfersParams, CreateTransferParams, VopEntry, VopResult, InternalTransfer, CreateInternalTransferParams, BulkTransfer, BulkTransferResult, BulkTransferResultError, RecurringTransfer
Clients: Client, ClientAddress
Invoicing: ClientInvoice, ClientInvoiceAmount, ClientInvoiceDiscount, ClientInvoiceItem, ClientInvoiceAddress, ClientInvoiceClient, ClientInvoiceUpload, ListClientInvoicesParams, SupplierInvoice, SupplierInvoiceAmount, ListSupplierInvoicesParams, BulkCreateSupplierInvoiceEntry, BulkCreateSupplierInvoiceError, BulkCreateSupplierInvoicesResult, CreditNote, CreditNoteAmount, CreditNoteClient, CreditNoteItem
Other: Quote, QuoteAddress, QuoteAmount, QuoteClient, QuoteDiscount, QuoteItem, Request, RequestFlashCard, RequestVirtualCard, RequestTransfer, RequestMultiTransfer, EInvoicingSettings, Attachment, CreateBankAccountParams, UpdateBankAccountParams
Configuration Resolution
QontoCtl resolves credentials in this order:
QONTOCTL_*environment variables (highest priority).qontoctl.yamlin the current directory~/.qontoctl.yaml(home default)
With --profile <name>:
QONTOCTL_<NAME>_*environment variables~/.qontoctl/<name>.yaml
Requirements
- Node.js >= 24
License
AGPL-3.0-only — For commercial licensing, contact the maintainer.
