Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.datazone.co/llms.txt

Use this file to discover all available pages before exploring further.

Endpoints Cover

Overview

Endpoints allow you to create custom API interfaces with secure, controlled access. You can define three types of endpoints:
  1. Query Endpoints - Execute SQL queries on your datasets with dynamic filters
  2. Action Endpoints - Execute serverless Python functions for custom logic
  3. Vector Endpoints - Perform semantic similarity search on vectorized data
Endpoint Detail

Creating Endpoints

  1. Navigate to your Project
  2. Create a new YAML file for your endpoint (e.g., api-orders.yaml)
  3. Define your endpoint configuration
  4. Reference it in your config.yaml file
Create Endpoint Step 1
Create Endpoint Step 2

Endpoint Types

Query-Based Endpoints

Query endpoints execute SQL queries on your data with dynamic filtering using Jinja templating. Example YAML Configuration:
endpoints:
  - name: consolidated-sales-endpoint
    type: query
    config:
      filters:
        - name: country
          type: string
          optional: true
        - name: city
          type: string
          optional: true
      query: |
          SELECT *
          FROM consolidated_sales_df_299ceb
          WHERE 1 = 1
          {% if country is defined %}
          AND CustomerCountry = '{{ country }}'
          {% endif %}
          {% if city is defined %}
          AND CustomerCity = '{{ city }}'
          {% endif %}

Action-Based Endpoints

Action endpoints execute serverless Python functions when called. Perfect for sending notifications, processing data, calling external APIs, or automating workflows. Example YAML Configuration:
endpoints:
  - name: process-data-endpoint
    type: action
    config:
      action_id: "507f1f77bcf86cd799439011"
The action_id references an action function in your project. Get the ID from your action details page.

Vector-Based Endpoints

Vector endpoints enable semantic similarity search on your vectorized data via HTTP API. Perfect for building search features, recommendation systems, or RAG applications. Example YAML Configuration:
endpoints:
  - name: document-search-endpoint
    type: vector
    config:
      vector_id: "69d597a6e9713d78370a50d9"
The vector_id references a Vector in your project. Get the ID from your vector details page.

Register in config.yaml

Reference your endpoint file in config.yaml:
project_name: TestProject
project_id: 688b3d0b7c5f93f0763a028c
endpoints:
  - path: api-orders.yaml
Learn more about the configuration file in the Project Configuration section.

Configuration Reference

Common Attributes

AttributeTypeRequiredDescription
namestringYesUnique endpoint identifier
typestringYesEndpoint type: query, action, or vector
configobjectYesType-specific configuration

Query Config Attributes

AttributeTypeRequiredDescription
querystringYesSQL query with Jinja templating
filtersarrayNoList of filter parameters

Action Config Attributes

AttributeTypeRequiredDescription
action_idstringYesAction function ID to execute

Vector Config Attributes

AttributeTypeRequiredDescription
vector_idstringYesVector ID for similarity search

Filter Configuration

Filters are only for query endpoints and define dynamic parameters:
AttributeTypeRequiredDescription
namestringYesFilter parameter name (alphanumeric, -, _)
typestringYesData type (see types below)
optionalbooleanNoWhether filter is optional (default: true)

Filter Types

TypeDescriptionExample Usage
stringText parametercountry, category
integerNumeric parameteryear, limit
floatDecimal parameterprice, rating
dateDate parameterstart_date, end_date
datetimeDateTime parametercreated_at, updated_at
booleanBoolean parameteractive, is_featured
enumEnumeration parameterstatus, priority

Using Endpoints

Endpoints are accessible via HTTP requests. Query and vector endpoints use GET requests, while action endpoints may vary based on implementation:
curl -X GET \
  "https://app.datazone.co/api/v1/endpoint/your-endpoint-name?param1=value1&param2=value2" \
  -H "x-api-key: <DATAZONE_API_KEY>" \
  -H "Content-Type: application/json"

Response Format

Query Endpoint Response

Query endpoints return JSON data with query results:
{
  "records": [
    {
      "column1": "value1",
      "column2": "value2"
    }
  ],
  "metadata": {
    "total_records": 100,
    "query_time_ms": 250,
    "endpoint_name": "consolidated-sales-endpoint"
  }
}

Action Endpoint Response

Action endpoints return execution results:
{
  "status": "success",
  "execution_id": "65f3a2b8c4e1a9d0c8b4e7f3",
  "message": "Action executed successfully",
  "metadata": {
    "action_id": "507f1f77bcf86cd799439011",
    "endpoint_name": "process-data-endpoint",
    "triggered_at": "2026-01-20T10:30:00Z"
  }
}

Vector Endpoint Response

Vector endpoints return semantically similar results based on your search query:
{
  "results": [
    {
      "content": "Relevant text chunk from your data...",
      "metadata": {
        "source": "document.pdf",
        "page": 5,
        "chunk_id": "abc123"
      },
      "score": 0.92
    },
    {
      "content": "Another relevant text chunk...",
      "metadata": {
        "source": "report.docx",
        "section": "Introduction"
      },
      "score": 0.87
    }
  ],
  "metadata": {
    "vector_id": "69d597a6e9713d78370a50d9",
    "endpoint_name": "document-search-endpoint",
    "query": "what is the company revenue?",
    "total_results": 10
  }
}
Using Vector Endpoints:
curl -X GET \
  "https://app.datazone.co/api/v1/endpoint/document-search-endpoint?query=what+is+the+company+revenue" \
  -H "x-api-key: <DATAZONE_API_KEY>" \
  -H "Content-Type: application/json"
Query Parameters for Vector Endpoints:
ParameterTypeRequiredDescription
querystringYesSearch query in natural language

Authentication

Endpoints use API key authentication via the x-api-key header:
-H "x-api-key: YOUR_API_KEY"

Error Responses

Status CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
403Forbidden - Access denied
404Not Found - Endpoint doesn’t exist
500Internal Server Error
Example error response:
{
  "error": "Invalid parameter 'country': must be a string",
  "code": "INVALID_PARAMETER",
  "status": 400
}

Advanced Query Features

Jinja Templating

Endpoints support Jinja templating for dynamic queries:
query: |
    SELECT *
    FROM sales_data
    WHERE 1 = 1
    {% if start_date is defined %}
    AND order_date >= '{{ start_date }}'
    {% endif %}
    {% if end_date is defined %}
    AND order_date <= '{{ end_date }}'
    {% endif %}
    {% if categories is defined %}
    AND category IN ({{ categories | join("','") | surround("'") }})
    {% endif %}

Caching

Endpoint responses can be cached:
  • Default cache TTL: 60 minutes
  • Cache headers indicate freshness
  • Use cache-busting parameters when needed