firebase-admin package

Firebase namespaced API (legacy).

Functions

FunctionDescription
app(name)
appCheck(app)Gets the AppCheck service for the default app or a given app.admin.appCheck() can be called with no arguments to access the default app's AppCheck service or as admin.appCheck(app) to access the AppCheck service associated with a specific app.
auth(app)Gets the Auth service for the default app or a given app.admin.auth() can be called with no arguments to access the default app's Auth service or as admin.auth(app) to access the Auth service associated with a specific app.
database(app)Gets the Database service for the default app or a given app.admin.database() can be called with no arguments to access the default app's Database service or as admin.database(app) to access the Database service associated with a specific app.admin.database is also a namespace that can be used to access global constants and methods associated with the Database service.
firestore(app)
initializeApp(options, name)
installations(app)Gets the Installations service for the default app or a given app.admin.installations() can be called with no arguments to access the default app's Installations service or as admin.installations(app) to access the Installations service associated with a specific app.
instanceId(app)Gets the InstanceId service for the default app or a given app.admin.instanceId() can be called with no arguments to access the default app's InstanceId service or as admin.instanceId(app) to access the InstanceId service associated with a specific app.
machineLearning(app)Gets the MachineLearning service for the default app or a given app.admin.machineLearning() can be called with no arguments to access the default app's MachineLearning service or as admin.machineLearning(app) to access the MachineLearning service associated with a specific app.
messaging(app)Gets the Messaging service for the default app or a given app.admin.messaging() can be called with no arguments to access the default app's Messaging service or as admin.messaging(app) to access the Messaging service associated with a specific app.
projectManagement(app)Gets the ProjectManagement service for the default app or a given app.admin.projectManagement() can be called with no arguments to access the default app's ProjectManagement service, or as admin.projectManagement(app) to access the ProjectManagement service associated with a specific app.
remoteConfig(app)Gets the RemoteConfig service for the default app or a given app.admin.remoteConfig() can be called with no arguments to access the default app's RemoteConfig service or as admin.remoteConfig(app) to access the RemoteConfig service associated with a specific app.
securityRules(app)Gets the SecurityRules service for the default app or a given app.admin.securityRules() can be called with no arguments to access the default app's SecurityRules service, or as admin.securityRules(app) to access the SecurityRules service associated with a specific app.
storage(app)Gets the service for the default app or a given app.admin.storage() can be called with no arguments to access the default app's Storage service or as admin.storage(app) to access the Storage service associated with a specific app.

Interfaces

InterfaceDescription
AppOptionsAvailable options to pass to initializeApp().
FirebaseArrayIndexErrorComposite type which includes both a FirebaseError object and an index which can be used to get the errored item.
FirebaseErrorFirebaseError is a subclass of the standard JavaScript Error object. In addition to a message string and stack trace, it contains a string code.
GoogleOAuthAccessTokenInterface for Google OAuth 2.0 access tokens.
ServiceAccount

Namespaces

NamespaceDescription
app
appCheck
auth
credential
database
firestore
installations
instanceId
machineLearning
messaging
projectManagement
remoteConfig
securityRules
storage

Variables

VariableDescription
apps
SDK_VERSION

app(name)

Signature:

exportdeclarefunctionapp(name?:string):app.App;

Parameters

ParameterTypeDescription
namestring

Returns:

app.App

appCheck(app)

Gets the AppCheck service for the default app or a given app.

admin.appCheck() can be called with no arguments to access the default app's AppCheck service or as admin.appCheck(app) to access the AppCheck service associated with a specific app.

Signature:

exportdeclarefunctionappCheck(app?:App):appCheck.AppCheck;

Parameters

ParameterTypeDescription
appAppOptional app for which to return the AppCheck service. If not provided, the default AppCheck service is returned.

Returns:

appCheck.AppCheck

The default AppCheck service if no app is provided, or the AppCheck service associated with the provided app.

Example 1

// Get the `AppCheck` service for the default appvardefaultAppCheck=admin.appCheck();

