API Getting Started
Tianji provides a complete REST API that allows you to programmatically access and operate all Tianji features. This guide will help you quickly get started with the Tianji API.
Overview
The Tianji API is based on REST architecture and uses JSON format for data exchange. All API requests must be made over HTTPS and require proper authentication.
API Base URL
https://your-tianji-domain.com/open
Supported Features
Through the Tianji API, you can:
- Manage website analytics data
- Create and manage monitoring projects
- Get server status information
- Manage surveys
- Operate telemetry data
- Create and manage workspaces
Quick Start
1. Get API Key
Before using the API, you need to obtain an API key:
- Log in to your Tianji instance
- Click on your avatar in the top right corner
- Find the API Keys section
- Click the + button to create a new API key
- Name your API key and save it
2. Enable OpenAPI
Make sure your Tianji instance has OpenAPI access enabled:
Set in your environment variables:
ALLOW_OPENAPI=true
3. First API Call
Test your API connection using curl:
curl -X GET "https://your-tianji-domain.com/open/global/config" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Next Steps
- Check the Authentication Documentation for detailed authentication methods
- Browse the API Reference Documentation for all available endpoints
- Use the OpenAPI SDK for type-safe API calls