# User Data import from Spanner to Auth0

**URL:** <https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [July 20, 2023, 7:54am UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652 "2023-07-20T07:54:16Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![dipesh.agrawal](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dipesh.agrawal](https://community.auth0.com/u/dipesh.agrawal)\
**Post date:** [July 20, 2023, 7:54am UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/1 "2023-07-20T07:54:16Z")

</div>

Hello Team,  
Can we directly import/full load user data into Auth0 DB, from GCP Spanner database. As of now we can see only 512KB file we can import via import job API.

Can you please help if we can import bulk dataaround 12 lacs profile in Auth0

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 25, 2023, 4:18pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/3 "2023-07-25T16:18:35Z")

</div>

Hi @dipesh.agrawal,

Welcome to the Auth0 Community!

You will need to split the import into batches if it exceeds the stated limit (currently 500kb).

> [@dipesh.agrawal](#):
>
> Can you please help if we can import bulk dataaround 12 lacs profile in Auth0

What is “12 lacs profile”? Could you please provide an example?

---

<div class="post-metadata">

**Author:** ![dipesh.agrawal](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dipesh.agrawal](https://community.auth0.com/u/dipesh.agrawal)\
**Post date:** [July 26, 2023, 7:48am UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/4 "2023-07-26T07:48:24Z")

</div>

Thanks Dan for the reply but we have 12 lacs users profile data which is exists in cloud spanner database and now we need to migrate this data to Auth0. We have tried creating JSON and 1000 profile json size is around 500 KB file size. so its very difficult to create that much json file to import the data in AUth0

One more thing when we are trying to import the data in Auth0 using import APi we are getting below error.

{“statusCode”:400,“error”:“Bad Request”,“message”:“Users file must not be empty.”,“errorCode”:“operation\_not\_supported”}

Below is the code which we are using.

```auto
String fileName = "C:\\file\\profiledi.json";
		HttpResponse<String> response = Unirest.post(auth0_userImportapi).header("authorization", token)
				.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
				.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\""
						+ fileName
						+ "\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n")
				.asString();

```

Kindly suggest what wrong we are doing here.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 26, 2023, 1:03pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/5 "2023-07-26T13:03:32Z")

</div>

@dipesh.agrawal,

That request looks a bit odd. How did you find that code snippet?

Take a look at our code examples here: [Auth0 Management API v2](https://auth0.com/docs/api/management/v2/jobs/post-users-imports)

Also, can you please give an example of the user profile you are trying to import?

---

<div class="post-metadata">

**Author:** ![dipesh.agrawal](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dipesh.agrawal](https://community.auth0.com/u/dipesh.agrawal)\
**Post date:** [July 26, 2023, 1:17pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/6 "2023-07-26T13:17:44Z")

</div>

Hello Dan,

I was following the below api from document for import data in auth0.

```auto
HttpResponse<String> response = Unirest.post("https://dev-iam-kw.eu.auth0.com/api/v2/jobs/users-imports")
  .header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
  .header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"USERS_IMPORT_FILE.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n")
  .asString();

```

[https://auth0.com/docs/manage-users/user-migration/bulk-user-imports](https://auth0.com/docs/manage-users/user-migration/bulk-user-imports)

PFB the user profile json which i am trying to import.

```auto
[
{
		"user_id":"43a73ee3-8883-480d-8eba-7616a3b15f00",
		"family_name": "Dipesh",
        "given_name": "Agrawal",
        "email": "icapsmx866@mailinator.com",
        "email_verified": false,
		"created_at": "2016-12-05T11:16:59.640Z",
		"user_metadata": {
        "mobile": "1234567"
    },
        "custom_password_hash": {
            "algorithm": "sha512",
            "hash": {
                "value": "1a108e87ffea9a30c2ecf86fb26b8d95e62847da5d1dda6a4b97d11967cadd5d7c32ae8bde761a56854a55c7a601f172200d2d23be0310661d053aef6e158a0f",
                "encoding": "hex"
            },
            "salt": {
                "value": "2f0892fc14151ad92fc7f174bf0f48a7",
				"encoding": "hex",
                "position": "prefix"
            }
        }
    }
	]

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 26, 2023, 1:29pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/7 "2023-07-26T13:29:45Z")

</div>

You could try the explorer and see if it’s the file that is causing the error or the code snippet.

That code snippet looks a bit odd to me, I would use the one on the management API doc, or just build your own request.

---

<div class="post-metadata">

**Author:** ![dipesh.agrawal](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dipesh.agrawal](https://community.auth0.com/u/dipesh.agrawal)\
**Post date:** [July 26, 2023, 2:24pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/8 "2023-07-26T14:24:27Z")

</div>

ok Thanks Dan, I will try and let you know

---

<div class="post-metadata">

**Author:** ![dipesh.agrawal](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dipesh.agrawal](https://community.auth0.com/u/dipesh.agrawal)\
**Post date:** [July 27, 2023, 9:15am UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/9 "2023-07-27T09:15:03Z")

</div>

Hi Dan,

Thanks for the reply, I have tried and i am able to import the user in AUth0 . Thank you so much.

Regarding the bulk import as you told we can upload only 512 KB size file while doing import but as i told earlier we have around 12 lacs profile which we need to migrate to Auth0 and in 512 KB file we can add max 1000 users data so how we can achieve this. Kindly let us know.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 27, 2023, 1:19pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/10 "2023-07-27T13:19:10Z")

</div>

Apologies, what does “12 lacs” mean?

---

<div class="post-metadata">

**Author:** ![dipesh.agrawal](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dipesh.agrawal](https://community.auth0.com/u/dipesh.agrawal)\
**Post date:** [July 27, 2023, 3:12pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/11 "2023-07-27T15:12:51Z")

</div>

We are currently Live in KW market where already 12 lacs customer profile present in Cloud spanner database and now we need to migrate those customer in Auth0

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 27, 2023, 4:16pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/12 "2023-07-27T16:16:53Z")

</div>

What is the meaning of the word “12 lacs”?

---

<div class="post-metadata">

**Author:** ![dipesh.agrawal](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dipesh.agrawal](https://community.auth0.com/u/dipesh.agrawal)\
**Post date:** [July 28, 2023, 5:15am UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/13 "2023-07-28T05:15:03Z")

</div>

12 lacs means 12 lacs customers profile

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 28, 2023, 1:09pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/14 "2023-07-28T13:09:14Z")

</div>

@dipesh.agrawal,

I’m not sure what “lacs” are, is it an acronym for something?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 23, 2023, 2:40pm UTC](https://community.auth0.com/t/user-data-import-from-spanner-to-auth0/111652/15 "2023-08-23T14:40:47Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
