# Issues with Import exported data via the Postman API

**URL:** <https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291>\
**Category:** Help Hub\
**Created:** [August 21, 2019, 8:54am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291 "2019-08-21T08:54:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaunc](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@shaunc](https://community.postman.com/u/shaunc)\
**Post date:** [August 21, 2019, 8:54am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/1 "2019-08-21T08:54:33Z")

</div>

I have been trying to use the “Import exported data” functionality with the API.  
[https://docs.api.getpostman.com/?version=latest#09886971-e1e2-4a62-8f59-f7abfd79ff5e](https://docs.api.getpostman.com/?version=latest#09886971-e1e2-4a62-8f59-f7abfd79ff5e)

I have followed the instructions but have been unable to get this working.  
I have used the examples in multiple languages but to no avail.

All requests with the expected parameters, hit the request timeout limit.  
If i purposefully remove a parameter, i get the expected error messages.

An example curl gives me the following:

```auto
curl --location --request POST "https://api.getpostman.com/import/exported?workspace={{workspaceId}}" \
  --header "x-api-key: {{postman_api_key}}" \
  --header "Content-Type: application/json" \
  --form "type=file" \
  --form "input=@" 

```

output:

````auto
* Trying 3.222.41.251...
* TCP_NODELAY set
* Connected to api.getpostman.com (3.222.41.251) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.postman.co
* Server certificate: Amazon
* Server certificate: Amazon Root CA 1
* Server certificate: Starfield Services Root Certificate Authority - G2
> POST /import/exported?workspace={{workspaceId}} HTTP/1.1
> Host: api.getpostman.com
> User-Agent: curl/7.54.0
> Accept: */*
> x-api-key: {{postman_api_key}}
> Content-Length: 673700
> Expect: 100-continue
> Content-Type: application/json; boundary=------------------------31c90a184cc5125b
>
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain; charset=utf-8
< Date: Wed, 21 Aug 2019 08:50:41 GMT
< ETag: W/"15-/6VXivhc2MKdLfIkLcUE47K6aH0"
< Server: nginx
< Content-Length: 21
< Connection: keep-alive
* HTTP error before end of send, stop sending
<
* Closing connection 0
Internal Server Error% ```

Thanks in advance.
````

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [August 21, 2019, 9:27am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/2 "2019-08-21T09:27:17Z")

</div>

Please be so kind and share the code that you are using and the exact error that you are getting.

How big is the file you are importing?

---

<div class="post-metadata">

**Author:** ![shaunc](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@shaunc](https://community.postman.com/u/shaunc)\
**Post date:** [August 21, 2019, 4:58pm UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/3 "2019-08-21T16:58:40Z")

</div>

Hi,

Thanks for the reply, as specified above here is the CURL i ran and the output.

```auto
curl --location --request POST "https://api.getpostman.com/import/exported?workspace={{workspaceId}}" \
  --header "x-api-key: {{postman_api_key}}" \
  --header "Content-Type: application/json" \
  --form "type=file" \
  --form "input=@" 

```

output:

```auto
* Trying 3.222.41.251...
* TCP_NODELAY set
* Connected to api.getpostman.com (3.222.41.251) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.postman.co
* Server certificate: Amazon
* Server certificate: Amazon Root CA 1
* Server certificate: Starfield Services Root Certificate Authority - G2
> POST /import/exported?workspace={{workspaceId}} HTTP/1.1
> Host: api.getpostman.com
> User-Agent: curl/7.54.0
> Accept: */*
> x-api-key: {{postman_api_key}}
> Content-Length: 673700
> Expect: 100-continue
> Content-Type: application/json; boundary=------------------------31c90a184cc5125b
>
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain; charset=utf-8
< Date: Wed, 21 Aug 2019 08:50:41 GMT
< ETag: W/"15-/6VXivhc2MKdLfIkLcUE47K6aH0"
< Server: nginx
< Content-Length: 21
< Connection: keep-alive
* HTTP error before end of send, stop sending
<
* Closing connection 0
Internal Server Error% 

```

I am also running the following in Ruby and also receive a timeout as the request just hangs.  
I have removed all the keys etc. from the code

````auto
require 'faraday'
require 'logger'
conn = Faraday.new('https://api.getpostman.com') do |f|
  f.request :multipart
  f.request :url_encoded
  f.response :logger, Logger.new(STDOUT), bodies: true
  f.adapter :net_http # This is what ended up making it work
end

payload = {"type" => "file", :input => Faraday::UploadIO.new('fileneame.zip', 'application/zip') }

headers = {"x-api-key" => "{{api_key}}"} 

resp = conn.post('/import/exported?workspace={{workspace_id}}', payload, headers)
puts resp ```

output: 

````

Net::ReadTimeout (Faraday::TimeoutError)```

If i run the Postman test collection for the API in the desktop app and remove all timeout limits, it also hangs and after a few minutes i receive:

```auto
<html>

<head>
	<title>504 Gateway Time-out</title>
</head>

<body bgcolor="white">
	<center>
		<h1>504 Gateway Time-out</h1>
	</center>
	<hr>
	<center>nginx</center>
</body>

</html>

```

Also the file is 674kb.

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [August 23, 2019, 7:09am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/4 "2019-08-23T07:09:02Z")

</div>

It looks that you are uploading a zip file, but I think Postman expects a JSON file.

It should be the file that you have manually dumped: Backup.postman\_dump.json

---

<div class="post-metadata">

**Author:** ![shaunc](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@shaunc](https://community.postman.com/u/shaunc)\
**Post date:** [August 23, 2019, 7:44am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/5 "2019-08-23T07:44:56Z")

</div>

I have just tried that and i receive an error.

```auto
{
    "error": {
        "name": "malformedRequestError",
        "message": "The request body has invalid data as input. Input a valid zip file containing archive.json and a folder with Postman collections",
        "details": {
            "param": "input"
        }
    }
}

```

When following the documentation it asks you to download your data / export from the following URL.

[https://go.postman.co/me/export](https://go.postman.co/me/export)

[https://docs.api.getpostman.com/?version=latest#46e97f24-cfd7-4547-bf83-244002931314](https://docs.api.getpostman.com/?version=latest#46e97f24-cfd7-4547-bf83-244002931314)

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [August 23, 2019, 7:51am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/6 "2019-08-23T07:51:19Z")

</div>

Ok, my bad.

It needs to be a zip file with the following:

- archive.json with a contents like this:

- folder called collection with files like this:  
00c9f952-916a-4c15-9f02-aac109e4cd9e.json

Can you confirm you have something similar?

---

<div class="post-metadata">

**Author:** ![shaunc](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@shaunc](https://community.postman.com/u/shaunc)\
**Post date:** [August 23, 2019, 8:02am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/7 "2019-08-23T08:02:36Z")

</div>

I do have that file, i have checked that the format is ok and that it matches what you have suggested. I have exported numerous files and they all seem to have the correct format.

It is rather odd.

---

<div class="post-metadata">

**Author:** ![shaunc](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@shaunc](https://community.postman.com/u/shaunc)\
**Post date:** [September 9, 2019, 10:06am UTC](https://community.postman.com/t/issues-with-import-exported-data-via-the-postman-api/7291/8 "2019-09-09T10:06:47Z")

</div>

This has been raised as a bug: [https://github.com/postmanlabs/postman-app-support/issues/7257](https://github.com/postmanlabs/postman-app-support/issues/7257)