Example 2

// Get the `AppCheck` service for a given appvarotherAppCheck=admin.appCheck(otherApp);

auth(app)

Gets the Auth service for the default app or a given app.

admin.auth() can be called with no arguments to access the default app's Auth service or as admin.auth(app) to access the Auth service associated with a specific app.

Signature:

exportdeclarefunctionauth(app?:App):auth.Auth;

Parameters

ParameterTypeDescription
appApp

Returns:

auth.Auth

Example 1

// Get the Auth service for the default appvardefaultAuth=admin.auth();

Example 2

// Get the Auth service for a given appvarotherAuth=admin.auth(otherApp);

database(app)

Gets the Database service for the default app or a given app.

admin.database() can be called with no arguments to access the default app's Database service or as admin.database(app) to access the Database service associated with a specific app.

admin.database is also a namespace that can be used to access global constants and methods associated with the Database service.

Signature:

exportdeclarefunctiondatabase(app?:App):database.Database;

Parameters

ParameterTypeDescription
appApp

Returns:

database.Database

The default Database service if no app is provided or the Database service associated with the provided app.

Example 1

// Get the Database service for the default appvardefaultDatabase=admin.database();

Example 2

// Get the Database service for a specific appvarotherDatabase=admin.database(app);

firestore(app)

Signature:

exportdeclarefunctionfirestore(app?:App):_firestore.Firestore;

Parameters

ParameterTypeDescription
appApp

Returns:

_firestore.Firestore

initializeApp(options, name)

Signature:

exportdeclarefunctioninitializeApp(options?:AppOptions,name?:string):app.App;

Parameters

ParameterTypeDescription
optionsAppOptions
namestring

Returns:

app.App

installations(app)

Gets the Installations service for the default app or a given app.

admin.installations() can be called with no arguments to access the default app's Installations service or as admin.installations(app) to access the Installations service associated with a specific app.

Signature:

exportdeclarefunctioninstallations(app?:App):installations.Installations;

Parameters

ParameterTypeDescription
appAppOptional app whose Installations service to return. If not provided, the default Installations service is returned.

Returns:

installations.Installations

The default Installations service if no app is provided or the Installations service associated with the provided app.

Example 1

// Get the Installations service for the default appvardefaultInstallations=admin.installations();

Example 2

// Get the Installations service for a given appvarotherInstallations=admin.installations(otherApp);

instanceId(app)

Gets the InstanceId service for the default app or a given app.

admin.instanceId() can be called with no arguments to access the default app's InstanceId service or as admin.instanceId(app) to access the InstanceId service associated with a specific app.

Signature:

exportdeclarefunctioninstanceId(app?:App):instanceId.InstanceId;

Parameters

ParameterTypeDescription
appAppOptional app whose InstanceId service to return. If not provided, the default InstanceId service will be returned.

Returns:

instanceId.InstanceId

The default InstanceId service if no app is provided or the InstanceId service associated with the provided app.

Example 1

// Get the Instance ID service for the default appvardefaultInstanceId=admin.instanceId();

Example 2

// Get the Instance ID service for a given appvarotherInstanceId=admin.instanceId(otherApp);

machineLearning(app)

Gets the MachineLearning service for the default app or a given app.

admin.machineLearning() can be called with no arguments to access the default app's MachineLearning service or as admin.machineLearning(app) to access the MachineLearning service associated with a specific app.

Signature:

exportdeclarefunctionmachineLearning(app?:App):machineLearning.MachineLearning;

Parameters

ParameterTypeDescription
appAppOptional app whose MachineLearning service to return. If not provided, the default MachineLearning service will be returned.

Returns:

machineLearning.MachineLearning

The default MachineLearning service if no app is provided or the MachineLearning service associated with the provided app.

Example 1

// Get the MachineLearning service for the default appvardefaultMachineLearning=admin.machineLearning();

Example 2

// Get the MachineLearning service for a given appvarotherMachineLearning=admin.machineLearning(otherApp);

