Get started with the DataFast API
Use the DataFast API to programmatically interact with your analytics data, such as creating custom goals or retrieving visitor details.
1. Generate an API Key
Navigate to your Website's Settings > API tab in the DataFast dashboard. Generate a new API key. Copy the key immediately as it won't be shown again. Keep your API keys secure and treat them like passwords. Do not expose them in frontend code or public repositories.
2. Authenticate requests
All API requests must be authenticated using the Authorization
header with the Bearer scheme. Replace YOUR_API_KEY
with the key you generated.
Authorization: Bearer YOUR_API_KEY
3. Make API calls
The base URL for all v1 API endpoints is:
https://datafa.st/api/v1/
Here are some API use cases:
Successful requests return a 200 OK
status and a body like:
{
"status": "success",
"data": { ... } // Endpoint-specific data
}
Failed requests return an appropriate HTTP status code (4xx or 5xx) and a body like:
{
"status": "error",
"error": {
"code": HTTP_STATUS_CODE,
"message": "A descriptive error message"
}
}
Common error codes include:
400 Bad Request
: Invalid input or missing parameters.401 Unauthorized
: Missing or invalid API key.404 Not Found
: Resource not found (e.g., specific visitor).500 Internal Server Error
: Server-side issue.