API Reference
Complete reference for all XferAPI endpoints. Atomic transfers, rollbacks, and inspection operations with detailed request/response examples.
Base URL
https://api.xferapi.com
Authentication
All API requests require authentication using Bearer token.
Authorization: Bearer your_access_token
/api/v1/transfer
Create Transfer
Execute an atomic multi-account transfer operation with SAGA pattern support.
Request Body
{
"TransferId": "txn_001",
"UseHalfSuccess": true,
"FromAccounts": [{
"AccountId": "user_123",
"ItemType": "credits",
"Amount": 100,
"ChangeType": "debit",
"Comment": "Transfer to user_456"
}],
"ToAccounts": [{
"AccountId": "user_456",
"ItemType": "credits",
"Amount": 100,
"ChangeType": "credit",
"Comment": "Transfer from user_123"
}],
"TransferScene": "user_to_user",
"Comment": "User credit transfer"
}
Response
{
"error": null,
"transfer_id": "txn_001",
"status": "completed"
}
{
"error": "InsufficientAmountErr",
"message": "Account user_123 has insufficient balance",
"error_code": "E001"
}
/api/v1/rollback
Rollback Transfer
Rollback a previously executed transfer within the allowed time window.
Request Body
{
"TransferId": "txn_001",
"TransferScene": "user_to_user"
}
Response
{
"error": null,
"transfer_id": "txn_001",
"status": "rolled_back"
}
{
"error": "AlreadyRolledBackErr",
"message": "Transfer txn_001 has already been rolled back",
"error_code": "E002"
}
/api/v1/inspection
Inspection & Recovery
Check and recover transfers in half-success states before a specified time.
Request Body
{
"lastTime": "2024-01-15T10:30:00Z"
}
Response
{
"errors": [],
"processed_count": 15,
"recovered_count": 3
}
{
"errors": [
{
"transfer_id": "txn_002",
"error": "StateMutationErr",
"message": "State mutation error during recovery"
}
],
"processed_count": 15,
"recovered_count": 2
}
Common Error Codes
InsufficientAmountErr
Account balance insufficient for the requested transfer amount.
AlreadyRolledBackErr
The transfer has already been rolled back and cannot be modified.
StateMutationErr
State mutation error due to concurrent operations or system constraints.
Rate Limits
• Transfer operations: 1000 requests per minute
• Rollback operations: 500 requests per minute
• Inspection operations: 100 requests per minute
Need Help?
Can't find what you're looking for or need clarification on API usage?