# SupabaseClient | @supabase/supabase-js
Documentation for @supabase/supabase-js

Supabase Client.

An isomorphic Javascript client for interacting with Postgres.

### Hierarchy

- SupabaseClient

## Index

### Constructors

- constructor

### Properties

- auth
- authUrl
- changedAccessToken
- fetch
- functionsUrl
- headers
- multiTab
- realtime
- realtimeUrl
- restUrl
- schema
- shouldThrowOnError
- storageUrl
- supabaseKey
- supabaseUrl

### Accessors

- functions
- storage

### Methods

- _closeSubscription
- _getAuthHeaders
- _handleTokenChanged
- _initPostgRESTClient
- _initRealtimeClient
- _initSupabaseAuthClient
- _listenForAuthEvents
- _listenForMultiTabEvents
- _unsubscribeSubscription
- from
- getSubscriptions
- removeAllSubscriptions
- removeSubscription
- rpc

## Constructors

### constructor

- new SupabaseClient(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions ): SupabaseClient

- - Defined in src/SupabaseClient.ts:61

  Create a new client for use in the browser.

  #### Parameters

  - ##### supabaseUrl: string

    The unique Supabase URL which is supplied when you create a new project in your project dashboard.

  - ##### supabaseKey: string

    The unique Supabase Key which is supplied when you create a new project in your project dashboard.

  - ##### Optional options: SupabaseClientOptions

  #### Returns SupabaseClient

## Properties

### auth

auth: SupabaseAuthClient

- Defined in src/SupabaseClient.ts:30

Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.

### Protected authUrl

authUrl: string

- Defined in src/SupabaseClient.ts:35

### Protected changedAccessToken

changedAccessToken: undefined | string

- Defined in src/SupabaseClient.ts:41

### Protected Optional fetch

fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>)

- Defined in src/SupabaseClient.ts:40

#### Type declaration

- - (input: RequestInfo | URL, init?: RequestInit): Promise<Response>

  - #### Parameters

    - ##### input: RequestInfo | URL

    - ##### Optional init: RequestInit

    #### Returns Promise<Response>

### Protected functionsUrl

functionsUrl: string

- Defined in src/SupabaseClient.ts:37

### Protected headers

headers: {}

- Defined in src/SupabaseClient.ts:44

#### Type declaration

- ##### [key: string]: string

### Protected multiTab

multiTab: boolean

- Defined in src/SupabaseClient.ts:39

### Protected realtime

realtime: RealtimeClient

- Defined in src/SupabaseClient.ts:38

### Protected realtimeUrl

realtimeUrl: string

- Defined in src/SupabaseClient.ts:34

### Protected restUrl

restUrl: string

- Defined in src/SupabaseClient.ts:33

### Protected schema

schema: string

- Defined in src/SupabaseClient.ts:32

### Protected shouldThrowOnError

shouldThrowOnError: boolean

- Defined in src/SupabaseClient.ts:42

### Protected storageUrl

storageUrl: string

- Defined in src/SupabaseClient.ts:36

### Protected supabaseKey

supabaseKey: string

### Protected supabaseUrl

supabaseUrl: string

## Accessors

### functions

- get functions(): FunctionsClient

- - Defined in src/SupabaseClient.ts:106

  Supabase Functions allows you to deploy and invoke edge functions.

  #### Returns FunctionsClient

### storage

- get storage(): StorageClient

- - Defined in src/SupabaseClient.ts:116

  Supabase Storage allows you to manage user-generated content, such as photos or videos.

  #### Returns StorageClient

## Methods

### Private _closeSubscription

- _closeSubscription(subscription: RealtimeSubscription ): Promise<{ error: null | Error }>

- - Defined in src/SupabaseClient.ts:194

  #### Parameters

  - ##### subscription: RealtimeSubscription

  #### Returns Promise<{ error: null | Error }>

### Private _getAuthHeaders

- _getAuthHeaders(): GenericObject

