NAV Navbar
cURL

Bongloy Agent Network API

The API is written according to the JSON API Specification. We highly recommend using a JSON API Client for consuming this API.

Authentication

This API uses JSON Web Token (JWT) Bearer authentication. You must generate a JSON Web Token and include it in the Authorization header for all requests.

Request Signing

All requests require you to sign your JWT according to the RS256 (RSA using SHA-256 hash) algorithm. In production you must generate your own RSA public/private key pair and provide us with your public key. While using the sandbox you can use the sample private key provided with the code samples.

The payload of your JWT must include:

{
  "api_token": "[your api token]",
  "timestamp": "1581510124"
}

Generating a RSA public/private key pair

$ openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:4096
$ openssl rsa -pubout -in private_key.pem -out public_key.pub

Code samples

Code samples for consuming this API can be found here https://gist.github.com/samnang/ad45122a7cdf50d5eebaba355f1126d4.

Transfers

Create a Transfer

Request

curl "https://agent-network-sandbox.bongloy.com/v1/transfers" -d '{
  "data": {
    "type": "transfer",
    "attributes": {
      "amount": 10000,
      "currency": "USD",
      "destination_account_number": "bongloy_testing-P01-1234560",
      "metadata": {
        "foobar": "foobar"
      }
    }
  }
}' -X POST \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJhcGlfdG9rZW4iOiJLRU5GVlZQc2FoOG5EX2xMenZLT2kyVnBpNzR2cndNaUoxeXRRUEpjMTA4IiwidGltZXN0YW1wIjoxNTgxNTg2NTA2fQ.Hv5kV6LpfHxG7agS3t73CXs31Binzlhq4JBXZCCgg9MjjGoz6tu9_Ammm6TMSLp56NW9L2zElu4flWQ3DTATTcD1KT_Zx68aSslnZDJ9TWVI7ninbntDPApEYUUDGuQanxnwsCp3n9BYqsRN7HM3TZN0oQakTVJwSGbYX3MSzup_VrbIc_DfllvPm-bpAxsPAUfn_HASJxmK-ivmdVOi6EuTK8Q-jvd4YwEM82UABiLF_c2Pz3WrXWAYItunzji_sVoP4T-2eEeiZZhRRm7i-_ziIBDmXxm4-a2IiteLRFrZpJvZhi3D3pLQLLpu0WkJMurVkSSZdKNv6wCatMcsP3fTeR0d5K25KBESG94-kUtGu4-rCAwFMwIZNcJ4JcfMYf4h4eKnyM6FRZ9reYJ7OvRanEkj7JlX4juP2x2I1EQeVSV5KGHlYEPq-QxyUheSyHE4jAZu_RQxWc6ovV_ywOPsK9DOZraV2BPLmnW_JaM2jENQlCYJa_EXHS5MseuqTCWJIW25nc2kNPR5VKnrMRlqKdH8aqVGp8v_L3e3HOgjV2ErBBjXzqR8_qkP2r-v2b8xuDT7zsS8HetgtWI7NuiwgGmZrpSey4CLPorlT24jnPXU157dfEAZcDeYv1ThZOk2xVuThUfznC4lKR_pKy-3StoM5tJbZo8irqZRBzg"

Endpoint

POST /v1/transfers

POST /v1/transfers

Parameters

{
  "data": {
    "type": "transfer",
    "attributes": {
      "amount": 10000,
      "currency": "USD",
      "destination_account_number": "bongloy_testing-P01-1234560",
      "metadata": {
        "foobar": "foobar"
      }
    }
  }
}
Name Description
data[attributes][amount] required A positive integer representing how much to transfer (e.g., 10000 cents to transfer $100.00)
data[attributes][currency] required The currency of the account. Only USD is supported at this time
data[attributes][destination_account_number] required The destination Bongloy account number
data[attributes][metadata] Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

Response


201 Created
{
  "data": {
    "id": "8960afca-d967-4990-ac80-52194e780ab4",
    "type": "transfer",
    "attributes": {
      "created_at": "2020-02-13T09:35:06Z",
      "updated_at": "2020-02-13T09:35:06Z",
      "destination_account_number": "bongloy_testing-P01-1234560",
      "destination_account_holder_name": "Tang Dara",
      "currency": "USD",
      "status": "pending_confirmation",
      "amount": 10000
    }
  }
}

