Platform integration
15. Platform Integration Overview
The platform integration API (/v1/integrations/) is designed for third-party platforms that want to embed DiversiFi deposits and withdrawals for their own end users without requiring each user to authenticate directly with DiversiFi.
Key difference from Sections 8–13: The standard /v1/positions/ endpoints act on behalf of the authenticated wallet. The /v1/integrations/ endpoints let your platform specify any user_wallet address, so a single API key can serve many users.
How it works
Your platform holds one API key with the
integrationspermission.When a user wants to deposit or withdraw, your backend calls the relevant
/v1/integrations/endpoint, passing the user's wallet address asuser_wallet. The response includes an unsigned transaction and aconfirmToken.Your frontend presents the transaction to the user for signing (e.g., via their wallet adapter — Phantom, Backpack, etc.).
The user signs and submits the transaction to the Solana network.
Your backend calls
POST /v1/integrations/confirmwith the transaction signature and theconfirmToken— this links the on-chain transaction to your API key and returns thetransactionGroupId.Your platform polls the transaction status using the
transactionGroupIdreturned by the confirm call.
Authentication
API key with integrations permission, sent as a Bearer token:
Authorization: Bearer dfi_your_api_key_hereRate limit: 60 requests per minute (independent of the standard 120 req/min limit).
Contact the DiversiFi team to request an API key with
integrationspermission.
16. Platform Deposit Flow
Get the unsigned deposit transaction
basket_address
string
Yes
The basket address / Index PDA (base58)
amount
number
Yes
USDC amount to deposit (human-readable, e.g. 100.5)
user_wallet
string
Yes
The end user's Solana wallet address (base58)
Response:
Store the confirmToken — you will need it in the next step.
Error responses:
message
Cause
"Invalid basket_address"
Malformed address
"Invalid user_wallet"
Malformed address
"Basket not found"
Unknown or inactive basket
"Basket operations are currently paused"
Basket temporarily disabled
"Minimum deposit for this basket is X USDC"
Amount below the per-basket minimum
Sign and submit
Decode the base64 transaction, present it to the user for signing via their wallet, then submit it to the Solana network:
Confirm
After the transaction is on-chain, call:
Response:
The transactionGroupId is a 16-character hex ID you use to poll status (Section 18). It is also deterministic — computed as sha256(signature).slice(0, 16) — so you can derive it locally, but the confirm response is the canonical source.
Why is the confirm step required? It links the on-chain transaction to your API key so that only your key can retrieve it via
/transaction/:id. Without it, the transaction processes normally but will not be visible through the integrations API.
17. Platform Withdrawal Flow
Get the unsigned withdrawal transaction
basket_address
string
Yes
The basket address / Index PDA (base58)
amount
number
Yes
LP token amount to withdraw (human-readable)
user_wallet
string
Yes
The end user's Solana wallet address (base58)
Response: Same shape as the deposit response — unsignedTxs array and a confirmToken.
The user signs and submits the transaction. Then call POST /v1/integrations/confirm with the signature and confirmToken, exactly as in Section 15. The confirm response returns the transactionGroupId for polling.
18. Platform Refund Flow
If a deposit or withdrawal is stuck — for example, if a swap failed and tokens are locked in the user's on-chain escrow account — the platform can initiate a refund on behalf of the user.
Check refund eligibility
basket_address
string
Yes
user_wallet
string
Yes
Response:
refundType is "deposit", "withdraw", or null. Use this value directly as the refund_type parameter in the next call.
Get the unsigned refund transaction
basket_address
string
Yes
user_wallet
string
Yes
refund_type
string
Yes
"deposit" or "withdraw"
Response:
Note: unlike the deposit/withdrawal endpoints, unsignedTx here is a single string, not an array.
The user signs and submits the refund transaction. No confirm step is required for refunds — the transactionGroupId can be derived locally as sha256(signature).slice(0, 16).
19. Tracking Transaction Status
Use the transactionGroupId returned by POST /confirm (Sections 15–16) or derived locally from a refund signature (Section 17) to poll status. You can only look up transactions that were confirmed with your own API key.
States:
state
Meaning
initialized
On-chain escrow confirmed. Queued for execution.
executing
Jupiter swaps are in progress.
completed
All swaps finished. dTokens minted (deposit) or USDC returned (withdrawal).
partially_completed
Some swaps succeeded, some failed. A partial refund may be available.
refunded
The transaction was cancelled and tokens returned to the user.
failed
Terminal failure.
Response (200):
Note: All token amounts are in atomic units (smallest denomination). Divide by 10^decimals to get human-readable values. USDC uses 6 decimals; dToken decimals can be read from the mint account (byte offset 44, as shown in Section 4).
Error responses:
404
Transaction not found, or it was initiated by a different API key
401
Missing or invalid API key
20. Example TypeScript Implementation
See platform_integration_example.ts for a complete working example covering all four operations: deposit, withdrawal, refund, and status polling.
.env required:
view .env file on github : https://github.com/SolutioFi-io/diversifi-integration-guide/blob/main/.env.example
Last updated
