Technology in Treasury

Building Your First Treasury API: Kyriba Balance Extraction with Power Automate

A Step-by-Step Implementation Guide Following the Treasury API Manual

Introduction

This practical guide demonstrates how to implement the concepts from our Treasury API Guide: A Non-Technical Treasurer’s Complete Manual using a real-world example. We’ll build a Power Automate flow that automatically extracts account balances from Kyriba TMS and populates an Excel Online file – no coding required.

What You’ll Accomplish:

  • Create your first automated API integration
  • Extract live balance data from Kyriba TMS
  • Automatically update Excel with fresh treasury data
  • Set up scheduled daily runs for cash positioning

Prerequisites:

  • Microsoft 365 subscription with Power Automate
  • Kyriba TMS access with API credentials
  • Basic familiarity with concepts from the Treasury API Guide

Why This Integration Matters

Manual balance extraction is one of the most time-consuming daily treasury tasks. This automation transforms a 30-minute manual process into a 2-minute automated workflow that runs while you focus on analysis and decision-making.

Business Benefits:

  • Time Savings: Reduce daily cash positioning from 30 minutes to 2 minutes
  • Accuracy: Eliminate manual transcription errors
  • Consistency: Same format every day, regardless of who’s working
  • Real-time Data: Fresh balances whenever you need them
  • Audit Trail: Complete log of all data retrievals

Step-by-Step Implementation Guide

Step 1: Create Your Power Automate Flow Foundation

What We’re Doing: Setting up the basic structure for our automated workflow.

Action Steps:

  1. Navigate to Power Automate (flow.microsoft.com)
  2. Click “Create” from the left navigation
  3. Select “Scheduled cloud flow”
  4. Name your flow: “Daily Kyriba Balance Extract”
  5. Set schedule: Manual Trigger or Daily at 8:00 AM (or your preferred time)
  6. Click “Create”

Treasury Context: This creates the foundation that will run automatically every business day, ensuring your cash position data is ready when you arrive at the office.


Step 2: Configure Kyriba API Connection

What We’re Doing: Establishing the secure connection to your Kyriba TMS using the authentication principles from our API guide.

Action Steps:

  1. Click “+ New step”
  2. Search for “HTTP” connector
  3. Select “HTTP – HTTP” action
  4. Configure the request:
    • Method: GET
    • URI: https://[your-kyriba-instance].kyriba.com/api/v1/accounts/balances
    • Headers: Add the following headers: Authorization: Bearer [your-api-token]Content-Type: application/jsonAccept: application/json

Key Points:

  • Replace [your-kyriba-instance] with your actual Kyriba domain
  • Your Bearer Token comes from Kyriba’s API credentials (see Step 3)
  • This follows the exact authentication pattern explained in our main API guide

Step 3: Handle Kyriba Authentication

What We’re Doing: Implementing the Bearer Token authentication we covered in the Treasury API Guide.

Before This Step:

  1. Contact your Kyriba administrator for API credentials
  2. Obtain your:
    • Client ID
    • Client Secret
    • API Base URL
    • Token endpoint

Authentication Flow Configuration:

  1. Add another HTTP action before the balance request
  2. Configure for token retrieval:
    • Method: POST
    • URI: https://[your-kyriba-instance].kyriba.com/api/oauth/token
    • Headers: Content-Type: application/x-www-form-urlencoded
    • Body: grant_type=client_credentials&client_id=[your-client-id]&client_secret=[your-client-secret]

Security Note: Store credentials in Power Automate’s secure connection settings, never hardcode them in the flow.


Step 4: Parse the Kyriba Response

What We’re Doing: Converting the JSON response from Kyriba into usable data, applying the response handling techniques from our API guide.

