Skip to main content
POST
/
v1
/
accounts
Create account
curl --request POST \
  --url https://carbonapistagingsecure.getcarbon.co/baas/api/v1/accounts \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --header 'x-carbon-key: <x-carbon-key>' \
  --data '
{
  "account_type": "static",
  "third_party": true,
  "customer_id": "1732ca47-42b2-4990-a65d-c369e934eed3"
}
'
const options = {
  method: 'POST',
  headers: {
    'x-carbon-key': '<x-carbon-key>',
    apikey: '<api-key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    account_type: 'static',
    third_party: true,
    customer_id: '1732ca47-42b2-4990-a65d-c369e934eed3'
  })
};

fetch('https://carbonapistagingsecure.getcarbon.co/baas/api/v1/accounts', 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://carbonapistagingsecure.getcarbon.co/baas/api/v1/accounts",
  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([
    'account_type' => 'static',
    'third_party' => true,
    'customer_id' => '1732ca47-42b2-4990-a65d-c369e934eed3'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "apikey: <api-key>",
    "x-carbon-key: <x-carbon-key>"
  ],
]);

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

curl_close($curl);

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

url = "https://carbonapistagingsecure.getcarbon.co/baas/api/v1/accounts"

payload = {
    "account_type": "static",
    "third_party": True,
    "customer_id": "1732ca47-42b2-4990-a65d-c369e934eed3"
}
headers = {
    "x-carbon-key": "<x-carbon-key>",
    "apikey": "<api-key>",
    "Content-Type": "application/json"
}

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

print(response.text)
require 'uri'
require 'net/http'

url = URI("https://carbonapistagingsecure.getcarbon.co/baas/api/v1/accounts")

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

request = Net::HTTP::Post.new(url)
request["x-carbon-key"] = '<x-carbon-key>'
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"account_type\": \"static\",\n  \"third_party\": true,\n  \"customer_id\": \"1732ca47-42b2-4990-a65d-c369e934eed3\"\n}"

response = http.request(request)
puts response.read_body
package main

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

func main() {

	url := "https://carbonapistagingsecure.getcarbon.co/baas/api/v1/accounts"

	payload := strings.NewReader("{\n  \"account_type\": \"static\",\n  \"third_party\": true,\n  \"customer_id\": \"1732ca47-42b2-4990-a65d-c369e934eed3\"\n}")

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

	req.Header.Add("x-carbon-key", "<x-carbon-key>")
	req.Header.Add("apikey", "<api-key>")
	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))

}
{
  "status": "success",
  "message": "account created successfully",
  "data": {
    "id": "5da78692-ffbc-4f1e-b60b-4febd75c4d66",
    "account": {
      "bank_name": "CARBON LIMITED",
      "bank_code": "565",
      "account_name": "MARK ERELU-CARBON",
      "account_number": "6142285181",
      "client_id": "452716534"
    },
    "owner": {
      "first_name": "mark",
      "last_name": "erelu",
      "email": "erelu@yahoo.com",
      "phone": "08088000030"
    },
    "account_type": "static",
    "mode": "sandbox",
    "created_at": "2024-03-07T15:03:03.000Z",
    "updated_at": "2024-03-07T15:03:03.000Z"
  }
}

Overview

This endpoint creates a new virtual account based on the specified account type.
  • For third-party accounts (business use), set third_party to true and provide a customer_id.
  • For sub-accounts (collections), set third_party to false and provide an account_name.
  • If third_party is not specified, it defaults to true.

Endpoint

POST /accounts

Request Body

Standard Account Creation (Business Use)

{
  "account_type": "static",
  "third_party": true,
  "customer_id": "1732ca47-42b2-4990-a65d-c369e934eed3"
}

Sub-Account Creation (Collections)

{
  "account_type": "static",
  "third_party": false,
  "account_name": "Collections"
}

Response

{
    "status": "success",
    "message": "account created successfully",
    "data": {
        "id": "5da78692-ffbc-4f1e-b60b-4febd75c4d66",
        "account": {
            "bank_name": "DEMO BANK",
            "bank_code": "565",
            "account_name": "OJO BENSON - DEMO BANK",
            "account_number": "0000000000",
            "client_id": "0000000"
        },
        "owner": {
            "first_name": "ojo",
            "last_name": "erelu",
            "email": "erelu@yahoo.com",
            "phone": "08088000030"
        },
        "account_type": "static",
        "mode": "sandbox",
        "created_at": "2024-03-07T15:03:03.000Z",
        "updated_at": "2024-03-07T15:03:03.000Z"
    }
}

Authorizations

apikey
string
header
required

Provide your API key in the 'apikey' header.

Headers

x-carbon-key
string
required

Body

application/json

Create a new virtual account based on account type

account_type
enum<string>
required

The type of account to create (static or dynamic)

Available options:
static,
dynamic
third_party
boolean
default:true

For third-party accounts (business use), set to true. For sub-accounts (collections), set to false.

customer_id
string

Required if third_party is true. The ID of the customer.

account_name
string

Required if third_party is false. The name of the collection account.

Response

200 - application/json

OK

The response is of type object.