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:
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:
- optionsUserExportOptions
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.
- start(optional)
Response
This method returns the following response:
- dataobject
The response containing exported users and pagination information.
- itemsArray<object>
The list of exported users.
- userIdstring
The internal ID assigned to the user, unique across the workspace, in UUID format.
- externalUserIdstring|null
The external user ID used to identify the user on the application side.
Always null for anonymous users.
- firstNamestring|null
The user’s first name.
- lastNamestring|null
The user’s last name.
- birthDateinteger|null
The user’s birth date, in milliseconds since epoch.
- genderstring
The user’s gender.
These are the possible values and what they represent:
Value Description MALE Male gender. FEMALE Female gender. NEUTRAL Neither male nor female gender. UNKNOWN An unspecified gender. - emailstring|null
The user’s primary email address.
- alternateEmailstring|null
The user’s alternate email address.
- phonestring|null
The user’s primary phone number.
- alternatePhonestring|null
The user’s alternate phone number.
- addressUserAddress
- avatarstring|null
The URL of the user’s avatar image.
- companystring|null
The user’s company name.
- companyUrlstring|null
The user’s company website URL.
- jobTitlestring|null
The user’s job title.
- activitiesArray<string>
The user’s activities.
- interestsArray<string>
The user’s interests.
- customAttributesobject
Custom attributes associated with the user.
- lastModifiedTimeinteger
The timestamp when the user was last modified, in milliseconds since epoch.
Not updated on sync operations.
- statisticsUserStatistics
- userId
- nextCursorstring
An opaque cursor for retrieving the next page of results.
The value is an empty string when there are no more results. Treat it as opaque and pass it back unchanged on the next request.
- items