Lending API

API change history

Introduction

Lending API allows MarketFinance partners to interact with MarketFinance lending products via API. Lending API covers the following main use cases:

  1. Request a quote for a given customer
  2. Refer a potential customer to MarketFinance (the customer need to be redirected to MarketFinance application journey to complete the application)
  3. Submit a full application for MarketFinance (the customer doesn't need to be redirected to the MarketFinance application journey)

Access to the API is restricted to selected partners and those with access will have received the relevant credentials.

If you want to learn more about LendingAPI, please contact us at apisupport@marketfinance.com.

Cross-Origin Resource Sharing

This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec. And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.

Authorization

Once you have been approved to use the API, you will have access to your own API keys that must be sent using the header X-MarketFinance-ApiKey with every request.

All incoming data and outgoing responses will be provided using JSON.

All requests must be sent over HTTPS.

Rate Limiting

To manage the volume of requests on the API, limits are placed on the number of requests that can be made. This approach ensures we can continue to have a reliable API for partners to consume.

The requests are measured over a specified period of time per API key. The current limitations are that no more than 2000 requests can be made to the API every 5 minutes across all endpoints. If the limit is breached, the API will begin to respond with 429 Too Many Requests until the time interval has refreshed.

If limits are consistently breached on the API, we may temporarily disable your access to the API and inform you of this.

Response Status Codes

API requests made to Lending Api endpoints may return a number of different HTTP status codes.

Status Code Description
200 OK The request was received and successfully processed by LendingApi.
201 Created The request was received, successfully processed and a new resource was created.
400 Bad Request The request body could not be understood by the server or contains semantic errors. The response body provides details of the specific reason for the error.
401 Unauthorized The X-MarketFinance-ApiKey header was not present or is invalid.
404 Not Found The requested resource could not be found.
429 Too Many Requests The application has exceeded the rate limit. See Rate Limiting.
500 Internal Server Error An unexpected internal error has occurred. Please contact us at apisupport@marketfinance.com so that we can investigate further.
503 Service Unavailable The server is currently unavailable and cannot accept requests. We will inform Partner of any planned downtime or outages. If you have not received any communication and you have received this response code, please contact apisupport@marketfinance.com.

Definitions

Borrower: A legal entity requesting funding.

Partner: A consumer of the MarketFinance Lending API that intends to offer MarketFinance products to Borrowers.

Application: A set of data points used to generate a Quote or an Offer. Contains information about the Borrower and their funding needs.

Quote: Indicative funding terms for a given Borrower. Intended to inform the Borrower of the likelihood of receiving funding and indicative pricing if they are to continue with their application. There are two types of quotes - Representative Quote and Accurate Quote.

Representative Quote: A static (hardcoded) quote that is being returned regardless of the inputs provided. It doesn’t reflect the riskiness or eligibility of a given Borrower.

Accurate Quote: A quote stating the actual price (and other product parameters) the Borrower would likely get if they decide to apply.

Offer: An underwritten offer with the final pricing for the funding being requested.

Webhook: The way in which the Lending API exposes events to the Partner when either Quotes and Offers are created or their state changes (e.g. Borrower accepts an Offer).

Integration Scenarios

The Lending API provides two integration scenarios, those being the Referral Journey and then Full Application Journey.

Referral Journey

This integration scenario is used if the Partner wants to refer a potential Borrower to MarketFinance and the Partner doesn't have enough data to submit a full application.

The main steps are:

  1. The Partner calls into Lending API and provides the data points they currently have.
  2. Lending API responds with the quote and the URL to continue the application.
  3. The Partner presents the quote to the Borrower, if the Borrower is willing to proceed, the Partner redirects the Borrower to the URL received from the API.
  4. The Borrower fills out remaining fields and submits the application.

On a lower level the same steps will look like the following:

  1. Partner makes a request to the Lending API CreateApplication endpoint to register a draft application on the API.
  2. Lending API responds with a 201 Created status code to confirm the application has been created.
  3. Lending API provides Accurate or Representative quotes to the Partner via webhook or GetOffersByApplicationId endpoint.
  4. Partner displays a button on their web site to allow the Borrower to accept the quote.
  5. Borrower clicks the button to accept the quote.
  6. Partner calls AcceptOffer endpoint of Lending API and redirects the Borrower to the MarketFinance-hosted application journey web site via RedirectUrl link provided in (3). See the animated gif with the full journey below.
  7. Borrower validates pre-populated data, fills out remaining fields and submits the application on the application journey website.
  8. Lending API notifies the Partner via the Webhook in case the Offer is generated for the Borrower or if additional actions are required from the Borrower to proceed.

Referral Journey sequence diagram:

Referral Journey

Application journey on the MarketFinance-hosted web-site:

Referral Journey Walkthrough

Full Application Journey

This integration scenario is used if the Partner wants to refer a potential Borrower to MarketFinance but doesn't want the Borrower to be redirected to any 3rd party web-sites.

Typical sequence of actions:

  1. Partner makes a request to the CreateApplication endpoint to create a draft application.
  2. Lending API responds with a 201 Created status code to confirm the application has been created.
  3. Lending API begins risk decisioning process to determine borrower's eligibility.
  4. Lending API notifies the Partner via the Webhook in case the Offer is generated for the Borrower or if additional actions are required from the Borrower to proceed.

Full Application Journey sequence diagram:

Full Application Journey

Defined Types

Unless specified otherwise, all properties are Required when making API calls.

Application

A set of data points used to generate a Quote or an Offer. Contains information about the Borrower and their funding needs.

Property DataType Description Constraints
ExternalIdentifier String The unique application identifier from the Partner. Must be between 1 and 256 characters. Must be unique across all applications created by Partner.
IsAutoSubmit Boolean false to proceed with Referral Journey, true to proceed with Full Application Journey. Optional, false by default.
ReasonForFunding String (Enum)
Reason for Funding
The reason for funding. Optional. See Reason for Funding for more details.
ReasonForFundingOtherDetails String Additional details in case Other was provided as a value for ReasonForFunding. Required in case Other was provided as a value for ReasonForFunding.
ApplicationStatus String (Enum)
Application Status
The status of the application. This field doesn't need to be provided when calling CreateApplication endpoint. See Application Status.
Company Object
Company
The Borrower company details.
Applicant Object
Applicant
Details of the person submitting an application. Applicant's details may differ from Director's details.
Director Object
Director
Borrower's company director details. Application is submitted on behalf of this director. In case an Applicant and Director is the same person the same details should be provided into both fields.
FundingRequests Object
Array Funding Request
An array of Funding Requests. See Funding Request for more details. At least one funding request has to be provided.
Documents Object
Array Document
An array of Documents. See Document for more details. Optional.

Examples:

Application with required fields only

{
  "externalIdentifier" : "Borrower 123",
  "company": {
    "registrationNumber" : "00000002",
    "name": "Company 123"
  },
  "applicant": {
    "email": "john.doe@corp.com",
    "firstName": "John",
    "lastName": "Doe",
    "phoneNumber": "0123456711"
  },
  "director": {
    "email": "director@mail.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "dateOfBirth": "2000-01-01",
    "postCode": "PO2 7NE",
    "country": "UK",
    "addressLine1": "Address Line 1",
    "city": "Portsmouth",
    "addressDurationMonths": 15
  },
  "fundingRequests": [
    {
        "fundingType": "TermLoan",
        "amount": 150000,
        "tenorType": "Year"
    }
  ]
}

Application with all fields populated

{
  "externalIdentifier" : "Borrower 123",
  "isAutoSubmit": false,
  "reasonForFunding": "Other",
  "reasonForFundingOtherDetails": "Test",  
  "company": {
    "registrationNumber" : "00000002",
    "name": "Company 123"
  },
  "applicant": {
    "email": "john.doe@corp.com",
    "firstName": "John",
    "lastName": "Doe",
    "phoneNumber": "0123456711"
  },
  "director": {
    "email": "director@mail.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "dateOfBirth": "2000-01-01",
    "postCode": "PO2 7NE",
    "country": "UK",
    "addressLine1": "Address Line 1",
    "addressLine2": "Address Line 2",
    "city": "Portsmouth",
    "region": "Region",
    "addressDurationMonths": 15
  },
  "fundingRequests": [{
    "fundingType": "TermLoan",
    "amount": 150000,
    "tenorType": "Year"
  }],
  "documents": [{
    "documentType": "BankStatement",
    "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "fileName": "BankStatement.pdf"
  },
  {
    "documentType": "StatutoryAccount",
    "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "fileName": "StatutoryAccount.pdf"
  },
  {
    "documentType": "SupportingDocument",
    "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "fileName": "SupportingDocument.pdf"
  }]
}

Reason For Funding

Defines how the Borrower is planning to use the proceeds from a lending product requested (e.g. loan).

Name Description
WorkingCapital Funding planned to be used for the Borrower's company working capital.
Investment Funding planned to be used to support the Borrower's company investments.
RefinancingCbilsOrBblFacility Funding planned to be used for refinancing Cbils or Bbl facility.
RefinancingMarketFinanceDebt Funding planned to be used to refinance Market Finance debt.
RefinancingAnyOtherDebt Funding planned to be used to refinance any other debt.
Other Other reason than those specified above. Additional details are required if this value is selected.
RefinancingRLSFacility Funding planned to be used to refinance RLS facility.

Application Status

Defines the current state of the application. It is set by the Lending Api based on the application processing phase.

Name Description
ProcessingDraft All new applications created via Lending Api have ProcessingDraft status by default. It can either be transitioned to Draft or Blocked.
Draft Lending API completed the initial processing of data provided (e.g. downloading documents).
ProcessingSubmit Borrower completed the application journey and submitted the application.
Submitted Lending API completes the initial processing of provided data after the application submission.
Blocked There is a problem with the application and it's not possible to process it, e.g. there is another active application for the same Borrower. This state is a terminal state.
RiskRejected MarketFinance is unable to satisfy the funding request from the Borrower due to the MarketFinance risk policy.
MoreInformationRequired Additional details are required from the Borrower to proceed with the application (e.g. incomplete documents were provided). The Borrower will be contacted by MarketFinance representative.

Company

Borrower's company information.

Property DataType Description Constraints
Name String Legal name of the company. Must be between 1 and 256 characters.
RegistrationNumber String UK Company Registration Number. Must be valid UK Company registration number.

Applicant

Contact information for the person submitting the application.

Property DataType Description Constraints
FirstName String Applicant's first name. Must be between 1 and 256 characters.
LastName String Applicant's last name. Must be between 1 and 256 characters.
Email String Applicant's email address. Must be valid email address.
PhoneNumber String Applicant's contact phone number. Applicant's UK phone number starting either from +44 or from 0.

Director

The details for the director of the Borrower company. The application is submitted on behalf of this director.

Property DataType Description Constraints
FirstName String Director's first name. Must be between 1 and 256 characters.
LastName String Director's last name. Must be between 1 and 256 characters.
Email String Director's email address. Must be valid email address.
DateOfBirth DateTime Director's date of birth. Director must be at least 18 years old.
AddressLine1 String First line of the address. Must be between 1 and 256 characters.
AddressLine2 String Second line of the address. Must be between 1 and 256 characters. Optional.
Country String Name of the country. Must be between 1 and 256 characters.
City String Name of the city. Must be between 1 and 256 characters.
Region String Name of the region. Must be between 1 and 256 characters. Optional.
PostCode String A valid postal code. Must be a valid UK postal code.
AddressDurationMonths Long (int32) How long has the director lived at their current address (in months). Must be greater than 0.

Funding Request

Details about the funding product requested.

Property DataType Description Constraints
FundingType String (Enum)
Funding Type
Requested product type.
Amount Decimal Requested amount in GBP. Must be greater than 0.
TenorType String (Enum)
Tenor Type
Required product duration.

Funding Type

The type of the product the applicant is appying for.

Name Description
TermLoan MarketFinance Business Loan product.

Tenor Type

Product duration.

Name Description
HalfYear 6 months product duration.
Year 12 months product duration.
TwoYears 24 months product duration.
ThreeYears 36 months product duration.
FourYears 48 months product duration.
FiveYears 60 months product duration.
SixYears 72 months product duration.

Document

Document containing the information required for risk assessment.

Property DataType Description Constraints
Url String (Uri) The document uri for downloading. Must be a valid url address of 2048 characters max.
FileName String Document's file name. Must be a valid filename of 256 characters max.
DocumentType String (Enum)
Document Type
The type of the document.

Document Type

The type of the document.

Name Description
BankStatement Official bank statement.
StatutoryAccount Statutory accounts document.
SupportingDocument Any other documents.

Offer

An underwritten offer with the final pricing for the funding being requested.

Property DataType Description Constraints
Id String (uuid) The unique identifier of the offer.
ExpiryAt DateTime Offer's expiry date after which the offer will no longer be valid. Optional.
Status String (Enum)
Offer Status
The status of the offer. See Offer Status for more details.
Details String Details of the offer (additional information), e.g. "Representative Rate".
OfferType String (Enum)
Offer Type
The type of the offer. See Offer Type for more details.
FundingType String (Enum)
Funding Type
The product being offered. See Funding Type for more details.
AnnualPercentageRate Decimal APR - the yearly interest generated by a sum that's charged to borrowers. Must be greater than 0.
InterestRate Decimal The nominal annual interest rate of the product being offered. Optional. Must be greater than or equal to 0.
Amount Decimal The amount offered to borrower (e.g. the loan principal amount). Optional.
Duration String (Enum)
Tenor Type
The tenor of the product being offered.
StatusChangedAt DateTime The last offer's status change date.
RepaymentFrequency String (Enum)
Repayment Frequency
Installment frequency - how frequently the borrower have to make repayments. Optional.
TotalAmountPayable Decimal The total amount payable by the Borrower (e.g. principal + accrued interest + arrangement fee for the loan). Optional. Must be greater than or equal to 0.
ArrangementFee Object
Arrangement Fee
An administration charge for arranging the requested lending product. Optional.

Offer Status

The current status of the Offer.

Name Description
Offered All new offers created via Lending Api have Offered status by default.
Expired Expiration date of the offer has passed, the offer is no longer valid. This state is a terminal state.
CustomerAccepted Borrower has accepted the offer. This state is assign when Partner calls AcceptOffer endpoint.
Advanced Funds were advanced to the Borrower. This state is a terminal state.
Archived The offer is no longer valid. E.g. the Borrower has accepted the Quote, but decided not to take the product later in the process.

Offer Type

Lending Api support multiple types of offers, those being:

Name Description
Representative A static (hardcoded) quote that is being returned regardless of the inputs provided. It doesn’t reflect the riskiness or eligibility of a given Borrower.
Accurate A quote stating the actual price (and other product parameters) the Borrower would likely get if they decide to apply.
Underwritten An underwritten offer with the final product parameters and the pricing for the funding being requested.

Repayment Frequency

Installment frequency - how frequently the borrower have to make repayments.

Name Description
Monthly Repayments have to be made each month.

Arrangement Fee

An administration charge for arranging the requested lending product.

Property DataType Description Constraints
Amount Decimal The amount to be charged in GBP. Must be greater than or equal to 0.
IncludeInPrincipal Boolean Defines whether the arrangement fee is added to the principal true or will be deducted from the advanced amount false. This is specific to the product and cannot be modified.

Webhooks

The Lending API uses webhooks to send POST requests to Partner's application when a specific event occurs. Webhooks is a better alternative than polling specific endpoints for changes.

The following events are supported via webhooks:

  • ApplicationStatusChanged - An application has transitioned to a different status.
  • OfferStatusChanged - An offer has transitioned to a different status.
  • DocumentDownloadFailure - An error happen while Lending API was trying to download the documents provided by Partner.

ApplicationStatusChanged

{
    "applicationIdentifier": "7ec9ada6-d63b-492c-85b2-24cf05db82d9",
    "status": "Draft",
    "updatedAt": "2022-09-06T07:09:10.8096713+00:00",
    "createdAt": "2022-09-06T07:09:07.6731881+00:00",
    "redirectUrl": "https://apply-staging.marketfinance.ninja/application/7ec9ada6-d63b-492c-85b2-24cf05db82d9/continue?key=VQDsPYCs4uqpVnrGtO9oDJAF7E4OvFHCuSfRoqAy1piltGRmeymY8jR6khk5/W0t8TqlZ/ks6F6m4hOvatHOFt0RAI1RRD3036JMLtEgKvBtHxVTuxLRpoWCfTBBjCi7ZTR7dltsMXWqxQXIDOiYoF85eIYkNBFo9eIfI1ZHeenTh8JDnMocJnerNq9HeNzVmmkQgPUlFKC/tVyxMY6r04M0/niR25YT3CIbSJvyhjsfPcHmAfqsG3VBeoHMcOxB44h4LdTj9Yg3LwiPFXf+p2M5iw+NQuCASgyj3fMlojILNIWkS8EjeOUMIqCHRS5zM3Vsx/S+OWvSqEd/0j63Kw=="
}

OfferStatusChanged

{
    "expiryAt": "2022-09-13T07:11:35.5646208+00:00",
    "status": "Offered",
    "details": "Standard display name - Standard description",
    "fundingType": "TermLoan",
    "offerType": "Accurate",
    "annualPercentageRate": 0.077800,
    "interestRate": 0.074900,
    "id": "d0b4c944-1d5e-4f7c-af13-7ed74893ee32",
    "amount": 1320000.0000,
    "duration": "Year",
    "statusChangedAt": "2022-09-06T07:11:37.2226245+00:00",
    "repaymentFrequency": "Monthly",
    "totalAmountPayable": 1398657.6200,
    "arrangementFee": {
      "amount": 1200000.0000,
      "includeInPrincipal": true
    }
  }

DocumentDownloadFailure

{
    "applicationIdentifier": "0a6638f7-3c8a-4187-8d3d-695f53442448",
    "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy1.pdf",
    "fileName": "BankStatement.pdf",
    "documentType": "BankStatement",
    "errorMessage": "Unable to download file at url https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy1.pdf"
}

Configuring Webhooks

In order to configure Webhooks, please contact us at apisupport@marketfinance.com and provide with a list of target urls (URLs that will be invoked by the Lending API) for each webhook type for both test and production environments.

Verifying Webhooks

When your server receives requests from webhooks, the authenticity and integrity of the request should be verified. You will be able to perform this verification by generating a hash-based message authentication code (HMAC) based on the payload in the webhook request and a secret key specific to you.

The Lending API signs the payload in the request and includes a base64-encoded HMAC in the request header X-LendingApi-Signature. To verify the webhook was sent from the LendingApi API and the integrity of the payload, you should:

  1. Retrieve your key that you should have received from the MarketFinance team. This should be stored securely on your server.
  2. Generate a HMAC-SHA256 hash based on the payload you received in the request and your HMAC key.
  3. The generated hash should be base64-encoded.
  4. Compare this generated value with the value from X-LendingApi-Signature. If the two match, then the webhook has been verified as being sent from the LendingApi API.

Code sample (C#, .NET):

using System.Security.Cryptography;
using System.Text;
...
using var hmacSha256 = new HMACSHA256(Encoding.UTF8.GetBytes(hmacKey));
var hashBytes = hmacSha256.ComputeHash(Encoding.UTF8.GetBytes(payload));
var isVerified = xLendingApiSignature.Equals(Convert.ToBase64String(hashBytes));

Haven't received your HMAC key yet? Please contact us at apisupport@marketfinance.com.

Acknowledgement and Retries

Any requests made to the URL specified must return an acknowledgement by providing a 2XX response. If no acknowledgement is made, LendingApi will retry your URL up to 3 times with an exponential back off of 2 seconds for each retry (i.e. 2s, 4s, 8s) until retries are exhausted. If retries have been exhausted, LendingApi will contact you and provide further details and decide if/when webhooks should be replayed.

Reconciliation

As mentioned above, webhook delivery is not always guaranteed. It is therefore suggested that the Partner implements relevant mechanisms to synchronise any data they require from LendingApi to their own applications on a recurring basis, e.g. recurring data fetching.

API Environments

The API currently supports two environments: Test and Production. Please note that you must request access to these environments separately and receive API keys for both.

Test

The Test API can be accessed through the base URL https://api-staging.marketfinance.ninja/lending/

The Test environment has been created to allow for partners to test their integrations.

You may, on occasion, find API requests taking over 1 second anywhere up to 15 seconds. This is due to the technology being used in our test environment where cold starts can occur. This will not be the case in the Production environment.

Production

The Production API can be accessed through the base URL https://api.marketfinance.com/lending/.

Support

If you have any questions in relation to the API, suggestions or are facing any issues, please get in touch with us at apisupport@marketfinance.com.

API Endpoints

Accept existing offer by ID

Accept existing offer by ID

Try it

Request

Request URL

Request parameters

  • string

    Format - uuid. The unique identifier of the application.

  • string

    Format - uuid. The unique identifier of the offer.

Request headers

  • string
    Subscription key which provides access to this API. Found in your Profile.

Request body

Responses

200 OK

The requested offer

Representations

{
  "expiryAt": "string",
  "status": "Offered",
  "details": "string",
  "fundingType": "TermLoan",
  "offerType": "Representative",
  "annualPercentageRate": 0.0,
  "interestRate": 0.0,
  "id": "string",
  "amount": 0.0,
  "duration": "HalfYear",
  "statusChangedAt": "string",
  "repaymentFrequency": "Monthly",
  "totalAmountPayable": 0.0,
  "arrangementFee": {
    "amount": 0.0,
    "includeInPrincipal": true
  }
}
{
  "required": [
    "status",
    "details",
    "fundingType",
    "offerType",
    "annualPercentageRate",
    "id",
    "statusChangedAt"
  ],
  "type": "object",
  "properties": {
    "expiryAt": {
      "type": "string",
      "description": "Offer's expiry date after which the offer will no longer be valid.",
      "format": "date-time",
      "nullable": true
    },
    "status": {
      "enum": [
        "Offered",
        "Expired",
        "CustomerAccepted",
        "CustomerDeclined",
        "Advanced",
        "Archived"
      ],
      "type": "string",
      "description": "The status of the offer."
    },
    "details": {
      "type": "string",
      "description": "Details of the offer (additional information), e.g. \"Representative Rate\"."
    },
    "fundingType": {
      "enum": [
        "TermLoan"
      ],
      "type": "string",
      "description": "The product being offered."
    },
    "offerType": {
      "enum": [
        "Representative",
        "Accurate",
        "Underwritten"
      ],
      "type": "string",
      "description": "The type of the offer."
    },
    "annualPercentageRate": {
      "type": "number",
      "description": "[APR](https://en.wikipedia.org/wiki/Annual_percentage_rate) - the yearly interest generated by a sum that's charged to borrowers.",
      "format": "double"
    },
    "interestRate": {
      "type": "number",
      "description": "The nominal annual interest rate of the product being offered.",
      "format": "double",
      "nullable": true
    },
    "id": {
      "type": "string",
      "description": "The unique identifier of the offer.",
      "format": "uuid"
    },
    "amount": {
      "type": "number",
      "description": "The amount offered to borrower (e.g. the loan principal amount).",
      "format": "double",
      "nullable": true
    },
    "duration": {
      "enum": [
        "HalfYear",
        "Year",
        "TwoYears",
        "ThreeYears",
        "FourYears",
        "FiveYears",
        "SixYears"
      ],
      "type": "string",
      "description": "The tenor of the product being offered.",
      "nullable": true
    },
    "statusChangedAt": {
      "type": "string",
      "description": "The last offer's status change date.",
      "format": "date-time"
    },
    "repaymentFrequency": {
      "enum": [
        "Monthly"
      ],
      "type": "string",
      "description": "Installment frequency - how frequently the borrower have to make repayments.",
      "nullable": true
    },
    "totalAmountPayable": {
      "type": "number",
      "description": "The total amount payable by the Borrower (e.g. principal + accrued interest + arrangement fee for the loan).",
      "format": "double",
      "nullable": true
    },
    "arrangementFee": {
      "required": [
        "amount",
        "includeInPrincipal"
      ],
      "type": "object",
      "properties": {
        "amount": {
          "type": "number",
          "description": "The amount to be charged in GBP.",
          "format": "double"
        },
        "includeInPrincipal": {
          "type": "boolean",
          "description": "Defines whether the arrangement fee is added to the principal (true) or will be deducted from the advanced amount (false)."
        }
      },
      "description": "An administration charge made by lenders for arranging loan."
    }
  }
}

400 Bad Request

The request body could not be understood by the server or contains semantic errors. The response body provides details of the specific reason for the error.

Representations

{
  "title": "string",
  "message": "string",
  "errorCode": "string",
  "errors": [
    "string"
  ],
  "date": "string",
  "operationId": "string"
}
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "The high level message returned for an non-success response."
    },
    "message": {
      "type": "string",
      "description": "A description of the issue."
    },
    "errorCode": {
      "type": "string",
      "description": "The error code which helps MarketFinance to identify specific issue."
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The individual errors that caused the non-success response."
    },
    "date": {
      "type": "string",
      "description": "The date and time at which the errors occured.",
      "format": "date-time"
    },
    "operationId": {
      "type": "string",
      "description": "The unique identifier for the operation where the error was caused. This will be of use and should be provided when requesting further support."
    }
  }
}

