Quick Start Guide
Get your first atomic transfer running in under 5 minutes. This guide covers authentication, basic transfers, and error handling.
Prerequisites
- XferAPI account (contact us for early access)
- API key and secret
- Node.js 16+ or Python 3.8+ (for examples)
Get Early Access
XferAPI is currently in private beta. Contact our team to get your API credentials and start building.
Authentication
Once you have your credentials, authenticate your requests using API key authentication.
curl -X POST https://api.xferapi.com/api/v1/auth \
-H "Content-Type: application/json" \
-d '{
"api_key": "your_api_key",
"api_secret": "your_api_secret"
}'
Your First Transfer
Create your first atomic transfer between two accounts. This example transfers 100 credits from user_123 to user_456.
curl -X POST https://api.xferapi.com/api/v1/transfer \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_access_token" \
-d '{
"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"
}'
Handle the Response
Check the response to ensure your transfer was successful. A successful transfer returns no error.
{
"error": null,
"transfer_id": "txn_001",
"status": "completed",
"timestamp": "2024-01-15T10:30:00Z"
}
If there's an error, you'll receive detailed error information:
{
"error": "InsufficientAmountErr",
"message": "Account user_123 has insufficient balance",
"error_code": "E001",
"transfer_id": "txn_001"
}
Rollback if Needed
If you need to rollback a transfer (within the allowed time window), use the rollback endpoint.
curl -X POST https://api.xferapi.com/api/v1/rollback \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_access_token" \
-d '{
"TransferId": "txn_001",
"TransferScene": "user_to_user"
}'
Key Features You Just Used
Atomic Operations
Either all parts of your transfer succeed, or none do. No partial transfers ever.
Half-Success Support
Advanced error handling that maximizes success rates while maintaining consistency.
What's Next?
Complete documentation for all endpoints and parameters.
Real-world examples for gaming, e-commerce, and more.
Official libraries for faster integration.