{
    "schemes": ["https"],
    "swagger": "2.0",
    "info": {
        "description": "Daytona Analytics API - Read-only telemetry and usage data. Authenticated via Daytona API keys or JWT tokens.",
        "title": "Daytona Analytics API",
        "contact": {},
        "version": "v0.4.0"
    },
    "host": "analytics.app.daytona.io",
    "basePath": "/",
    "paths": {
        "/organization/{organizationId}/sandbox/{sandboxId}/telemetry/logs": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns paginated log entries with optional severity and search filters",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Telemetry"
                ],
                "summary": "Get sandbox logs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Sandbox ID",
                        "name": "sandboxId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start time (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End time (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Comma-separated severity levels",
                        "name": "severity",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Search text (ILIKE)",
                        "name": "search",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 100,
                        "description": "Page size",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 0,
                        "description": "Offset",
                        "name": "offset",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.LogEntry"
                            }
                        }
                    }
                }
            }
        },
        "/organization/{organizationId}/sandbox/{sandboxId}/telemetry/metrics": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns gauge metrics aggregated in 1-minute intervals",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Telemetry"
                ],
                "summary": "Get sandbox metrics",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Sandbox ID",
                        "name": "sandboxId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start time (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End time (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Comma-separated metric names",
                        "name": "metricNames",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.MetricPoint"
                            }
                        }
                    }
                }
            }
        },
        "/organization/{organizationId}/sandbox/{sandboxId}/telemetry/traces": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns paginated trace summaries with span counts and root span info",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Telemetry"
                ],
                "summary": "Get sandbox traces",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Sandbox ID",
                        "name": "sandboxId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start time (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End time (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 100,
                        "description": "Page size",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 0,
                        "description": "Offset",
                        "name": "offset",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.TraceSummary"
                            }
                        }
                    }
                }
            }
        },
        "/organization/{organizationId}/sandbox/{sandboxId}/telemetry/traces/{traceId}": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns all spans belonging to a specific trace ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Telemetry"
                ],
                "summary": "Get trace spans",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Sandbox ID",
                        "name": "sandboxId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Trace ID",
                        "name": "traceId",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.Span"
                            }
                        }
                    }
                }
            }
        },
        "/organization/{organizationId}/sandbox/{sandboxId}/usage": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns individual usage records for a specific sandbox within a time range",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Usage"
                ],
                "summary": "Get sandbox usage periods",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Sandbox ID",
                        "name": "sandboxId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start time (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End time (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.UsagePeriod"
                            }
                        }
                    }
                }
            }
        },
        "/organization/{organizationId}/usage/aggregated": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns organization-level resource usage totals for a given time period",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Usage"
                ],
                "summary": "Get aggregated usage",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start time (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End time (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/models.AggregatedUsage"
                        }
                    }
                }
            }
        },
        "/organization/{organizationId}/usage/chart": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns resource usage data points for a given time period with auto-scaled resolution",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Usage"
                ],
                "summary": "Get usage chart data",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start time (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End time (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Region filter",
                        "name": "region",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.UsageChartPoint"
                            }
                        }
                    }
                }
            }
        },
        "/organization/{organizationId}/usage/sandbox": {
            "get": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Returns resource usage aggregated per sandbox for a given time period",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Usage"
                ],
                "summary": "Get per-sandbox usage",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "organizationId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start time (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End time (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.SandboxUsage"
                            }
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "models.AggregatedUsage": {
            "type": "object",
            "properties": {
                "firstStart": {
                    "type": "string"
                },
                "lastEnd": {
                    "type": "string"
                },
                "sandboxCount": {
                    "type": "integer"
                },
                "totalCPUSeconds": {
                    "type": "integer"
                },
                "totalDiskGBSeconds": {
                    "type": "integer"
                },
                "totalGPUSeconds": {
                    "type": "integer"
                },
                "totalPrice": {
                    "type": "number"
                },
                "totalRAMGBSeconds": {
                    "type": "integer"
                }
            }
        },
        "models.LogEntry": {
            "type": "object",
            "properties": {
                "body": {
                    "type": "string"
                },
                "logAttributes": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "resourceAttributes": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "serviceName": {
                    "type": "string"
                },
                "severityNumber": {
                    "type": "integer"
                },
                "severityText": {
                    "type": "string"
                },
                "spanId": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "traceId": {
                    "type": "string"
                }
            }
        },
        "models.MetricPoint": {
            "type": "object",
            "properties": {
                "metricName": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "value": {
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "models.SandboxUsage": {
            "type": "object",
            "properties": {
                "firstStart": {
                    "type": "string"
                },
                "lastEnd": {
                    "type": "string"
                },
                "sandboxId": {
                    "type": "string"
                },
                "totalCPUSeconds": {
                    "type": "integer"
                },
                "totalDiskGBSeconds": {
                    "type": "integer"
                },
                "totalGPUSeconds": {
                    "type": "integer"
                },
                "totalPrice": {
                    "type": "number"
                },
                "totalRAMGBSeconds": {
                    "type": "integer"
                }
            }
        },
        "models.Span": {
            "type": "object",
            "properties": {
                "durationMs": {
                    "type": "number"
                },
                "parentSpanId": {
                    "type": "string"
                },
                "spanAttributes": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "spanId": {
                    "type": "string"
                },
                "spanName": {
                    "type": "string"
                },
                "statusCode": {
                    "type": "string"
                },
                "statusMessage": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "traceId": {
                    "type": "string"
                }
            }
        },
        "models.TraceSummary": {
            "type": "object",
            "properties": {
                "endTime": {
                    "type": "string"
                },
                "rootSpanName": {
                    "type": "string"
                },
                "spanCount": {
                    "type": "integer"
                },
                "startTime": {
                    "type": "string"
                },
                "statusCode": {
                    "type": "string"
                },
                "totalDurationMs": {
                    "type": "number"
                },
                "traceId": {
                    "type": "string"
                }
            }
        },
        "models.UsageChartPoint": {
            "type": "object",
            "properties": {
                "cpu": {
                    "type": "integer"
                },
                "cpuPrice": {
                    "type": "number"
                },
                "diskGB": {
                    "type": "integer"
                },
                "diskPrice": {
                    "type": "number"
                },
                "ramGB": {
                    "type": "integer"
                },
                "ramPrice": {
                    "type": "number"
                },
                "time": {
                    "type": "string"
                }
            }
        },
        "models.UsagePeriod": {
            "type": "object",
            "properties": {
                "cpu": {
                    "type": "integer"
                },
                "diskGB": {
                    "type": "integer"
                },
                "endAt": {
                    "type": "string"
                },
                "gpu": {
                    "type": "integer"
                },
                "price": {
                    "type": "number"
                },
                "ramGB": {
                    "type": "integer"
                },
                "startAt": {
                    "type": "string"
                }
            }
        }
    },
    "securityDefinitions": {
        "Bearer": {
            "description": "JWT token or Admin API key. Format: \"Bearer {token}\"",
            "type": "apiKey",
            "name": "Authorization",
            "in": "header"
        }
    }
}