findOrCreateLabel( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a label with a given name, or creates one if it doesn't exist.

The findOrCreateLabel() function returns a Promise that resolves when the specified label is found or created.

Successful calls to findOrCreateLabel() always returns a label, which can be passed to subsequent function calls.

To find an existing label without potentially creating a new one, use getLabel() or queryLabels().

Admin Method

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Contact Labels
Manage Members and Contacts - all permissions
Learn more about permission scopes.
Method Declaration
Method Parameters

Display name to retrieve or create.

If an existing label is an exact match for the specified display name, the existing label is returned. If not, a new label is created and returned.


Language options.

Return Type:Promise<FindOrCreateLabelResponse>
Was this helpful?