Skip to main content

How to create a new connection

There are three ways to create a new connection:

  • Starting the Aluvia client without including a connectionId
  • Using the Aluvia API
  • Manually in the Aluvia dashboard

Use the Aluvia client

If you start the AluviaClient without including a connectionId, the client will create a new connection for you automatically.

import { AluviaClient } from '@aluvia/sdk';

const client = new AluviaClient({ apiKey: process.env.ALUVIA_API_KEY! });

// Omitting `connectionId` makes `start()` create a new connection
const connection = await client.start();

// Integration and automation code...

await connection.close(); // recommended cleanup

Use the Aluvia API

Use AluviaApi to create a connection programmatically without starting the Aluvia client (and its related local proxy processes). The SDK provides language wrappers around the Aluvia REST API.

import { AluviaApi } from '@aluvia/sdk';

const api = new AluviaApi({ apiKey: process.env.ALUVIA_API_KEY! });

const accountConnection = await api.account.connections.create({ target_geo: 'US' });

console.log('Created connection:', accountConnection.id ?? accountConnection.connection_id);

Alternatively, you can call the API directly: POST /account/connections

See the API reference docs for more details.

Use the Aluvia dashboard

  1. Sign in to the Aluvia dashboard.
  2. Go to the Connections page.
  3. Click Create new.