CARTO’s SQL API allows you to interact with your tables and data inside CARTO, as if you were running SQL statements against a normal database.
You can use the SQL API to insert, update or delete data, or to select data from public tables in order to use it on your website or application. To understand the fundamentals of SQL API, read the guides. To view the source code, browse the open-source repository in Github and contribute. Otherwise, read the full reference API, or find different support options.
Quick reference guides for learning how to use SQL API features.
Browse the interactive API documentation to search for specific SQL API methods, arguments, and sample code that can be used to build your applications.
Check Full Reference API1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Single SQL Statement
curl -X GET \
https://username.carto.com/api/v2/sql?q=SELECT count(*) FROM cities
# SQL Statement
curl -X POST -H "Content-Type: application/json" -d '{ \
"query": "SELECT count(*) FROM cities", \
"filename": "number_of_cities.json" \
}' "https://username.carto.com/api/v2/sql"
# Batch Queries
curl -X POST -H "Content-Type: application/json" -d '{ \
"query": "UPDATE nasdaq SET price = '$101.00' WHERE company = 'CARTO'", \
}' "https://username.carto.com/api/v2/sql/job"
Get help or learn about known issues.