Action Steps:

  1. Add “Parse JSON” action
  2. Content: Select the body from your HTTP response
  3. Schema: Use this sample schema based on typical Kyriba responses:
{
    "type": "object",
    "properties": {
        "accounts": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "accountNumber": {"type": "string"},
                    "accountName": {"type": "string"},
                    "currency": {"type": "string"},
                    "availableBalance": {"type": "number"},
                    "ledgerBalance": {"type": "number"},
                    "asOfDate": {"type": "string"}
                }
            }
        }
    }
}

Why This Matters: This step transforms the raw API response into structured data that Excel can understand, eliminating the manual interpretation step.


Step 5: Set Up Excel Online Integration

What We’re Doing: Creating the destination for our automated balance data.

Excel Preparation:

  1. Create a new Excel file in OneDrive/SharePoint
  2. Name it: “Daily Cash Position – [Current Year]”
  3. Create headers in Row 1:
    • A1: Account Number
    • B1: Account Name
    • C1: Currency
    • D1: Available Balance
    • E1: Ledger Balance
    • F1: As of Date
    • G1: Last Updated

Power Automate Configuration:

  1. Add “Excel Online (Business)” action
  2. Select “Add a row into a table”
  3. Choose your Excel file and create/select a table
  4. Map the Kyriba data fields to Excel columns

Step 6: Add Data Transformation Logic

What We’re Doing: Handling multiple accounts and formatting data for treasury use.

Action Steps:

  1. Add “Apply to each” control
  2. Select the accounts array from your parsed JSON
  3. Inside the loop, add “Add a row into a table” action
  4. Map each field:
    • Account Number: items('Apply_to_each')?['accountNumber']
    • Account Name: items('Apply_to_each')?['accountName']
    • Currency: items('Apply_to_each')?['currency']
    • Available Balance: items('Apply_to_each')?['availableBalance']
    • Ledger Balance: items('Apply_to_each')?['ledgerBalance']
    • As of Date: items('Apply_to_each')?['asOfDate']
    • Last Updated: utcNow()

Treasury Value: This ensures every account balance is captured systematically, with timestamps for audit purposes.


Step 7: Implement Error Handling

What We’re Doing: Adding the error handling practices recommended in our API troubleshooting checklist.

Action Steps:

  1. Go to Settings for each HTTP action
  2. Enable “Configure run after”
  3. Select both “is successful” and “has failed”
  4. Add “Condition” control after HTTP actions
  5. If yes: Continue with data processing
  6. If no: Add email notification action

Error Notification Setup:

  1. Add “Send an email (V2)” action in the “No” branch
  2. Configure:
    • To: Your email and treasury team
    • Subject: “Kyriba API Integration Failed – [Date]”
    • Body: Include error details and status codes

Why This Matters: Following our API guide’s emphasis on monitoring, you’ll know immediately when something breaks instead of discovering missing data later.


Step 8: Test and Validate Your Integration

What We’re Doing: Following the testing methodology from our Treasury API Guide before going live.

Testing Checklist:

  1. Manual Test Run:
    • Click “Test” in Power Automate
    • Select “I’ll perform the trigger action”
    • Review each step’s output
    • Verify Excel receives correct data
  2. Data Validation:
    • Compare API results with Kyriba interface
    • Check all accounts are included
    • Verify balance accuracy
    • Confirm date/time stamps
  3. Error Scenario Testing:
    • Temporarily use wrong credentials (test 401 error handling)
    • Use invalid endpoint (test 404 handling)
    • Verify error notifications work
  4. Schedule Validation:
    • Confirm trigger timing
    • Test timezone settings
    • Verify weekend/holiday handling

Advanced Configuration Options

Multi-Currency Formatting

Add currency formatting logic to display balances in treasury-standard format:

concat(items('Apply_to_each')?['currency'], ' ', formatNumber(items('Apply_to_each')?['availableBalance'], 'N2'))

Historical Data Retention

Modify the flow to append data instead of overwriting:

  • Add date-based sheet creation
  • Implement monthly archiving
  • Create summary pivot tables

Alert Thresholds

Add conditional logic for balance alerts:

  • Low balance warnings
  • Large variance notifications
  • Missing account alerts

