# Data sources

## About data sources

Now that you have created a [connection](/carto-for-developers/key-concepts/connections.md) to your Data Warehouse in CARTO, you can start using them to access their data within your code. The way your application accesses data from your CARTO connections is by using **Data sources.**

A data source in CARTO for Developers defines the data that will be accessed by your application, the credentials (connection) that will be used to retrieve it, and additional parameters to control the data fetching process. Data sources are typically imported from `@carto/api-client` .

```typescript
import {vectorTableSource} from '@carto/api-client'

const data = vectorTableSource({
  accessToken: 'XXX',
  connectionName: 'carto_dw',
  tableName: 'carto-demo-data.demo_tables.chicago_crime_sample'
});
```

## Types of data sources

There are several types of data sources, with specific parameters depending on the data type (vector, spatial indexes, raster or boundaries) and the resource type (table, query or tileset):

**Vector data:** points, lines or polygons.

* [`vectorTableSource`](/carto-for-developers/reference/data-sources/vectortablesource.md)
* [`vectorQuerySource`](/carto-for-developers/reference/data-sources/vectorquerysource.md)
* [`vectorTilesetSource`](/carto-for-developers/reference/data-sources/vectortilesetsource.md)

**Spatial index data:** data aggregated in H3 or Quadbin spatial indexes.

* [`h3TableSource`](/carto-for-developers/reference/data-sources/h3tablesource.md)
* [`h3QuerySource`](/carto-for-developers/reference/data-sources/h3querysource.md)
* [`h3TilesetSource`](/carto-for-developers/reference/data-sources/h3tilesetsource.md)
* [`quadbinTableSource`](/carto-for-developers/reference/data-sources/quadbintablesource.md)
* [`quadbinQuerySource`](/carto-for-developers/reference/data-sources/quadbinquerysource.md)
* [`quadbinTilesetSource`](/carto-for-developers/reference/data-sources/quadbintilesetsource.md)

**Raster data:** pixels covering a specific area.

* [`rasterSource`](/carto-for-developers/reference/data-sources/rastersource.md)

**Boundaries data:** properties (point-based vector data) aggregated in a set of static boundaries (polygons).

* [`boundaryTableSource`](/carto-for-developers/reference/data-sources/boundarytablesource.md)
* [`boundaryQuerySource`](/carto-for-developers/reference/data-sources/boundaryquerysource.md)

## Using data sources

Once you've added data sources in your application, the next step is to reference them in your [CARTO + deck.gl layers](https://github.com/CartoDB/gitbook-documentation/blob/master/carto-for-developers/key-concepts/carto-for-deck.gl) to visualize data in your map, or use them to build custom [charts and widgets](/carto-for-developers/key-concepts/charts-and-widgets.md).

## Technical reference

Learn all the technical details in our [Data Sources reference](/carto-for-developers/reference/data-sources.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carto.com/carto-for-developers/key-concepts/data-sources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
