Interact with your tables and data inside CARTO, as if you were running SQL statements.

This component is still under support but it will not be further developed. We don’t recommend starting new projects with it as it will eventually become deprecated. Instead, learn more about our new APIs here

Introduction

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. The database behind CARTO is PostgreSQL so if you need help with specific SQL statements or you want to learn more about it, visit the official documentation.

There are two main situations in which you would want to use the SQL API:

  • You want to insert, update or delete data. For example, you would like to insert a new column with a latitude and longitude data.

  • You want to select data from public tables in order to use it on your website or in your app. For example, you need to find the 10 closest records to a particular location.

Remember that in order to access, read or modify data in private tables, you will need to authenticate your requests. When a table is public, you can do non-authenticated queries that read data, but you cannot write or modify data without authentication.