messaging(app)

Gets the Messaging service for the default app or a given app.

admin.messaging() can be called with no arguments to access the default app's Messaging service or as admin.messaging(app) to access the Messaging service associated with a specific app.

Signature:

exportdeclarefunctionmessaging(app?:App):messaging.Messaging;

Parameters

ParameterTypeDescription
appAppOptional app whose Messaging service to return. If not provided, the default Messaging service will be returned.

Returns:

messaging.Messaging

The default Messaging service if no app is provided or the Messaging service associated with the provided app.

Example 1

// Get the Messaging service for the default appvardefaultMessaging=admin.messaging();

Example 2

// Get the Messaging service for a given appvarotherMessaging=admin.messaging(otherApp);

projectManagement(app)

Gets the ProjectManagement service for the default app or a given app.

admin.projectManagement() can be called with no arguments to access the default app's ProjectManagement service, or as admin.projectManagement(app) to access the ProjectManagement service associated with a specific app.

Signature:

exportdeclarefunctionprojectManagement(app?:App):projectManagement.ProjectManagement;

Parameters

ParameterTypeDescription
appAppOptional app whose ProjectManagement service to return. If not provided, the default ProjectManagement service will be returned. *

Returns:

projectManagement.ProjectManagement

The default ProjectManagement service if no app is provided or the ProjectManagement service associated with the provided app.

Example 1

// Get the ProjectManagement service for the default appvardefaultProjectManagement=admin.projectManagement();

Example 2

// Get the ProjectManagement service for a given appvarotherProjectManagement=admin.projectManagement(otherApp);

remoteConfig(app)

Gets the RemoteConfig service for the default app or a given app.

admin.remoteConfig() can be called with no arguments to access the default app's RemoteConfig service or as admin.remoteConfig(app) to access the RemoteConfig service associated with a specific app.

Signature:

exportdeclarefunctionremoteConfig(app?:App):remoteConfig.RemoteConfig;

Parameters

ParameterTypeDescription
appAppOptional app for which to return the RemoteConfig service. If not provided, the default RemoteConfig service is returned.

Returns:

remoteConfig.RemoteConfig

The default RemoteConfig service if no app is provided, or the RemoteConfig service associated with the provided app.

Example 1

// Get the `RemoteConfig` service for the default appvardefaultRemoteConfig=admin.remoteConfig();

Example 2

// Get the `RemoteConfig` service for a given appvarotherRemoteConfig=admin.remoteConfig(otherApp);

securityRules(app)

Gets the SecurityRules service for the default app or a given app.

admin.securityRules() can be called with no arguments to access the default app's SecurityRules service, or as admin.securityRules(app) to access the SecurityRules service associated with a specific app.

Signature:

exportdeclarefunctionsecurityRules(app?:App):securityRules.SecurityRules;

Parameters

ParameterTypeDescription
appAppOptional app to return the SecurityRules service for. If not provided, the default SecurityRules service is returned.

Returns:

securityRules.SecurityRules

The default SecurityRules service if no app is provided, or the SecurityRules service associated with the provided app.

Example 1

// Get the SecurityRules service for the default appvardefaultSecurityRules=admin.securityRules();

Example 2

// Get the SecurityRules service for a given appvarotherSecurityRules=admin.securityRules(otherApp);

storage(app)

Gets the service for the default app or a given app.

admin.storage() can be called with no arguments to access the default app's Storage service or as admin.storage(app) to access the Storage service associated with a specific app.

Signature:

exportdeclarefunctionstorage(app?:App):storage.Storage;

Parameters

ParameterTypeDescription
appApp

Returns:

storage.Storage

Example 1

// Get the Storage service for the default appvardefaultStorage=admin.storage();

Example 2

// Get the Storage service for a given appvarotherStorage=admin.storage(otherApp);

apps

Signature:

apps:(app.App|null)[]

SDK_VERSION

Signature:

SDK_VERSION:string