# `constructor`

Returns an instance of the API Kit.

## Usage


```typescript
import SafeApiKit from '@safe-global/api-kit'

const chainId = 1n

const txServiceUrl = 'https://...'

// How to get an Api key => http://docs.safe.global/core-api/how-to-use-api-keys
const apiKit = new SafeApiKit({
  chainId,
  txServiceUrl, // Optional
  apiKey: 'YOUR_API_KEY' //  Mandatory if txServiceUrl is not specified
})
```


## Returns

`SafeApiKit`

A new instance of the API Kit.

## Parameters

### `chainId`

- **Type:** `bigint`

The chain ID.

```typescript focus=2
const apiKit = new SafeApiKit({
  chainId: 1n,
  apiKey: 'YOUR_API_KEY'
})
```

### `apiKey`

- **Type:** `string`

The API key. This parameter is mandatory when using default Safe provided services. It can be omitted if using a custom Transaction Service. [Check how to get one](../core-api/how-to-use-api-keys.mdx).

```typescript focus=3
const apiKit = new SafeApiKit({
  chainId: 1n,
  apiKey: 'YOUR_API_KEY'
})
```

### `txServiceUrl` (Optional)

- **Type:** `string`

The URL of the Safe Transaction Service. This can be provided instead of `apiKey` to specify a custom Transaction Service endpoint, such as when running your own Safe Transaction Service instance.

```typescript focus=3
const apiKit = new SafeApiKit({
  chainId: 1n,
  txServiceUrl: 'https://...'
})
```
