API Reference

Complete reference for the DataSentry API and integration options

Overview

The DataSentry API provides programmatic access to all DataSentry features, allowing you to integrate cost optimization, monitoring, and warehouse management directly into your workflows.

All API requests should be made to https://api.datasentry.siteand must include a valid API key in the Authorization header.

Authentication

To authenticate with the DataSentry API, include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

You can generate API keys from the Settings section of your DataSentry dashboard.

Rate Limits

The DataSentry API has the following rate limits:

  • 1000 requests per hour per API key
  • 10,000 requests per day per API key
  • 50 requests per second burst limit

Endpoints

GET /api/v1/warehouses

Retrieve a list of connected warehouses.

Parameters

limitinteger (optional) - Maximum number of results to return (default: 20, max: 100)
offsetinteger (optional) - Number of results to skip (default: 0)

Response

{
  "data": [
    {
      "id": "warehouse_123",
      "name": "Production Warehouse",
      "type": "snowflake",
      "status": "active",
      "connectionStatus": "connected",
      "cost": 1234.56,
      "currency": "USD",
      "lastUpdated": "2023-12-01T10:00:00Z"
    }
  ],
  "pagination": {
    "limit": 20,
    "offset": 0,
    "total": 1
  }
}

GET /api/v1/warehouses/{warehouseId}

Retrieve details for a specific warehouse.

Path Parameters

warehouseIdstring (required) - The unique identifier for the warehouse

Response

{
  "data": {
    "id": "warehouse_123",
    "name": "Production Warehouse",
    "type": "snowflake",
    "status": "active",
    "connectionStatus": "connected",
    "config": {
      "account": "xy12345.us-east-1",
      "warehouse": "COMPUTE_WH",
      "region": "us-east-1"
    },
    "cost": 1234.56,
    "currency": "USD",
    "usage": {
      "computeCredits": 45.67,
      "cloudServicesCredits": 12.34,
      "bytesBilled": 1073741824
    },
    "lastUpdated": "2023-12-01T10:00:00Z"
  }
}

POST /api/v1/warehouses/{warehouseId}/suspend

Suspend a warehouse to save costs.

Path Parameters

warehouseIdstring (required) - The unique identifier for the warehouse

Request Body

{
  "reason": "manual_suspension",
  "scheduledResume": "2023-12-01T14:00:00Z"
}

Response

{
  "success": true,
  "message": "Warehouse suspended successfully",
  "timestamp": "2023-12-01T10:00:00Z"
}

GET /api/v1/alerts

Retrieve a list of alerts for your warehouses.

Parameters

statusstring (optional) - Filter by status (open, closed, acknowledged)
typestring (optional) - Filter by alert type (cost, performance, security)
limitinteger (optional) - Maximum number of results to return (default: 20, max: 100)

Response

{
  "data": [
    {
      "id": "alert_456",
      "type": "cost",
      "severity": "high",
      "title": "Cost anomaly detected",
      "description": "Warehouse costs increased by 150% compared to previous week",
      "status": "open",
      "warehouseId": "warehouse_123",
      "timestamp": "2023-12-01T09:30:00Z",
      "costImpact": 500.00
    }
  ],
  "pagination": {
    "limit": 20,
    "offset": 0,
    "total": 1
  }
}

GET /api/v1/costs

Retrieve cost data for your warehouses.

Parameters

startDatestring (required) - Start date in YYYY-MM-DD format
endDatestring (required) - End date in YYYY-MM-DD format
groupBystring (optional) - Group results by (day, week, month, warehouse)

Response

{
  "data": [
    {
      "date": "2023-12-01",
      "totalCost": 123.45,
      "currency": "USD",
      "breakdown": {
        "compute": 89.01,
        "storage": 23.45,
        "network": 10.99
      },
      "warehouses": [
        {
          "id": "warehouse_123",
          "name": "Production Warehouse",
          "cost": 123.45
        }
      ]
    }
  ],
  "summary": {
    "total": 123.45,
    "currency": "USD",
    "period": "2023-12-01 to 2023-12-01"
  }
}

Error Handling

The DataSentry API uses standard HTTP status codes to indicate the success or failure of requests.

CodeMeaning
200OK - Request successful
201Created - Request successful, resource created
400Bad Request - Invalid request parameters
401Unauthorized - Invalid or missing API key
403Forbidden - Insufficient permissions
404Not Found - Resource does not exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error

SDKs & Libraries

JavaScript

Official JavaScript/Node.js SDK for DataSentry API integration.

npm install @datasentry/datasentry-sdk

Python

Official Python SDK for DataSentry API integration.

pip install datasentry-sdk

Go

Official Go SDK for DataSentry API integration.

go get github.com/datasentry/datasentry-go

Need Help?

If you have questions about the API or need assistance with integration, please visit oursupport page or contact us atsupp.datasentry.site.