Bulk User Export not exporting app_metadata

I’m following these docs: https://auth0.com/docs/users/bulk-user-exports to try and export my users.
Everything is working and I’m getting a result - however the app_metadata fields are not included in the output:

$curl = curl_init();
        $payload = [
            "connection_id" => getenv('CONNECTION_ID'),
            "format"        => "csv",
            "limit"         => 5,
            "fields"        => [
                    ["name" => "email"], 
                    ["name" => "user_id"], 
                    ["name" => "identities[0].connection", "export_as" => 'provider'],
                    ["name" => "user_metadata.mystuff.uuid", "export_as" => 'mystuff_uuid'],
                    ["name" => "app_metadata.authorization.groups", "export_as" => 'authz_groups']
        curl_setopt_array($curl, [
            CURLOPT_URL => "https://".getenv('AUTH0_DOMAIN')."/api/v2/jobs/users-exports",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_POSTFIELDS => json_encode($payload),
            CURLOPT_HTTPHEADER => [
                "authorization: {$auth0_token['token_type']} {$auth0_token['access_token']}",
                "content-type: application/json"

My app has all the required permissions as well as read:users_app_metadata, but the data returned doesn’t include any app_metadata:


The metadata is related to the Authorization extension so it should contain an array of group names.

I’ve tried to export the entire app_metadata content using the "app_metadata": "app_metadata" format specified in the docs (which I enterpteted as ["app_metadata" => "app_metadata"]) but instead I get a
Payload validation error: 'Additional properties not allowed: app_metadata' on property fields[4] ({description}). error.

What am I doing wrong?

The sample you shared correctly included user_metadata.mystuff.uuid so as a first step that you may have already done, have you checked the exported users have app_metadata.authorization.groups set?

The reason I ask is that if this data is set by Authorization extension then technically it will only be set the first time the user completes a login after the extension rule was setup. In addition, I don’t think a csv export allows to export a full object so I would also try to export ["name" => "app_metadata"] in JSON format to see what would be the outcome.

Hi jmangelo

Thanks for responding. The JSON format worked so as you mentioned it looks like the CSV format doesn’t support objects.