Create a Transfer (invalid destination)

Request

curl "https://agent-network-sandbox.bongloy.com/v1/transfers" -d '{
  "data": {
    "type": "transfer",
    "attributes": {
      "amount": 10000,
      "currency": "USD",
      "destination_account_number": "invalid-account"
    }
  }
}' -X POST \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJhcGlfdG9rZW4iOiJCaC1BOUl4eVR5dU1QUDBCY1JkQ2hVOEtBREJTM2VGX2FPbUZzZm9sYjBjIiwidGltZXN0YW1wIjoxNTgxNTg2NTA2fQ.koeQHmjck4g7rSnwbEiS_700DxPFXbRwX9sBzhL9hU2zu8xgyR9eGslQw8oxmHe7GREnqXMfSBEKphLxV2NxAMkF7O4vKhGSmCltS2oWCf3MymkWaeMbjc4iQhbmR-z5BZ8FdYfYYqmOCByfJC1kpR-d6kzramaqCKIciN8UcyBcLw3_bo28L57t3c9AAlnTiQdTMj0XJ7Nl-1MSKllufwiu2riRLKCt4inM7WYaq4Ee7sYv_HnWgeKjrr6gUYZPNZtHxMh-0cHZiR-5umNWQ_CFaF62JaEQQ5_zIsMzIAPOpdFBdf9k-hwN43ijU_6gYIUZIxO-IHaj8Yxdtxw-Z3_0Og29yAhSmSqtbN9-GYnjwRggA6theu95b1CUjDiFu3qABMZUMTrVVE0IRQNG2CMIr5Xh1JllawTG0M4ACuGxGzmhHI8ODFwHuGMNYGYih4eOnGnM00UfH2aPweaFdG6dPXycanMFZ4GRkoL-J0_CRx4_Ah-ckNGbTJJzWVMxiFUmsiGP29xJm6jIgQQSHfyEpem4n0_d6HHHTaLUTMSxiE3mZeBQaki3jv2aySORCJkuT-tLKqpWUls6DqPFv0C_b7sBnng3efNah90gMoiRxs7IqTWgQ3xiVNcYmaU-eB9kDiILVMSCtk0La25SBYGlWBdrREBn5PjDHFclEM8"

Endpoint

POST /v1/transfers

POST /v1/transfers

Parameters

{
  "data": {
    "type": "transfer",
    "attributes": {
      "amount": 10000,
      "currency": "USD",
      "destination_account_number": "invalid-account"
    }
  }
}
Name Description
data[attributes][amount] required A positive integer representing how much to transfer (e.g., 10000 cents to transfer $100.00)
data[attributes][currency] required The currency of the account. Only USD is supported at this time
data[attributes][destination_account_number] required The destination Bongloy account number
data[attributes][metadata] Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

Response


402 Payment Required
{
  "data": {
    "id": "6188d68e-31d6-40fb-9ef3-d4d09d92ab1c",
    "type": "transfer",
    "attributes": {
      "created_at": "2020-02-13T09:35:06Z",
      "updated_at": "2020-02-13T09:35:06Z",
      "destination_account_number": "invalid-account",
      "destination_account_holder_name": null,
      "currency": "USD",
      "status": "failed",
      "amount": 10000
    }
  }
}

Confirm a Transfer

Request

