Newline SDK Quickstart

This guide walks through the basic steps to get started with the Newline SDKs.

Overview

Using a Newline SDK follows a common workflow:

  • Install the SDK for your language
  • Configure authentication credentials
  • Initialize an SDK client
  • Make your first API call

All SDKs share the same structure for authentication, resources, and operations.

1. Install the SDK

Install the SDK for your preferred language:

  • TypeScript: See TypeScript SDK Installation
  • Java: See Java SDK Installation
  • .NET: See .NET SDK Installation

2. Configure Authentication

All Newline SDKs require the following credentials:

  • programUid
  • hmacKey

These are typically provided through environment variables:

  • NEWLINE_PROGRAM_UID
  • NEWLINE_HMAC_KEY

3. Initialize the SDK Client

Create an SDK client instance using your credentials.

Example (TypeScript)

import { NewlineSDK } from "newline-ts-sdk";

const newlineSDK = new NewlineSDK({
  security: {
    programUid: process.env["NEWLINE_PROGRAM_UID"] ?? "",
    hmacKey: process.env["NEWLINE_HMAC_KEY"] ?? "",
  },
});
``

The client configuration is used for all subsequent API requests.

4. Make Your First API Call Once initialized, you can call available SDK methods.

Example: Generate an Authentication Token

async function run() {
  const result = await newlineSDK.auth.generateToken();
  console.log(result);
}

run();
``

This request verifies that your SDK is configured correctly.

5. Work with Platform Resources

After setup, you can interact with Newline Platform resources through the SDK. Available resource domains include:

  • Authentication
  • Customers and Customer Products
  • Accounts and Balances
  • Transactions and Transfers
  • Products, Pools, and Returns
  • Virtual Reference Numbers
  • Combined Transfers

Each resource provides methods for common operations such as retrieving, listing, creating, updating, and archiving data.

  1. (Optional) Select an Environment

By default, the SDK uses a configured server, but you can choose an environment during initialization:

Example (TypeScript)

TypeScriptconst newlineSDK = new NewlineSDK({  server: "sandbox",  security: {    programUid: process.env["NEWLINE_PROGRAM_UID"] ?? "",    hmacKey: process.env["NEWLINE_HMAC_KEY"] ?? "",  },});Show more lines

7. Handle Errors

Errors returned by the SDK extend from a common base type: NewlineError. These errors include:

  • Error message
  • HTTP status code
  • Response headers and body

You can catch and inspect errors when making API requests.

Next Steps

  • Explore available SDK resources and operations
  • Configure retry behavior if needed
  • Integrate additional API workflows into your application