Problem statement
What fields from the user object can be exported via the Bulk Export job?
Solution
If the GET User can return an attribute by ID endpoint, it will also be available within a bulk export if the relevant field name is requested. If CSV is used as the output, additional steps need to be taken to get nested data, such as list/array items or objects. For example, “multifactor” is available to the export, but as it is a list, for a CSV output, “multifactor[0]” would need to be specified to get the first value.
For a more complete export, the JSON output option is recommended, as this can handle exporting the entirety of an object/list, for example, app_metadata, by just requesting the top-level object (app_metadata). JSON can support this kind of data natively, unlike CSV.
If there is a requirement for exporting in CSV despite this, for accessing nested attributes such as in app_metadata, the full path must be specified, e.g. for the JSON below:
{
//rest of user profile...
"app_metadata": {
"address": {
"street_address": {
"number": "1",
}
}
}
To get the number attribute value exported the field would need to be specified like below:
{
"connection_id": "<connection ID here",
"format": "csv",
"fields": [
{
"name": "user_id"
},
{
"name": "username"
},
{
"name": "app_metadata.address.street_address.number"
}
]
}
The dashboard view of the user’s raw profile does some additional steps behind the scenes to pull data from other sources. This data is not available for the same user being looked up by the GET user by ID endpoint—for example, the “blocked_for” and “guardian_authenticators” objects.
Top-level user profile attributes mapped from a SAML connection are also available, as the fields parameter will accept any value to accommodate for custom attributes from external IdPs. For SAML connections, it is recommended to first call the GET by ID endpoint for some SAML users to see what is stored on their profile and update the field selection to match what has been mapped alongside the standard Auth0 attributes.