I am not new to Carto, but I'm new to the command line. I am able to import local files using this sample code Carto has in their documentation:

curl -v -F file=@/home/documentation/Documents/prism_tour.csv

I want to connect to and import from an existing PostGIS DB I have. Carto's documentation shows the following code:

  "connector": {
    "provider": "postgres",
    "connection": {
    "schema": "public",
    "table": "pgtable"

I have all the parameters needed. But 1. I don't know how to force lines without them executing. (everything is one line) For this reason, seems that the terminal is only running the first line and the error I get is " 'connector' is not recognized as an internal command.

Does this have anything to do with setting up environment variables?

And how do I type this on the command line so that it looks like a block of code like in the example?

2 Answers 2


This direct Postgres-level connection is Enterprise plan special feature, it is not generally available to anyone.

There are other options, have you considered to use one of these:

a) export data from your PostGIS to CSV (or geopackage, geojson or shapefile), and then use Import API

b) use ogr2ogr conversion, this is preferable for smaller datasets. Something like:

ogr2ogr --config CARTO_API_KEY abcdefghijklmnopqrstuvw -f Carto "Carto:myaccount" PG:"dbname='databasename' host='addr' port='5432' user='x' password='y'"
  • Thank you for your suggestion. I do have access to an enterprise account. Is this something for which I need to contact Carto to have it specifically "turned on"? Commented Oct 23, 2017 at 17:28
  • Yes, check with your enterprise support contact. I think even with this connection you wil not get ”live” data, but regular sync with given interval, for performance reasons. So functionally other options may be similar.
    – JaakL
    Commented Oct 24, 2017 at 6:28
  • @JaakL for enterprise account, the entire postgres database with the tables can be synced at one time?
    – ziggy
    Commented Dec 6, 2017 at 18:25
  • AFAIK with the conector you need some DDL for each table, but better check with offial support directly.
    – JaakL
    Commented Dec 6, 2017 at 18:47

I figured I should share what worked for me in the end. If anyone has a better solution, feel free to share it. But so far this works (seemingly) flawlessly.

I installed git bash, wrote the entire command as above in a text editor and pasted it at once into git bash. Note of advice, it's a lot more useful in the long run to modify the command to include an interval for the data to sync with the postgres DB.

If anyone has trouble with this method and hasn't found any other solution, feel free to reach out to me. I'm not an expert but I'm willing to try new alternatives and learn more.

  • can you post your entire command? I am in the same exact situation as you
    – ziggy
    Commented Mar 8, 2018 at 18:02
  • @ziggy curl -v -H "Content-Type: application/json" -d '{ "connector": {"provider": "postgres","connection": {"server": "MYSERVERNAME","database": "MYDBNAME", "username": "MYDB_USERNAME", "password": "MYDB_PASSWORD"}, "table" : "MYTABLE"}, "interval": 3600}' "https://CARTO_USERNAME.carto.com/api/v1/imports/?api_key=MYAPIKEY" Commented Mar 8, 2018 at 19:25
  • One useful tool you might want to check out is the Postman Google chrome extension-- it's a good GUI to use with APIs and it helped me a lot when I started pushing data to Carto through CURL. Commented Mar 8, 2018 at 19:28
  • okay I actually got mine to run but my table is empty... do any column names have to be named something specific?
    – ziggy
    Commented Mar 8, 2018 at 19:42
  • So the table imports, but only the headers show up with no rows? Commented Mar 8, 2018 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.