401 Unauthorized

Invalid API Key.

Representations

{
  "title": "string",
  "message": "string",
  "errorCode": "string",
  "errors": [
    "string"
  ],
  "date": "string",
  "operationId": "string"
}
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "The high level message returned for an non-success response."
    },
    "message": {
      "type": "string",
      "description": "A description of the issue."
    },
    "errorCode": {
      "type": "string",
      "description": "The error code which helps MarketFinance to identify specific issue."
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The individual errors that caused the non-success response."
    },
    "date": {
      "type": "string",
      "description": "The date and time at which the errors occured.",
      "format": "date-time"
    },
    "operationId": {
      "type": "string",
      "description": "The unique identifier for the operation where the error was caused. This will be of use and should be provided when requesting further support."
    }
  }
}

404 Not Found

The resource with this identifier was not found.

Representations

{
  "title": "string",
  "message": "string",
  "errorCode": "string",
  "errors": [
    "string"
  ],
  "date": "string",
  "operationId": "string"
}
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "The high level message returned for an non-success response."
    },
    "message": {
      "type": "string",
      "description": "A description of the issue."
    },
    "errorCode": {
      "type": "string",
      "description": "The error code which helps MarketFinance to identify specific issue."
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The individual errors that caused the non-success response."
    },
    "date": {
      "type": "string",
      "description": "The date and time at which the errors occured.",
      "format": "date-time"
    },
    "operationId": {
      "type": "string",
      "description": "The unique identifier for the operation where the error was caused. This will be of use and should be provided when requesting further support."
    }
  }
}

