---
title: Query API Reference
meta:
    description: The Query API allows you to query your Pipes inside Tinybird as if you were running SQL statements against a regular database.
headingMaxLevels: 2
---

# Query API

{% snippet title="api-region-reminder" /%}

The Query API allows you to query your Pipes and Data Sources inside {% $NAME %} as if you were running SQL statements against a standard database.

```shell {% title="Using the Query API" %}
curl \
    -H "Authorization: Bearer <PIPE:READ token>" \
    --data "q=SELECT * FROM <pipe> FORMAT JSON" \
    {% user("apiHost") %}/v0/sql
# or 
curl \
    -H "Authorization: Bearer <PIPE:READ token>" \
    --data "q=select count() from _" \
    {% user("apiHost") %}/v0/pipes/<pipe>.json
```

{% callout %}
Every resource in {% $NAME %} is secured so to use the Query API you must provide a [Token](/api-reference/token-api) with Pipe read permissions.
{% /callout %}

{% api_reference api="query" /%}