- - Defined in src/SupabaseClient.ts:271

  #### Returns GenericObject

### Private _handleTokenChanged

- _handleTokenChanged(event: AuthChangeEvent, token: undefined | string, source: "CLIENT" | "STORAGE"): void

- - Defined in src/SupabaseClient.ts:313

  #### Parameters

  - ##### event: AuthChangeEvent

  - ##### token: undefined | string

  - ##### source: "CLIENT" | "STORAGE"

  #### Returns void

### Private _initPostgRESTClient

- _initPostgRESTClient(): default

- - Defined in src/SupabaseClient.ts:262

  #### Returns default

### Private _initRealtimeClient

- _initRealtimeClient(options?: RealtimeClientOptions ): RealtimeClient

- - Defined in src/SupabaseClient.ts:255

  #### Parameters

  - ##### Optional options: RealtimeClientOptions

  #### Returns RealtimeClient

### Private _initSupabaseAuthClient

- _initSupabaseAuthClient(__namedParameters: SupabaseClientOptions ): SupabaseAuthClient

- - Defined in src/SupabaseClient.ts:228

  #### Parameters

  - ##### __namedParameters: SupabaseClientOptions

  #### Returns SupabaseAuthClient

### Private _listenForAuthEvents

- _listenForAuthEvents(): null | Subscription

- - Defined in src/SupabaseClient.ts:306

  #### Returns null | Subscription

### Private _listenForMultiTabEvents

- _listenForMultiTabEvents(): null | void

- - Defined in src/SupabaseClient.ts:279

  #### Returns null | void

### Private _unsubscribeSubscription

- _unsubscribeSubscription(subscription: RealtimeSubscription ): Promise<{ error: null | Error }>

- - Defined in src/SupabaseClient.ts:209

  #### Parameters

  - ##### subscription: RealtimeSubscription

  #### Returns Promise<{ error: null | Error }>

### from

- from<T>(table: string): SupabaseQueryBuilder <T>

- - Defined in src/SupabaseClient.ts:125

  Perform a table operation.

  #### Type Parameters

  - #### T = any

  #### Parameters

  - ##### table: string

    The table name to operate on.

  #### Returns SupabaseQueryBuilder <T>

### getSubscriptions

- getSubscriptions(): RealtimeSubscription []

- - Defined in src/SupabaseClient.ts:224

  Returns an array of all your subscriptions.

  #### Returns RealtimeSubscription []

### removeAllSubscriptions

- removeAllSubscriptions(): Promise<{ data: { subscription: RealtimeSubscription }; error: null | Error }[]>

- - Defined in src/SupabaseClient.ts:162

  Closes and removes all subscriptions and returns a list of removed subscriptions and their errors.

  #### Returns Promise<{ data: { subscription: RealtimeSubscription }; error: null | Error }[]>

### removeSubscription

- removeSubscription(subscription: RealtimeSubscription ): Promise<{ data: { openSubscriptions: number }; error: null | Error }>

- - Defined in src/SupabaseClient.ts:182

  Closes and removes a subscription and returns the number of open subscriptions.

  #### Parameters

  - ##### subscription: RealtimeSubscription

    The subscription you want to close and remove.

  #### Returns Promise<{ data: { openSubscriptions: number }; error: null | Error }>

### rpc

- rpc<T>(fn: string, params?: object, __namedParameters?: { count?: null | "exact" | "planned" | "estimated"; head?: boolean }): default<T>

- - Defined in src/SupabaseClient.ts:146

  Perform a function call.

  #### Type Parameters

  - #### T = any

  #### Parameters

  - ##### fn: string

    The function name to call.

  - ##### Optional params: object

    The parameters to pass to the function call.

  - ##### __namedParameters: { count?: null | "exact" | "planned" | "estimated"; head?: boolean } = {}

    - ##### Optional count?: null | "exact" | "planned" | "estimated"

    - ##### Optional head?: boolean

  #### Returns default<T>

Generated using TypeDoc