500 Internal Server Error

Something went wrong, please get in touch with tech team.

Representations

{
  "title": "string",
  "message": "string",
  "errorCode": "string",
  "errors": [
    "string"
  ],
  "date": "string",
  "operationId": "string"
}
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "The high level message returned for an non-success response."
    },
    "message": {
      "type": "string",
      "description": "A description of the issue."
    },
    "errorCode": {
      "type": "string",
      "description": "The error code which helps MarketFinance to identify specific issue."
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The individual errors that caused the non-success response."
    },
    "date": {
      "type": "string",
      "description": "The date and time at which the errors occured.",
      "format": "date-time"
    },
    "operationId": {
      "type": "string",
      "description": "The unique identifier for the operation where the error was caused. This will be of use and should be provided when requesting further support."
    }
  }
}

Code samples

@ECHO OFF

curl -v -X POST "https://api.marketfinance.com/lending/applications/{applicationId}/offers/{offerId}/accept"
-H "X-MarketFinance-ApiKey: {subscription key}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("X-MarketFinance-ApiKey", "{subscription key}");

            var uri = "https://api.marketfinance.com/lending/applications/{applicationId}/offers/{offerId}/accept?" + queryString;

            HttpResponseMessage response;

            // Request body
            byte[] byteData = Encoding.UTF8.GetBytes("{body}");

            using (var content = new ByteArrayContent(byteData))
            {
               content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
               response = await client.PostAsync(uri, content);
            }

        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://api.marketfinance.com/lending/applications/{applicationId}/offers/{offerId}/accept");


            URI uri = builder.build();
            HttpPost request = new HttpPost(uri);
            request.setHeader("X-MarketFinance-ApiKey", "{subscription key}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
        };
      
        $.ajax({
            url: "https://api.marketfinance.com/lending/applications/{applicationId}/offers/{offerId}/accept?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("X-MarketFinance-ApiKey","{subscription key}");
            },
            type: "POST",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://api.marketfinance.com/lending/applications/{applicationId}/offers/{offerId}/accept";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"POST"];
    // Request headers
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"X-MarketFinance-ApiKey"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://api.marketfinance.com/lending/applications/{applicationId}/offers/{offerId}/accept');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'X-MarketFinance-ApiKey' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_POST);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'X-MarketFinance-ApiKey': '{subscription key}',
}

params = urllib.urlencode({
})

try:
    conn = httplib.HTTPSConnection('api.marketfinance.com')
    conn.request("POST", "/lending/applications/{applicationId}/offers/{offerId}/accept?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'X-MarketFinance-ApiKey': '{subscription key}',
}

params = urllib.parse.urlencode({
})

try:
    conn = http.client.HTTPSConnection('api.marketfinance.com')
    conn.request("POST", "/lending/applications/{applicationId}/offers/{offerId}/accept?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://api.marketfinance.com/lending/applications/{applicationId}/offers/{offerId}/accept')

request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['X-MarketFinance-ApiKey'] = '{subscription key}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body