exportUsers

Export users from your workspace.

This method exports users from a workspace, optionally filtered by time window relative to the user's last update.

Signature

This method has the following signature:

exportUsers(options: UserExportOptions): Promise<{data: UserResponse}>

Example

Here is an example of how to use this method:

1234567891011121314151617181920212223242526
import {Configuration, ExportApi} from '@croct/export';
async function exportUsers(): Promise<void> {  const api = new ExportApi(    new Configuration({      apiKey: '<API KEY>'    })  );
  let cursor: string | undefined = undefined;  let running = true;
  while (running) {    const {data: {items: users, nextCursor}} = await api.exportUsers({      pageSize: 100,      cursor: cursor,      start: 1440990000000,      end: 1441076400000,    });
    console.log(users);
    cursor = nextCursor;    running = users.length > 0;  }}

Parameters

The following list describes the supported parameters:

options
UserExportOptions

The options to filter and paginate users.

start(optional)
integer

The earliest user last-modified time to include, in milliseconds since epoch.

Only users updated at or after this time are included.

end(optional)
integer

The latest user last-modified time to include, in milliseconds since epoch.

Only users updated before this time are included. If not provided, there is no upper time limit.

pageSize(optional)
integer

The maximum number of users returned per request.

Must be between 1 and 1000.

Default:100
cursor(optional)
string

A cursor for retrieving the next page of results.

If omitted, export starts from the beginning of the specified time window.

Response

This method returns the following response:

data
object

The response containing exported users and pagination information.

items
object[]

The list of exported users.

userId
string

The internal ID assigned to the user, unique across the workspace, in UUID format.

externalUserId
string|null

The external user ID used to identify the user on the application side.

Always null for anonymous users.

firstName
string|null

The user's first name.

lastName
string|null

The user's last name.

birthDate
string|null

The user's birth date in ISO 8601 format (YYYY-MM-DD).

gender
string|null

The user's gender.

These are the possible values and what they represent:

ValueDescription
maleMale gender.
femaleFemale gender.
neutralNeither male nor female gender.
unknownAn unspecified gender.
email
string|null

The user's primary email address.

alternateEmail
string|null

The user's alternate email address.

phone
string|null

The user's primary phone number.

alternatePhone
string|null

The user's alternate phone number.

address
UserAddress|null

The user's address information.

street
string|null

Street address.

district
string|null

District or neighborhood.

city
string|null

City name.

region
string|null

State or region.

country
string|null

Country name.

postalCode
string|null

Postal or ZIP code.

avatar
string|null

The URL of the user's avatar image.

company
string|null

The user's company name.

companyUrl
string|null

The user's company website URL.

jobTitle
string|null

The user's job title.

activities
string[]

The user's activities.

interests
string[]

The user's interests.

customAttributes
object

Custom attributes associated with the user.

lastModifiedTime
integer

The timestamp when the user was last modified, in milliseconds since epoch.

Not updated on sync operations.

statistics
UserStatistics

Aggregated user statistics across the workspace.

orders
integer

The total number of orders placed across all applications.

sessions
integer

The total number of sessions across all applications.

nextCursor
string

A cursor for retrieving the next page of results.

If omitted, export starts from the beginning of the specified time window.