Skip to main content
POST
/
v1
/
pledges
Create pledge
curl --request POST \
  --url https://api.sandbox.busha.so/v1/pledges \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "quote_id": "PLQ_01HX...",
  "meta": {}
}
'
import requests

url = "https://api.sandbox.busha.so/v1/pledges"

payload = {
"quote_id": "PLQ_01HX...",
"meta": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({quote_id: 'PLQ_01HX...', meta: {}})
};

fetch('https://api.sandbox.busha.so/v1/pledges', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.busha.so/v1/pledges",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'quote_id' => 'PLQ_01HX...',
'meta' => [

]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.sandbox.busha.so/v1/pledges"

payload := strings.NewReader("{\n \"quote_id\": \"PLQ_01HX...\",\n \"meta\": {}\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sandbox.busha.so/v1/pledges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"quote_id\": \"PLQ_01HX...\",\n \"meta\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.busha.so/v1/pledges")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quote_id\": \"PLQ_01HX...\",\n \"meta\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "message": "message for success",
  "data": {
    "id": "PLG_01HX...",
    "reference": "credit_agreement_93b7",
    "mandate_hash": "sha256:...",
    "items": [
      {
        "id": "PLI_01HX...",
        "asset": "BTC",
        "locked_amount": "100",
        "released_amount": "100",
        "liquidated_amount": "100",
        "available_to_release": "100"
      }
    ],
    "customer_profile_id": "PRF_customer...",
    "beneficiary_profile_id": "BUS_beneficiary...",
    "activated_at": "2023-10-15T12:15:30Z",
    "expires_at": "2023-10-15T12:15:30Z",
    "released_at": "2023-10-15T12:15:30Z",
    "liquidated_at": "2023-10-15T12:15:30Z",
    "events": [
      {
        "id": "PLE_01HX...",
        "type": "pledge.activated",
        "actor_type": "beneficiary",
        "created_at": "2023-10-15T12:15:30Z",
        "reference": "activation_disb_9f1"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer Authentication

Headers

X-BU-PROFILE-ID
string

User profile header

Example:

"BUS_YOK8tp5Zga01qOKEsqp07"

Body

application/json

Pledge creation request

quote_id
string
required

ID of the previously created pledge quote.

Minimum string length: 1
Example:

"PLQ_01HX..."

meta
object

Optional non-query-critical pledge context.

Response

Successful pledge response

General response Values

status
enum<string>
required
Available options:
success,
error
Example:

"success"

message
string
required
Example:

"message for success"

data
object
required