com um clique
basic-dremio-rest-api
// Enables an AI agent to authenticate with and make curl requests to the Dremio REST API for both Dremio Software and Dremio Cloud.
// Enables an AI agent to authenticate with and make curl requests to the Dremio REST API for both Dremio Software and Dremio Cloud.
[HINT] Baixe o diretório completo da skill incluindo SKILL.md e todos os arquivos relacionados
| name | Basic Dremio REST API |
| description | Enables an AI agent to authenticate with and make curl requests to the Dremio REST API for both Dremio Software and Dremio Cloud. |
This skill equips you to interact with Dremio's REST API via curl. It covers authentication, environment variable configuration, and provides direct links to the official API reference so you can look up exact request/response formats.
Before making any API calls, ask the user to provide the following environment variables. Explain what each one is for, and confirm whether they are using Dremio Software (self-hosted) or Dremio Cloud.
| Variable | Description |
|---|---|
DREMIO_URL | Base URL of the Dremio instance (e.g. http://localhost:9047 or https://dremio.example.com) |
DREMIO_PAT | A Personal Access Token (PAT) created in the Dremio UI or via the API |
DREMIO_USERNAME | (Optional — only if using username/password auth instead of a PAT) |
DREMIO_PASSWORD | (Optional — only if using username/password auth instead of a PAT) |
| Variable | Description |
|---|---|
DREMIO_CLOUD_PROJECT_ID | The Project ID (UUID) from the Dremio Cloud console |
DREMIO_PAT | A Personal Access Token (PAT) created in the Dremio Cloud UI |
DREMIO_CLOUD_REGION | (Optional) Set to EU if using the EU control plane. Defaults to US. |
Prompt the user: "To interact with Dremio's REST API, I'll need some credentials set as environment variables. Are you using Dremio Software (self-hosted) or Dremio Cloud? And can you provide a Personal Access Token (PAT)?"
All API v3 requests use Bearer token authentication:
curl -X GET "${DREMIO_URL}/api/v3/catalog" \
--header "Authorization: Bearer ${DREMIO_PAT}" \
--header "Content-Type: application/json"
If the user cannot provide a PAT, you can generate a short-lived authentication token (valid for 30 hours) via the v2 login endpoint:
# Step 1: Obtain a token
TOKEN=$(curl -s -X POST "${DREMIO_URL}/apiv2/login" \
--header "Content-Type: application/json" \
--data-raw "{\"userName\": \"${DREMIO_USERNAME}\", \"password\": \"${DREMIO_PASSWORD}\"}" \
| jq -r '.token')
# Step 2: Use the token (prepend _dremio prefix)
curl -X GET "${DREMIO_URL}/api/v3/catalog" \
--header "Authorization: _dremio${TOKEN}" \
--header "Content-Type: application/json"
Note: The
_dremioprefix is required when using authentication tokens obtained from the login endpoint. PATs use the standardBearerprefix instead.
Dremio Cloud uses https://api.dremio.cloud (US) or https://api.eu.dremio.cloud (EU) as the base URL, and API version v0. Most endpoints require the Project ID in the path:
# Determine base URL
if [ "${DREMIO_CLOUD_REGION}" = "EU" ]; then
BASE_URL="https://api.eu.dremio.cloud"
else
BASE_URL="https://api.dremio.cloud"
fi
# Example: List catalog
curl -X GET "${BASE_URL}/v0/projects/${DREMIO_CLOUD_PROJECT_ID}/catalog" \
--header "Authorization: Bearer ${DREMIO_PAT}" \
--header "Content-Type: application/json"
| Edition | Base URL | API Version |
|---|---|---|
| Dremio Software | {DREMIO_URL}/api/v3 | v3 |
| Dremio Cloud (US) | https://api.dremio.cloud/v0 | v0 |
| Dremio Cloud (EU) | https://api.eu.dremio.cloud/v0 | v0 |
For Dremio Cloud, most resource endpoints are scoped under
/v0/projects/{projectId}/.
# Dremio Software
curl -X POST "${DREMIO_URL}/api/v3/sql" \
--header "Authorization: Bearer ${DREMIO_PAT}" \
--header "Content-Type: application/json" \
--data '{"sql": "SELECT * FROM my_table LIMIT 10"}'
The response returns a jobId — use it with the Job API to poll status and retrieve results.
curl -X GET "${DREMIO_URL}/api/v3/job/${JOB_ID}" \
--header "Authorization: Bearer ${DREMIO_PAT}" \
--header "Content-Type: application/json"
curl -X GET "${DREMIO_URL}/api/v3/job/${JOB_ID}/results" \
--header "Authorization: Bearer ${DREMIO_PAT}" \
--header "Content-Type: application/json"
curl -X GET "${DREMIO_URL}/api/v3/catalog" \
--header "Authorization: Bearer ${DREMIO_PAT}" \
--header "Content-Type: application/json"
When you need the exact request/response schema for a specific operation, read the relevant documentation page using your URL reading capabilities. Here are the key sections:
| Resource | Documentation URL |
|---|---|
| API Overview & Auth | https://docs.dremio.com/current/reference/api/ |
| Catalog | https://docs.dremio.com/current/reference/api/catalog/ |
| SQL (Submit Queries) | https://docs.dremio.com/current/reference/api/sql/ |
| Job | https://docs.dremio.com/current/reference/api/job/ |
| Reflections | https://docs.dremio.com/current/reference/api/reflections/ |
| Source | https://docs.dremio.com/current/reference/api/source/ |
| User | https://docs.dremio.com/current/reference/api/user/ |
| Role | https://docs.dremio.com/current/reference/api/role/ |
| Votes (Wiki/Labels) | https://docs.dremio.com/current/reference/api/votes/ |
| Personal Access Token | https://docs.dremio.com/current/reference/api/personal-access-token/ |
| OAuth Token | https://docs.dremio.com/current/reference/api/oauth-token/ |
| Resource | Documentation URL |
|---|---|
| API Overview & Auth | https://docs.dremio.com/cloud/reference/api/ |
| Catalog | https://docs.dremio.com/cloud/reference/api/catalog/ |
| SQL (Submit Queries) | https://docs.dremio.com/cloud/reference/api/sql/ |
| Job | https://docs.dremio.com/cloud/reference/api/job/ |
| Reflections | https://docs.dremio.com/cloud/reference/api/reflections/ |
| Source | https://docs.dremio.com/cloud/reference/api/source/ |
| Project | https://docs.dremio.com/cloud/reference/api/project/ |
| Cloud Roles (RBAC) | https://docs.dremio.com/cloud/reference/api/role/ |
| Personal Access Token | https://docs.dremio.com/cloud/reference/api/personal-access-tokens/ |
When the user asks you to interact with Dremio, follow this sequence:
export DREMIO_PAT="..." etc.jq to extract fields from JSON responses when needed.jq for parsing JSON responses (e.g., extracting jobId from SQL submission responses).v0, not v3. Don't mix them up.Bearer ${DREMIO_PAT} as the auth header value. When using a login token on Software, use _dremio${TOKEN} (no space, no "Bearer" prefix).