# getDefacto Documentation
> Defacto provides instant, embedded financing for SMBs across Europe. Our API gives you everything you need to build and scale financing inside your product — with no operational complexity or regulatory risk. We’ve powered over €1B in financing for 12K+ SMBs through 15+ partners. Plug in and launch fast.
Append .md to any documentation page URL to get its markdown version.
## API Reference
- [Get access to the API](https://developers.getdefacto.com/reference/get-access-to-the-api.md)
- [Authentication](https://developers.getdefacto.com/reference/authentication.md)
- [What are the reasons for ineligibility?](https://developers.getdefacto.com/reference/what-are-the-reasons-for-a-loan-request-rejection.md)
- [Financial products](https://developers.getdefacto.com/reference/financial-products.md)
- [Make your first loan in 5 minutes](https://developers.getdefacto.com/reference/make-your-first-loan.md)
- [Marketplace x PAY_LATER](https://developers.getdefacto.com/reference/marketplace-x-pay_later.md): You are a marketplace and you want to offer your users (buyers) a “Buy Now Pay Later” option?
- [Marketplace x CASH_IN_NOW](https://developers.getdefacto.com/reference/marketplace-x-cash_in_now.md): You are a marketplace and you want to offer your users (sellers) to get paid upfront?
- [Fintech x WALLET_FINANCING](https://developers.getdefacto.com/reference/fintech-x-open_loan.md): You are a neobank, B2B SaaS and you want to offer your users credit products?
- [How do we calculate fees](https://developers.getdefacto.com/reference/how-do-we-calculate-fees.md)
- [/bill/{bill_id}/sent](https://developers.getdefacto.com/reference/post_bill-bill-id-sent.md): This endpoint enables you to notify Defacto when you sent the bill for the fees of the loans to your user. A bill should be sent to the user only when its status is VALIDATED (see GET /bills endpoint). It is very important to use this endpoint so that Defacto can proceed to a recollection process that will be fair for our users. This endpoint is useful only for partners who send the bill themselves. By default the bills are sent the the payers of the fees by Defacto. If you need to send them by yourself please get in touch with us.
- [/bills](https://developers.getdefacto.com/reference/get_bills.md): List your fees invoices (i.e: your Defacto bill) for the loans you performed on the platform.
By default, this endpoint only returns your own bills, but you may request bills for your own specific borrowers (with a business identifier or ID) depending on your contract type.
- [/referrer/{referrer_id}/upload-invoice/{revenue_share_id}](https://developers.getdefacto.com/reference/post_referrer-referrer-id-upload-invoice-revenue-share-id.md): Upload revenue share invoice for a referrer and update the related revenue share
- [/referrer/{referrer_id}](https://developers.getdefacto.com/reference/get_referrer-referrer-id.md): Get referrer details by ID
- [/borrower/{borrower_id}](https://developers.getdefacto.com/reference/get_borrower-borrower-id.md): Retrieve the full profile of a borrower by ID. Returns the borrower's status, business information, accounts, compliance checks, and next actions required.
- [/borrower/{borrower_id}/deactivate](https://developers.getdefacto.com/reference/post_borrower-borrower-id-deactivate.md)
- [/borrower/{borrower_id}/owner](https://developers.getdefacto.com/reference/post_borrower-borrower-id-owner.md): Create a borrower owner with identity documents
- [/borrower/{borrower_id}/repayment-methods](https://developers.getdefacto.com/reference/get_borrower-borrower-id-repayment-methods.md):
If payment method is "DIRECT_DEBIT" then the `account` parameter must not be null.
If `is_default_repayment_method` is true, then the repayment method becomes the borrower's default repayment method so that upcmoing loan requests will use this payment method and account as a default.
Please note: that the account defined in the `loan_to` attribute of created loans is left unchanged. If you want to change the destination account of a loan, you must cancel it and request a new loan.
If `apply_to_all_active_loans` is true, then the repayment method is used for upcoming payments of all loans that are in TO_REPAY or TO_REPAY_FEES statuses.
This API will create a borrower and a credit line for this borrower. More information in the behavior section below.
Timeout: 30 seconds (status code will be 504 in such a case)
Borrower must be a commercial company -> eg. in France needs to be registered at an RCS.
If the borrower repays by direct debit, the following information are mandatory:
We strongly recommend that you fill up all the information when you can, even on the sandbox. For French borrowers, we manage to pull most of the director information automatically, however for other countries, this might not be the case. For the borrowers that Defacto is not able to fetch the mandatory data, you need to provide them to ensure borrower creation. Otherwise the API will return a 400 error and list the values that it could not obtain.
This API endpoint creates a borrower in our system, configures our system to get the repayment of the loan, evaluates the maximum amount of money we can lend to this company and creates a credit line for this borrower. After the credit line is created for this borrower, you can get it with GET /credit-lines?borrower=.
Synchronous and asynchronous behaviors are offered.
Synchronous behavior:
'wait_for_ready': true to activate itGET /credit-lines?borrower= and request a loan right after you received the answer from this API endpoint Asynchronous behavior (default one):
'wait_for_ready': false to activate itGET /credit-lines?borrower=.
Careful if you subscribe to the CreditLine.CREATED webhook!
If you subscribe to the webhook, please note that there is an inconsistency in the API at the moment. The webhook sends a
borrower_idthat does not correspond to the borrower id that you received with this endpoint (it's rather a business_id in our DB, that you cannot fetch).So at the moment we recommend you to
GET /credit-lines?borrower=for all borrowers waiting for a credit line when you receive the webhook event.
account field of the transactions should match the id field of the accounts you share with the POST /business/data/accounts endpoint.
- [/business/data/accounts](https://developers.getdefacto.com/reference/post_business-data-accounts.md): Upload bank account balances into our platform to refine borrower credit line allowance. This endpoint doesn't support updates on data already uploaded. The id field of the accounts should match the account field of the transactions you share with the POST /business/data/account-transactions endpoint. If you only have the IBAN of the account, the IBAN being a unique identifier, you can use the IBAN in both id and account_number.
- [/business/data/batch-upload](https://developers.getdefacto.com/reference/post_business-data-batch-upload.md): Create a batch to upload data about a particular business. This endpoint returns an id that should be put into all /business/data/XXX endpoints. **Why use batch?** - with the batch, you can send accounts transactions in chunks instead of sending them all in a single API call - with the batch, you can share more context (see parameter below) with us which enables us to update credit lines more accurately
- [/business/data/batch-upload/{batch_id}/close](https://developers.getdefacto.com/reference/post_business-data-batch-upload-batch-id-close.md): Close a batch of upload started with POST /business/data/batch-upload. This operation is a required one. Otherwise no data of the batch will be used.
- [/business/data/invoices](https://developers.getdefacto.com/reference/post_business-data-invoices.md): Upload business invoices into our platform to refine borrower credit line allowance. This endpoint doesn't support updates on data already uploaded.
- [/business/public-data](https://developers.getdefacto.com/reference/get_business-public-data.md): Search for borrower business information from various sources. This endpoint lets you find the right business identifier to use when onboarding a borrower or counterparty.
- [/business/{business_id}/segment](https://developers.getdefacto.com/reference/get_business-business-id-segment.md)
- [/cards](https://developers.getdefacto.com/reference/get_cards.md): List credit cards for the authenticated borrower.
- [/cards/{card_id}](https://developers.getdefacto.com/reference/get_cards-card-id.md): Retrieve a credit card by its ID.
- [/cards/{card_id}/entries](https://developers.getdefacto.com/reference/get_cards-card-id-entries.md): List entries for a credit card.
- [/cards/{card_id}/ephemeral-key](https://developers.getdefacto.com/reference/post_cards-card-id-ephemeral-key.md): Create an ephemeral key to reveal the card's PAN and CVV via the card display SDK.
- [/cards/{card_id}/status](https://developers.getdefacto.com/reference/patch_cards-card-id-status.md): Update card status. Accepted values: 'active', 'inactive', 'canceled'.
- [/cards/{card_id}/entries/export](https://developers.getdefacto.com/reference/get_cards-card-id-entries-export.md): Export card transactions as a Pennylane-compatible CSV. Provide either period (YYYY-MM) or from_date + to_date.
- [/counterparties](https://developers.getdefacto.com/reference/get_counterparties.md): List all the Counterparties. A Counterparty describes any commercial relations with a company. Counterparties are automatically created from the invoices.
- [/counterparties](https://developers.getdefacto.com/reference/post_counterparties.md): Create a new counterparty. A Counterparty describes any commercial relations with a company. Counterparties are automatically created from the invoices.
- [/counterparty/{counterparty_id}](https://developers.getdefacto.com/reference/get_counterparty-counterparty-id.md): Get a counterparty by id. A Counterparty describes any commercial relations with a company. Counterparties are automatically created from the invoices.
- [/credit_line](https://developers.getdefacto.com/reference/get_credit-line.md): [DEPRECATED] Get the credit line associated with your account.It should be interpreted the following way:
is_eligible is true, it means the business can receive the money originated from a loan on one of its bank accounts. is_eligible is false, it means the business can't receive the money originated from a loan. If the business is the borrower's supplier, it does not prevent the borrower from requesting a loan. However, the money has to arrive in a bank account owned by the borrower, not by the supplier. It should be interpreted the following way:
is_eligible is false and reasons is null or [] it means the borrower **might** be eligible. This will depend on his financials and will be evaluated after you share data with the /business/data/XXX endpoints. is_eligible is true, the borrower is eligible. However, we recommend you to share the data you have with the /business/data/XXX endpoints in order to have a more accurate (likely higher) eligible amount. is_eligible is false and all items of reasons are in: [OUTDATED_DATA, KYB_STATUS] this means the borrower might be eligible depending on his financing, and we are expecting him to perform a few actions prior to requesting loan. Once you register the borrower, this will be represented by the borrower's status. to_account field of the next invoice and loan that you create for this counterparty. For more information on the scenarios of the sandbox, please refer to the Testing Multiple Scenarios & Errors section. Warning: these IBANs will not work in production.
- [/sandbox/invoice-generator](https://developers.getdefacto.com/reference/post_sandbox-invoice-generator.md): !!! The documentation website is not able to display the full response of this endpoint. The use of the curl command is recommended. !!! Generate a fake invoice that will produce a given scenario on the sandbox, for example a rejected loan. The generation will not add the invoice to the list of your invoices. You must do this via API. To achieve this, you can copy the invoice_creation_payload into the payload of the invoice creation API. If you want to test another scenario on a given business, create another fake invoice. For more information on the scenarios of the sandbox, please refer to the Testing your integration section. Warning: these invoices and their IBANs will not work in production.
- [/installment-plan/{installment_plan_id}](https://developers.getdefacto.com/reference/get_installment-plan-installment-plan-id.md): ## Keep track of the progress of an installment plan When the borrower is late to repay his loans or bills, he probably agreed to an installment plan. This endpoint lets you keep track of a given installment plan. When every installments are in PAID status, the plan is fully repaid.
- [/recollection-case/{recollection_case_id}](https://developers.getdefacto.com/reference/get_recollection-case-recollection-case-id.md): Get details of a recollection case.
- [/recollection-case/{recollection_case_id}](https://developers.getdefacto.com/reference/put_recollection-case-recollection-case-id.md): Add notes to a recollection case to follow up on recollection process.
- [/recollection-case/{recollection_case_id}/installment-plans](https://developers.getdefacto.com/reference/post_recollection-case-recollection-case-id-installment-plans.md): ## Allow repaying in multiple times This endpoint is dedicated to the creation of an installment plan as part of recollection strategy. You'll need a recollection-case id to use this endpoint. In the event of insolvency, your debtor can opt for an installment plan to repay his debt with smaller recurring pamyents. This smoothens the repayment effort, allowing the debtor to reimburse selected loans or bills progressively. the value of the `installment` parameter must be obtained by calling the POST /installment-plan/compute endpoint. The `repayment_method` field allows you to decide between direct-debit and sepa credit transfer. If you pick DIRECT_DEBIT, the debited account will reuse borrower's main repayment account. cf. GET /borrower/{borrower_id}/repayment-methods endpoint We know recollection process has costs, for this reason the `recollection_fees` field permits adding an arbitrary amount to proposed installment plan. This amount can cover recollection expenses for example. When recollection_fees are collected, they are paid-out to the partner later.
- [/recollection-case/{recollection_case_id}/installment-plans/compute](https://developers.getdefacto.com/reference/post_recollection-case-recollection-case-id-installment-plans-compute.md): ## Simulate an installment plan Before creating an installment plan you might need to expose installment amounts & dates to your debtor so that you can find the right agreement. This endpoint will help you achieving such simulation. To use this endpoint, you'll need to provide the list of loans or bills you want to repay with proposed plan. Then select plan starting date and periodicity. The system automatically returns a plan avoiding avoiding bank holidays and weekends and explicitly, enlists loans paid on every installment & gives the lettering of each installment. The returned payload will serve as an input for POST /recollection-case/is_draft parameter. Otherwise set is_draft to false. - This endpoint requires the base64-encoded value of the PDF of the invoice. You can for example use [base64guru](https://base64.guru/converter/encode/pdf).
- [/invoices/upload](https://developers.getdefacto.com/reference/post_invoices-upload.md): Create an invoice entity from the PDF of an invoice. Send the file within a formData. The endpoint will automatically extract the invoice information and create an invoice entity from them.
- [/loan/documents/{document_type}](https://developers.getdefacto.com/reference/post_loan-documents-document-type.md): Generates a link to an archive of loan documents
- [/loan/repayment-terms](https://developers.getdefacto.com/reference/put_loan-repayment-terms.md): Changing the payment method and / or date is only possible on loans that are TO_REPAY or TO_REPAY_FEES.
Postponing loan repayment date is only possible once, except for some financial products with customized rescheduling rules. An overall ceiling (configurable per financial product, 30 days by default) from the original contractual date still applies regardless. Repaying earlier is never restricted.
If loan is supposed to be repaid using a sepa direct-debit, you may not be able to change the debited account number less than 3 days before the scheduled payment date because payment has already been instructed. In such case you'll get a 400 error telling you that the payment cannot be cancelled anymore.
salt_id parameter to a unique value for each request. **Timeout after**: 30 seconds (status code will be 504 in such a case) For loan related to invoices, at the moment, we don't support multiple-invoices financing. - You can either request a loan for an existing invoice, in which case you should set invoice_ids. - Or you can create the invoice and request a loan with a single call to this API. - If you pass an invoice in invoices, the base64-encoded value of the PDF of the invoice is required under the document property. You can for example use base64guru. ### Behavior When you send this API request, our system will: 1. Create a loan (you will get its id in the response) 2. Start evaluating your loan request. Here you should choose between 2 behaviors: a. (default) Getting the decision asynchronously. The status of the returned loan will always be PENDING_VALIDATION. Webhooks will tell you if it goes approved or declined. In can happen from a few seconds after the request up to a few days after it. b. Getting the decision synchronously. This is recommended if this endpoint is called directly from a frontend. To activate this option, set "wait_for_validation": true. In such a case, the returned loan status will be: i. if the loan is automatically accepted by Defacto -> the status of the loan will be TO_VALIDATE if you set "auto_validate": false, or one of: VALIDATED, SCHEDULED, INITIATED, TO_REPAY. Fore more information on this, see section "Why the status of the loan in the response vary?" below. ii. if the loan is automatically declined by Defacto -> the status of the loan will be DECLINED and the denial_reason will be set. iii. if the loan validation takes longer than 20s (max response time is 2 business days) -> the status of the loan will be PENDING_VALIDATION. It is therefore very important to think about how to communicate with the end-user. While its not an issue for validated loans, it can get frustrating for declined loans. Users must be alerted of loans that gets declined few hours after their request. 3. If the loan is accepted by Defacto, it will then move forward and its status will be updated regularly. Subscribe to webhooks to get live notifications of this. **Why the status of the loan in the response vary?** The status vary because our system is asynchronous and the steps moving the loan forward may be executed immediately or not depending on the current load on our system. **What should I do if the status of the loan is __TO_VALIDATE__?** TO_VALIDATE means that Defacto accepted the loan as is. The next step is to get the user consent for this loan offer. When obtained, call [POST /loan/{loan_id}/validate](https://developers.getdefacto.com/reference/post_loan-loan-id-validate). Most of the time the user does not want to do this manual consent. To avoid requiring this, you can set "auto_validate": true in your request. When setting this option, please ensure that its very explicit for the user that the loan may be automatically accepted and paid so that they won't be able to cancel it. Users can cancel the loan only before Defacto sends the money to the beneficiary, which happens 24 to 48 hours before the "to_pay_at" date.
- [/loan-request/{loan_request_id}](https://developers.getdefacto.com/reference/get_loan-request-loan-request-id.md): Read back a loan request opened by the caller's distribution.
- [/loan-requests](https://developers.getdefacto.com/reference/get_loan-requests.md): List the loan requests opened by the caller's distribution.
- [/loan-requests](https://developers.getdefacto.com/reference/post_loan-requests.md): Create an editable DRAFT loan request and return the front redirect URL.
- [/repay/now](https://developers.getdefacto.com/reference/post_repay-now.md)
- [/recollection-case/{recollection_case_id}/actions](https://developers.getdefacto.com/reference/post_recollection-case-recollection-case-id-actions.md): ## Add a recollection action to a case Record an action on an existing recollection case: either to log an action taken (the due date can be today) or to assign a task for a teammate to handle. The action needs a name and a due date; the description is optional. The author is taken from your identity. Provide `assignee` (an agent email) to assign the mirrored HubSpot task to that person; when the email matches a HubSpot owner the task is assigned to them, otherwise the task is created unassigned.
- [/subscription/{subscription_id}/activate](https://developers.getdefacto.com/reference/post_subscription-subscription-id-activate.md): Activate a subscription.
- [/subscription/invoice/{invoice_id}/download](https://developers.getdefacto.com/reference/get_subscription-invoice-invoice-id-download.md): Get a freshly presigned download URL for a subscription invoice PDF.
- [/webhook/{webhook_id}](https://developers.getdefacto.com/reference/delete_webhook-webhook-id.md): Delete a webhook subscription.
- [/webhook/{webhook_id}](https://developers.getdefacto.com/reference/patch_webhook-webhook-id.md): Update a webhook subscription. ⚠️ Our webhooks always call the POST method of the given url. For more information on webhooks such as how to secure them, you can refer to our guide.
- [/webhooks](https://developers.getdefacto.com/reference/get_webhooks.md): List your webhook subscription. ⚠️ Our webhooks always call the POST method of the given url. For more information on webhooks such as how to secure them, you can refer to our guide.
- [/webhooks](https://developers.getdefacto.com/reference/post_webhooks.md): Create a webhook subscription. ⚠️ Our webhooks always call the POST method of the given url. For more information on webhooks such as how to secure them, you can refer to our guide.
## Recipes
- [Finance payables](https://developers.getdefacto.com/recipes/finance-payables-1.md)
- [Finance receivables](https://developers.getdefacto.com/recipes/finance-receivables.md)
- [Migrating from Credit Line to Financial Products](https://developers.getdefacto.com/recipes/migrating-from-credit-line-to-financial-products.md)
- [Onboard your customers](https://developers.getdefacto.com/recipes/onboard-your-customers.md)
- [Track loans & status](https://developers.getdefacto.com/recipes/track-loans-status.md)