Lending API

API change history

Market Finance Lending API https://marketfinance.com/

Introduction

This API is documented in OpenAPI format If you are curious to see how it work just check our contact page for details.

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.

Authentication

This API offers two forms of authentication: - API Key - OAuth2 OAuth2 - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.

Accept existing offer by ID

Accept existing offer by ID

Try it

Request

Request URL

Request parameters

  • string

    Format - uuid.

  • string

    Format - uuid.

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":"2022-06-03T12:15:44.0503342+00:00","status":"Offered","details":"Representative Rate","fundingType":"TermLoan","offerType":"Indicative","annualPercentageRate":0.0905,"interestRate":0.03,"redirectUrl":"https://www.marketfinance.com/loans/3e7b118e-bb4c-4e4b-981d-a62526cbbdce","id":"3e7b118e-bb4c-4e4b-981d-a62526cbbdce","amount":null,"duration":null,"statusChangedAt":"2022-05-27T12:15:44.0503868+00:00"}
{
  "required": [
    "status",
    "details",
    "fundingType",
    "offerType",
    "annualPercentageRate",
    "id",
    "statusChangedAt"
  ],
  "type": "object",
  "properties": {
    "expiryAt": {
      "type": "string",
      "description": "Offer's expiry date after which the offer will be no longer valid",
      "format": "date-time",
      "nullable": true
    },
    "status": {
      "enum": [
        "Offered",
        "Expired",
        "CustomerAccepted",
        "CustomerDeclined",
        "Advanced",
        "Archived"
      ],
      "type": "string",
      "description": "Offer's status"
    },
    "details": {
      "type": "string",
      "description": "Offer's details"
    },
    "fundingType": {
      "enum": [
        "TermLoan"
      ],
      "type": "string",
      "description": "Offer's funding type"
    },
    "offerType": {
      "enum": [
        "Indicative",
        "Underwritten"
      ],
      "type": "string",
      "description": "Offer's type"
    },
    "annualPercentageRate": {
      "type": "number",
      "description": "Offer's APR (Annual percentage rate)",
      "format": "double"
    },
    "interestRate": {
      "type": "number",
      "description": "Offer's Interest Rate",
      "format": "double",
      "nullable": true
    },
    "redirectUrl": {
      "type": "string",
      "description": "Offer's Redirect Url to access Onboarding Journey",
      "nullable": true
    },
    "id": {
      "type": "string",
      "description": "Offer's unique identifier",
      "format": "uuid"
    },
    "amount": {
      "type": "number",
      "description": "Offer amount",
      "format": "double",
      "nullable": true
    },
    "duration": {
      "enum": [
        "HalfYear",
        "Year",
        "TwoYears",
        "ThreeYears",
        "FourYears",
        "FiveYears",
        "SixYears"
      ],
      "type": "string",
      "description": "Offer Duration",
      "nullable": true
    },
    "statusChangedAt": {
      "type": "string",
      "description": "Timestamp of the last status change",
      "format": "date-time"
    }
  }
}

401 Unauthorized

Invalid API Key.

Representations

{
  "title": "string",
  "message": "string",
  "errorCode": "string",
  "errors": [
    "string"
  ],
  "date": "string",
  "operationId": "string"
}
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "errorCode": {
      "type": "string"
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "date": {
      "type": "string",
      "format": "date-time"
    },
    "operationId": {
      "type": "string"
    }
  }
}

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"
    },
    "message": {
      "type": "string"
    },
    "errorCode": {
      "type": "string"
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "date": {
      "type": "string",
      "format": "date-time"
    },
    "operationId": {
      "type": "string"
    }
  }
}

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"
    },
    "message": {
      "type": "string"
    },
    "errorCode": {
      "type": "string"
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "date": {
      "type": "string",
      "format": "date-time"
    },
    "operationId": {
      "type": "string"
    }
  }
}

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