curl "https://agent-network-sandbox.bongloy.com/v1/transfers/05dc8489-579c-4655-84d7-54dbd1b91767/confirm" -d '{
  "data": {
    "type": "transfer",
    "id": "05dc8489-579c-4655-84d7-54dbd1b91767"
  }
}' -X PATCH \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJhcGlfdG9rZW4iOiJDS3J2cWdFcXUzTVJCWEllNk1FUjcxcWZnNVlGVjc5ZHM3SVlwYkZpRGJjIiwidGltZXN0YW1wIjoxNTgxNTg2NTA2fQ.V_y7okEUWkL8mteClRJThF8T3K0FfNRuRcfmS_g0V_TddE1SAr5q6uc_QZiEnGthqLue1Pevv39_LBAvPy9dTs53EmpN5_JpJs8yzWq8-sfdcRQXYx_j9t-5St9q0NzKhoiyRLy6QRJXXx1k-Lh5oXxV0QaJX30UZqrrfTT9NMYfWHjUXZPxFf4tAvl5EF7gaTbiIvPHfCKx8qwsuGBC8dq82XOkY7WRXGSNOr6Jn2IAHOn7aAfX7KR02H-_uM-jHXIijk5zec6d0I-fmV2ARXt0JVdusAW3JC2jb13bED0ByYodAGvIQ6VEBXr_JY7JTXKFEA6lqnzMOTR4FTa0uS1xQNsFeV_1Efls9Cc8Yi0nINhUK8xfUYlsuQ6w_9hqztvsN8weCTmqkYUbtUEg9_snixy1cRTqEqFfMl9b4b2LNK6fbG7SO8UhhRKjyb57rMLA0lGUS5uRc8huXqW2qVBfd0mKvbL8IZ_mT0GMtE3Hnxoe9BplNYSiO02EGhWNygCK6K-yldxPtdr5Y3Ji0RhsboRSSFlKiH_-Eb-FEm1zDpAKjFEUP7kXrrZghcEXV_zVPhKfKVz01FK7e1V0sFPYMdFGkti11AssIZRjtJSUjTBKbg_2pydkcOBwAA9CTZXo8XLFgc4Nbetfeezlo7HjWJbsTGn8sXsJIVFfuls"

Endpoint

PATCH /v1/transfers/:id/confirm

PATCH /v1/transfers/05dc8489-579c-4655-84d7-54dbd1b91767/confirm

Parameters

{
  "data": {
    "type": "transfer",
    "id": "05dc8489-579c-4655-84d7-54dbd1b91767"
  }
}

None known.

Response


200 OK
{
  "data": {
    "id": "05dc8489-579c-4655-84d7-54dbd1b91767",
    "type": "transfer",
    "attributes": {
      "created_at": "2020-02-13T09:35:06Z",
      "updated_at": "2020-02-13T09:35:06Z",
      "destination_account_number": "P12345678",
      "destination_account_holder_name": "John Doe",
      "currency": "USD",
      "status": "successful",
      "amount": 10000
    }
  }
}

Retrieve a Transfer

Request

curl -g "https://agent-network-sandbox.bongloy.com/v1/transfers/03b67611-e305-42c0-89c8-b2383cc38823" -X GET \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJhcGlfdG9rZW4iOiJQZnY1V2ZaRVJxNDNMNTJnSHJOVzZ3bGE3bXJNZFBHcmVvYjFrR1FCa3hNIiwidGltZXN0YW1wIjoxNTgxNTg2NTA2fQ.A6QhYEZnjNk2D_9J6i7LYF2UoMlS2X93rrq96YJOTfoSklvLqTLOAqAoWfzvzpGVDbBaXzyi-poWzu__aPFy7_Ge_3NJF1mdNGednT1uAuzleWetATczKmfHOlVFSQUqNlpcfZv8dhgZ33AyBHBysFU6SNXdXsOHp37oWy8Og3PjJKtHD5BowyQG6wSTv0d7mlmMz-iUZmanMEx_zYO8M7l9-j9DSbV6dQAkBXaHRbt5wakzoqmSl-FzPFNC8qqJvcPpAghtD-wKoMLN97XCDb2_mRry4qVoVqCd72RblQLMoy5MewOlofA69aAVJXuPNFluK5V8VhZoVKbspx6WXClFijryMN3kUWbOGA2D67li7EnMbVxIRJU0HSxw1I59zF9GE5YXHPE5va1LUeSlsvvOpkx_PV7AXPoXp52Xiuwokflq64eztVlcn9g5ZFUEsmKCrW8TkSS-vwdJcSlVxSredf1tYmZRw8Qbvi5k4TmpZ8RI5pINTy4-lD7Ghguc_oedT5afrekS3Q8JbtdggYVUh9sbrRgDm4PKy3a5LlGNuMSTS-GizSVmdVc8btMdVwacjnNztgU43sDmtWh_uwxuLC3ThL7hbEd60mIQnz665YI_MKYvgkUn5ElPiP_MEEWdwMS3MGhrrPMMmTVqJeDemdMps6qk0D7Wy2_-O_I"

Endpoint

GET /v1/transfers/:id

