API Kit Reference
constructor

constructor

Returns an instance of the API Kit.

Usage


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

Returns

SafeApiKit

A new instance of the API Kit.

Parameters

chainId

  • Type: bigint

The chain ID.


_10
const apiKit = new SafeApiKit({
_10
chainId: 1n,
_10
apiKey: 'YOUR_API_KEY'
_10
})

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.


_10
const apiKit = new SafeApiKit({
_10
chainId: 1n,
_10
apiKey: 'YOUR_API_KEY'
_10
})

txServiceUrl (Optional)

  • Type: string

A custom Safe Transaction Service URL that is not supported by default.


_10
const apiKit = new SafeApiKit({
_10
chainId: 1n,
_10
txServiceUrl: 'https://...'
_10
})

Was this page helpful?