API Documentation (Scale+ Only)
Access your Dashtray data programmatically with our REST API.Overview
The Dashtray API allows Scale and Agency plan users to:- Fetch metrics and time series data
- Retrieve dashboard configurations
- Push custom metrics via webhooks
- Integrate with external tools and workflows
Base URL
Authentication
API Keys
- Navigate to Settings → API Keys
- Click Create API Key
- Give your key a descriptive name
- Copy the key (starts with
pp_) - Save it securely (you won’t see it again)
Using API Keys
Include your API key in theAuthorization header:
Example Request
Rate Limiting
- Limit: 1,000 requests per hour per project
- Headers: Rate limit info included in response headers
Rate Limit Exceeded
When limit is exceeded, you’ll receive:429 Too Many Requests
Endpoints
GET /metrics
Fetch metrics with optional filtering. Parameters:projectId(required): Your project IDmetricIds(optional): Comma-separated metric IDsstartDate(optional): ISO 8601 date (e.g.,2024-01-01T00:00:00Z)endDate(optional): ISO 8601 datelimit(optional): Results per page (default: 100, max: 1000)offset(optional): Pagination offset (default: 0)
200 OK: Success400 Bad Request: Invalid parameters401 Unauthorized: Invalid or missing API key403 Forbidden: Insufficient permissions429 Too Many Requests: Rate limit exceeded
GET /metrics/:metricId/timeseries
Fetch time series data for a specific metric. Parameters:projectId(required): Your project IDstartDate(required): ISO 8601 dateendDate(required): ISO 8601 dateinterval(optional):hour,day,week,month(default:day)
200 OK: Success400 Bad Request: Invalid parameters401 Unauthorized: Invalid or missing API key404 Not Found: Metric not found429 Too Many Requests: Rate limit exceeded
GET /dashboards
Fetch all dashboards for a project. Parameters:projectId(required): Your project ID
200 OK: Success401 Unauthorized: Invalid or missing API key429 Too Many Requests: Rate limit exceeded
GET /dashboards/:dashboardId
Fetch a specific dashboard with its widgets. Example Request:200 OK: Success401 Unauthorized: Invalid or missing API key404 Not Found: Dashboard not found429 Too Many Requests: Rate limit exceeded
POST /metrics/custom
Push custom metrics to Dashtray via webhook. Request Body:projectId(required): Your project IDmetricId(required): Unique identifier for your custom metricvalue(required): Numeric valuetimestamp(optional): Unix timestamp in milliseconds (defaults to now)unit(optional): Unit of measurement (e.g., “USD”, “count”)metadata(optional): Additional key-value pairs
201 Created: Success400 Bad Request: Invalid request body401 Unauthorized: Invalid or missing API key429 Too Many Requests: Rate limit exceeded
Error Responses
All errors follow this format:Common Error Codes
400 Bad Request:Code Examples
JavaScript/Node.js
Python
cURL
Best Practices
Security
- Never commit API keys: Use environment variables
- Rotate keys regularly: Create new keys periodically
- Use HTTPS only: Never send keys over HTTP
- Limit key scope: Create separate keys for different purposes
- Monitor usage: Check API key usage in Settings
Performance
- Cache responses: Cache data when appropriate
- Use pagination: Don’t fetch all data at once
- Batch requests: Combine multiple metric IDs in one request
- Respect rate limits: Implement exponential backoff
- Use webhooks: Push custom metrics instead of polling
Error Handling
- Check status codes: Handle different error types appropriately
- Implement retries: Retry failed requests with backoff
- Log errors: Track API errors for debugging
- Handle rate limits: Wait before retrying when rate limited
- Validate input: Check parameters before making requests
Webhooks for Custom Metrics
Use Cases
- Push metrics from internal systems
- Integrate with tools without native integrations
- Send real-time data to Dashtray
- Build custom data pipelines
Example: Sending Sales Data
FAQ
Q: How do I get my project ID? A: Go to Settings → General. Your project ID is displayed at the top. Q: Can I create API keys for specific dashboards? A: Not in the MVP. API keys have project-level access. Q: What’s the maximum request size? A: 1MB per request. Q: Can I delete metrics via API? A: No. Metrics are immutable. You can only create new metrics. Q: How long are metrics retained? A: Based on your plan (3 days for Free, unlimited for Pro+). Q: Can I use the API on the Pro plan? A: No. API access requires Scale or Agency plan. Q: Is there a sandbox environment? A: Not in the MVP. Test with a separate project. Q: Can I get real-time data? A: Data is as fresh as your sync frequency (every 30 minutes for Scale+).Need Help?
- Email: support@dashtray.com
- API Status: status.dashtray.com/api
- Community: Join our Discord for API discussions
- Report Issues: github.com/dashtray/api-issues