GET /v1/transfers/03b67611-e305-42c0-89c8-b2383cc38823

Parameters

None known.

Response


200 OK
{
  "data": {
    "id": "03b67611-e305-42c0-89c8-b2383cc38823",
    "type": "transfer",
    "attributes": {
      "created_at": "2020-02-13T09:35:06Z",
      "updated_at": "2020-02-13T09:35:06Z",
      "destination_account_number": "P12345678",
      "destination_account_holder_name": "John Doe",
      "currency": "USD",
      "status": "successful",
      "amount": 10000
    }
  }
}

List all transfers

Request

curl -g "https://agent-network-sandbox.bongloy.com/v1/transfers?filter[status]=successful&filter[from_date]=2020-01-01T00%3A00%3A00Z&filter[to_date]=2020-01-01T11%3A00%3A00Z" -X GET \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJhcGlfdG9rZW4iOiJYWHVsZklJTkc1SG1EdUpSR196WTlVMkhLRVhYSXI3RkFZQjhwNXFwMFZNIiwidGltZXN0YW1wIjoxNTgxNTg2NTA2fQ.PvUDyi4FJiJQ4UGtL_Ffd20uPrwHH0GXUm3SrJLfx35edWM8uLRlmY1F-H5XQGZTpPuwZGwMB5VzcjmBBl6CwvkydCEoJqIqMNs9FhDLtGBzaYaJgDqh1nKDHCcVV0QxlvvlQuO9zgjRnw4B-QCQN66nJw4Ree_6ZIHHll5bXn_wKOofxhL6-sGLSt73rgfPGYQiXDdSZvGgnpHWjVLSIhf8kbSUzOOtHh_Fxg6Y5BGgtbBzUq_T6ngxdbpYmDxyjBhOLu6Pn9EfqH5-mDuM33UTCRPJDWzGi3y2gQ3yBqMURtd53oUc129UMId9KT8GARNkTyN9BNruDvOjv9jalxQaCEssak7s7wDM3GS-2kvoe7j4WGm8rgTpMrhkSo6CI3scBkS-QNSMWNCDtHW_esTylVGoK90wqumtt3ujVZHnqteLXeQS3093U9mAaFjRW2O3aOFdycp0L7izZGRSZufWEuW2c0kcU4dQmrcjbXxmO96SCsRlnke5nHH5oum-XcvKLFqOCBFcXrUOU-Qfd_St3CEkFDj4JhM2MaJPsMysLM-ON7npUE7A2wqiFSMQZXjWiIXugVoX29Pxf1FPW2fZVQ2954xP9wUD6oMlc7i_5Fj3P0vLXJ86APjPuNk0-5ay14ghMC9j3xWd1YSPBQYgWXwVfjZbFLFYcs0yKZM"

Endpoint

GET /v1/transfers

GET /v1/transfers?filter[status]=successful&filter[from_date]=2020-01-01T00%3A00%3A00Z&filter[to_date]=2020-01-01T11%3A00%3A00Z

Parameters

filter: {"status"=>"successful", "from_date"=>"2020-01-01T00:00:00Z", "to_date"=>"2020-01-01T11:00:00Z"}
Name Description
filter[status] Return transfers that match the provided status.
filter[from_date] Return transfers on or after the provided date/time in ISO 8601 format.
filter[to_date] Return transfers on or before the provided date/time in ISO 8601 format.

Response


200 OK
{
  "data": [
    {
      "id": "195ffae2-6118-459c-9451-a85ea2d851cb",
      "type": "transfer",
      "attributes": {
        "created_at": "2020-01-01T01:00:00Z",
        "updated_at": "2020-02-13T09:35:06Z",
        "destination_account_number": "P12345678",
        "destination_account_holder_name": "John Doe",
        "currency": "USD",
        "status": "successful",
        "amount": 10000
      }
    }
  ],
  "links": {
    "prev": "http://example.org/v1/transfers?filter%5Bfrom_date%5D=2020-01-01T00%3A00%3A00Z&filter%5Bstatus%5D=successful&filter%5Bto_date%5D=2020-01-01T11%3A00%3A00Z&page%5Bbefore%5D=195ffae2-6118-459c-9451-a85ea2d851cb",
    "next": null
  }
}