Skip to main content

nexla_sdk.client

Nexla API client

Classes

NexlaClient

Defined in nexla_sdk/client.py:34

Client for the Nexla API

The Nexla API supports two authentication methods:

  1. Service Key Authentication (recommended): Service keys are long-lived credentials created in the Nexla UI. The SDK obtains session tokens using the service key on demand and re-obtains a new token as needed. No refresh endpoint is used.

  2. Direct Access Token Authentication: Use a pre-obtained access token directly. These tokens are not refreshed by the SDK.

Examples:

Method 1: Using service key (recommended for automation)

client = NexlaClient(service_key="your-service-key")

Method 2: Using access token directly (manual/short-term use)

client = NexlaClient(access_token="your-access-token")

Using the client (same regardless of authentication method)

flows = client.flows.list()

Note:

  • Service keys should be treated as highly sensitive credentials
  • Only provide either service_key OR access_token, not both
  • When using direct access tokens, ensure they have sufficient lifetime for your operations as they cannot be automatically refreshed

Methods:

  • get_access_token(self) -> str
    • Source: nexla_sdk/client.py:157
    • Get a valid access token.
  • refresh_access_token(self) -> str
    • Source: nexla_sdk/client.py:179
    • Obtain a fresh token and return it.
  • request(self, method: str, path: str, **kwargs) -> Optional[Dict[str, Any]]
    • Source: nexla_sdk/client.py:230
    • Send a request to the Nexla API