Troubleshooting Common Issues

Authentication Problems

Symptom: 401 Unauthorized errors Solution:

  • Verify API credentials with Kyriba admin
  • Check token expiration settings
  • Confirm endpoint URLs

Data Mapping Errors

Symptom: Empty Excel cells or wrong data Solution:

  • Review JSON schema accuracy
  • Check field name spellings
  • Validate data types match

Schedule Issues

Symptom: Flow doesn’t run at expected times Solution:

  • Verify timezone settings
  • Check trigger configuration
  • Review Power Automate plan limits

Monitoring and Maintenance

Daily Monitoring

  • Review run history in Power Automate
  • Check Excel file for data completeness
  • Monitor error notification emails

Weekly Maintenance

  • Verify API credential expiration dates
  • Review data accuracy trends
  • Update any changed account structures

Monthly Review

  • Analyze automation time savings
  • Review error patterns
  • Consider additional automations

Expanding Your Treasury API Journey

This Kyriba integration demonstrates the practical application of concepts from our Treasury API Guide: A Non-Technical Treasurer’s Complete Manual. Having successfully implemented your first API automation, consider these next steps:

Immediate Opportunities

  • Payment Status Tracking: Automate payment confirmation workflows
  • FX Rate Integration: Live currency rates for hedging decisions
  • Multi-Bank Consolidation: Combine data from multiple banking APIs

Advanced Integrations

  • Risk Management: Automated VaR calculations with live market data
  • Compliance Reporting: Automated regulatory report generation
  • Cash Forecasting: Integration with ERP systems for predictive analytics

Building Treasury API Capabilities

  1. Start Small: Master this balance extraction before adding complexity
  2. Document Everything: Create your own API integration playbook
  3. Train Your Team: Share knowledge and build organizational capability
  4. Iterate Gradually: Add features based on actual business needs

Conclusion

You’ve successfully built your first treasury API integration, transforming manual balance extraction into an automated, reliable process. This practical implementation demonstrates that APIs aren’t just for IT departments – they’re powerful tools that treasury professionals can leverage directly.

Key Achievements: ✅ Automated daily balance extraction from Kyriba
✅ Eliminated manual data entry errors
✅ Created audit trail for all data retrievals
✅ Established foundation for additional treasury automations
✅ Applied real-world API concepts from our comprehensive guide

Time Investment vs. Returns:

  • Setup Time: 2-3 hours (one-time)
  • Daily Time Saved: 25-30 minutes
  • Monthly ROI: 10+ hours of treasury analyst time
  • Accuracy Improvement: Elimination of transcription errors

This integration serves as your foundation for building a more automated, efficient treasury operation. As you become comfortable with these API concepts, you’ll identify numerous opportunities to apply similar automation throughout your treasury processes.

Remember: every manual, repetitive task in treasury is a candidate for API automation. Start with high-impact, low-complexity processes like this balance extraction, then gradually expand your automation portfolio.


Next Steps:

  1. Implement this Kyriba integration in your environment
  2. Monitor and refine the process for 30 days
  3. Identify your next automation opportunity
  4. Apply the same methodology to additional treasury workflows
  5. Share your success with the treasury community

Resources:

Disclaimer: This guide is based on publicly available Kyriba API documentation and general Power Automate capabilities. I am not affiliated with, promoting, or selling Kyriba products. Always consult with your Kyriba administrator and IT security team before implementing API integrations in production environments.

About the author

Alina Turungiu

Experienced Treasurer with 10+ years in global treasury operations, driven by a passion for technology, automation, and efficiency. Certified in treasury management, capital markets, financial modelling, Power Platform, RPA, UiPath, Six Sigma, and Coupa Treasury. Founder of TreasuryEase.com, where I share actionable insights and no-code solutions for treasury automation. My mission is to help treasury teams eliminate repetitive tasks and embrace scalable, sustainable automation—without expensive software or heavy IT involvement.

Leave a Comment