System & Admin APIs
These endpoints provide system-level functionality including server configuration, OAuth setup, and asynchronous task management.
System Configuration
Section titled “System Configuration”Get Server Configuration
Section titled “Get Server Configuration”Retrieve server configuration and feature flags.
Endpoint: GET /api/v1/server/config
Responses:
- 200: Success - Returns server configuration
Example Request:
curl -X GET \ https://app.terrateam.io/api/v1/server/configUse Cases:
- Detect available features for client applications
- Determine API version and capabilities
- Configure client behavior based on server settings
- Self-hosted instance configuration verification
Get GitHub Client ID
Section titled “Get GitHub Client ID”Retrieve the GitHub OAuth client ID for the Terrateam installation.
Endpoint: GET /api/v1/github/client_id
Responses:
- 200: Success - Returns client ID
- 403: Forbidden
Response Schema (200):
{ "client_id": "string"}Example Request:
curl -X GET \ https://app.terrateam.io/api/v1/github/client_idUse Cases:
- Implement custom OAuth flows
- Build third-party integrations
- Configure authentication in client applications
- Verify GitHub App configuration
Task Management
Section titled “Task Management”Get Task Status
Section titled “Get Task Status”Retrieve the status of an asynchronous task by ID.
Endpoint: GET /api/v1/tasks/{id}
Path Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The task identifier |
Responses:
- 200: Success - Returns task status
- 403: Forbidden
- 404: Not Found
Example Request:
curl -X GET \ https://app.terrateam.io/api/v1/tasks/{task_id} \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"Understanding Async Tasks:
Some operations in Terrateam run asynchronously to avoid blocking the API response. When you trigger such an operation, you receive a task ID that you can use to poll for completion status.
Common Async Operations:
- Repository refresh (
/repos/refreshendpoint returns task ID) - Large data imports or exports
- Bulk operations across multiple resources
Polling Pattern:
#!/bin/bashTASK_ID="task_id_from_async_operation"
while true; do STATUS=$(curl -s "https://app.terrateam.io/api/v1/tasks/$TASK_ID" \ -H "Authorization: Bearer $ACCESS_TOKEN")
echo "Task status: $STATUS"
# Check if task is complete (adjust based on actual response structure) if echo "$STATUS" | grep -q "completed"; then echo "Task completed!" break fi
sleep 5doneAuthentication
Section titled “Authentication”All endpoints (except /api/v1/github/client_id) require authentication using a short-lived access token:
Authorization: Bearer YOUR_ACCESS_TOKENTo get an access token:
- Create an API key in Settings > API Access in the Terrateam dashboard
- Call
POST /api/v1/access-token/refreshwith your API key to get an access token - Use the access token for API requests
See the Authentication guide for detailed instructions.