Create Allocation

Creates a new allocation investment. Allocations represent funds deposited into a DeFi protocol to earn interest. Different protocols may have different requirements that affect the request structure.

HTTP request
POST/allocations
Authorization requirements
Header Type Required Description
Authorization string Yes Bearer token used to authenticate the request. See Authentication flows for instructions on generating this token.
Request body
Field Type Required Description
walletId string Yes ID of the wallet making the allocation. Length must be 1 to 64 characters.
protocol string Yes Protocol used for the allocation. Currently supports the OFNS protocol.
sourceAsset object Yes Asset being deposited into the allocation. Must follow the EVM Fungible Token (ERC‑20) structure.
targetAsset object Yes Asset received or staked within the protocol. Must follow the EVM Fungible Token (ERC‑20) structure.
slippageBps number Yes Slippage tolerance in basis points. Defines the maximum acceptable price movement relative to the quote. One basis point equals 0.01 percent.
externalId string No Optional identifier provided by the client to support idempotency and prevent duplicate operations.
curl --request POST \
  --url https://api.digitalassets.ibm.com/allocations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-DFNS-USERACTION: <api-key>' \
  --data '
{
  "externalId": "ext-123",
  "sourceAsset": {
    "kind": "Erc20",
    "contract": "0x6b175474e89094c44da98b954eedeac495271d0f",
    "amount": "1000000000000000000"
  },
  "targetAsset": {
    "kind": "Erc20",
    "contract": "0x5d3a536e4d6dbd6114cc1ead35777bab948e3643",
    "amount": "32000000000000000000"
  },
  "slippageBps": 50,
  "walletId": "wa-4g991-s29to-9hrq4nbuto6ih33b",
  "protocol": "0fns"
}
'
Response
200: Success

Example response:

{
  "id": "allctn-6a3ku-bn8d7-8u5rs1oukojms7k8",
  "walletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
  "protocol": "0fns",
  "amount": {
    "kind": "Erc20",
    "contract": "0x0A7660979A67E4bC51E750C628C8479ff9F458aE",
    "amount": "1000000000",
    "metadata": {
      "network": "EthereumSepolia",
      "name": "0fns",
      "symbol": "0fnsSepolia",
      "decimals": 6,
      "tid": "erc20:0x0A7660979A67E4bC51E750C628C8479ff9F458aE"
    }
  },
  "rewards": {
    "kind": "Erc20",
    "contract": "0x0A7660979A67E4bC51E750C628C8479ff9F458aE",
    "amount": "5000000",
    "metadata": {
      "network": "EthereumSepolia",
      "name": "0fns",
      "symbol": "0fnsSepolia",
      "decimals": 6,
      "tid": "erc20:0x0A7660979A67E4bC51E750C628C9479ff9F458aE"
    }
  },
  "dateCreated": "2025-10-09T10:57:55.758Z"
}