SDKs overview

Citi provides Software Development Kits (SDKs) and libraries to facilitate integration with its suite of financial APIs. These resources are designed to reduce development time and complexity by offering pre-packaged functions for common tasks such as API authentication, request construction, and response handling. Developers can access a sandbox environment via the Citi developer portal to test integrations without impacting live financial systems. The available SDKs support various programming languages, aligning with common enterprise development stacks.

The primary goal of these SDKs is to abstract the underlying HTTP requests and security protocols, allowing developers to focus on application logic. This approach is consistent with industry best practices for API consumption, where SDKs act as a layer of abstraction over raw API calls, often incorporating features like retry mechanisms, error handling, and data serialization/deserialization. For example, many SDKs implement OAuth 2.0 for secure authorization, simplifying the process for developers who might otherwise need to manage token lifecycles manually, as detailed in the OAuth 2.0 specification.

Official SDKs by language

Citi offers official SDKs and code examples to assist developers in integrating with its APIs. These resources are maintained by Citi and are the recommended path for building robust applications. The developer portal provides comprehensive documentation and code snippets for various programming languages, including Python, Java, and Node.js. While full-fledged SDKs with dedicated package managers are available for some languages, others are supported through extensive code examples and client libraries that can be directly incorporated into projects.

The following table outlines the key official SDKs and client libraries provided by Citi, along with their typical installation methods and maturity levels. Developers should consult the Citi API reference documentation for the most up-to-date information on specific versions and capabilities.

Language Package/Client Library Installation Command (Example) Maturity
Python citi-api-client-python pip install citi-api-client-python Stable
Java citi-api-client-java (Maven/Gradle artifact) <dependency><groupId>com.citi</groupId><artifactId>citi-api-client-java</artifactId><version>X.Y.Z</version></dependency> Stable
Node.js @citi/api-client-nodejs npm install @citi/api-client-nodejs Stable
cURL (Direct HTTP calls) N/A (command-line utility) Fundamental

Installation

Installation of Citi's official SDKs typically follows standard package management practices for each respective language. For Python, the pip package installer is used. Java developers integrate libraries via build automation tools like Maven or Gradle. Node.js projects utilize npm for dependency management. Detailed installation instructions and prerequisites are available on the Citi developer documentation pages for each specific SDK.

Python Installation

To install the Python client library, ensure you have Python and pip installed. Then, execute the following command in your terminal:

pip install citi-api-client-python

Java Installation (Maven)

For Java projects using Maven, add the following dependency to your pom.xml file. Replace X.Y.Z with the latest version found in the Citi Java SDK guide:

<dependency>
    <groupId>com.citi</groupId>
    <artifactId>citi-api-client-java</artifactId>
    <version>X.Y.Z</version>
</dependency>

Node.js Installation

To install the Node.js client library, ensure you have Node.js and npm installed. Run the following command in your project directory:

npm install @citi/api-client-nodejs

Quickstart example

This quickstart example demonstrates how to make a basic API call using the Python client library to fetch account information. Before running this code, you will need to obtain API credentials (Client ID and Client Secret) from your Citi developer account and configure them as environment variables or directly within your application (though environment variables are recommended for security).

import os
from citi_api_client_python import CitiClient
from citi_api_client_python.exceptions import CitiAPIException

# --- Configuration ---
# Replace with your actual credentials or set as environment variables
CLIENT_ID = os.getenv('CITI_CLIENT_ID', 'YOUR_CLIENT_ID')
CLIENT_SECRET = os.getenv('CITI_CLIENT_SECRET', 'YOUR_CLIENT_SECRET')

# The base URL for the sandbox environment
BASE_URL = "https://sandbox.developer.citi.com"

# --- Initialize Client ---
try:
    client = CitiClient(
        client_id=CLIENT_ID,
        client_secret=CLIENT_SECRET,
        base_url=BASE_URL
    )
    print("CitiClient initialized successfully.")

    # --- Authenticate ---
    # The client handles token acquisition and refresh automatically
    # For direct token acquisition, consult the Citi authentication guide
    # For this example, we assume the client manages authentication internally

    # --- Make an API Call (e.g., Get Account Balances) ---
    # This assumes an 'accounts' service and a 'get_balances' method exists.
    # Actual method names and parameters will vary based on the specific API.
    # Refer to the official Citi API reference for exact endpoints and payloads.

    # Example: Fetching balances for a specific customer ID
    customer_id = "CUSTOMER12345" # Replace with a valid sandbox customer ID
    account_balances = client.accounts.get_balances(customer_id=customer_id)

    print(f"\nAccount Balances for Customer {customer_id}:")
    for account in account_balances.get('accounts', []):
        print(f"  Account Number: {account.get('accountNumber')}, Balance: {account.get('currentBalance')} {account.get('currency')}")

except CitiAPIException as e:
    print(f"An API error occurred: {e.status_code} - {e.message}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

This Python snippet demonstrates the typical flow: client initialization with credentials, which often implicitly handles authentication (like obtaining an OAuth 2.0 access token), and then invoking a specific API method to retrieve data. Remember that actual API endpoint paths, method names, and required parameters will differ based on the specific Citi API you are interacting with (e.g., Payments, Account Information, Treasury). Always consult the official Citi API reference documentation for precise details.

Community libraries

While Citi actively maintains its official SDKs, the broader developer community may also contribute open-source libraries or wrappers that interact with Citi's APIs. These community-driven projects can offer alternative language support, specialized functionality, or integrations with other tools. However, it is important to note that community libraries are not officially supported or endorsed by Citi. Developers choosing to use them should exercise due diligence regarding their security, maintenance, and adherence to Citi's API specifications.

Before integrating a community library, developers should evaluate its documentation, community activity (e.g., GitHub stars, recent commits, issue resolution), and licensing. For mission-critical applications, relying on official SDKs and direct API integrations, coupled with thorough testing in the Citi sandbox environment, is generally recommended. Resources like GitHub and public package repositories (e.g., PyPI for Python, npm for Node.js) can be searched for community contributions related to "Citi API" or "Citibank API" to identify such projects.