{
  "openapi": "3.0.0",
  "info": {
    "title": "Pipecat Cloud",
    "version": "1.0.0",
    "description": "Private API for Pipecat Cloud agent management"
  },
  "servers": [
    {
      "url": "https://api.pipecat.daily.co/v1",
      "description": "API server"
    }
  ],
  "paths": {
    "/agents/{agentName}/logs": {
      "get": {
        "summary": "Get agent logs",
        "description": "Retrieves logs for the specified agent with optional filtering and pagination.",
        "operationId": "getLogs",
        "security": [
          {
            "PrivateKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agentName",
            "in": "path",
            "required": true,
            "description": "Name of the agent to retrieve logs for",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of log entries to return",
            "schema": {
              "type": "integer",
              "default": 10
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of log entries to skip",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "deploymentId",
            "in": "query",
            "required": false,
            "description": "Filter logs to a specific deployment ID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "query",
            "required": false,
            "description": "Filter logs to a specific session ID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Free-text search query to filter logs",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sort order for logs",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "startTime",
            "in": "query",
            "required": false,
            "description": "Filter logs to those after this Unix timestamp",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "endTime",
            "in": "query",
            "required": false,
            "description": "Filter logs to those before this Unix timestamp",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Agent logs retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "integer",
                          "description": "Total number of log entries matching the query"
                        },
                        "relation": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "gte"
                          ],
                          "description": "Relation type for the total count (eq = exact, gte = greater than or equal)"
                        }
                      }
                    },
                    "logs": {
                      "type": "array",
                      "description": "List of log entries",
                      "items": {
                        "type": "object",
                        "properties": {
                          "log": {
                            "type": "string",
                            "description": "Log message content"
                          },
                          "timestamp": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Timestamp when the log was generated"
                          },
                          "deploymentId": {
                            "type": "string",
                            "description": "ID of the deployment that generated the log",
                            "nullable": true
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "total": {
                    "value": 79,
                    "relation": "eq"
                  },
                  "logs": [
                    {
                      "log": "INFO:     Finished server process [1]",
                      "timestamp": "2025-04-18T20:34:17.153744602Z"
                    },
                    {
                      "log": "INFO:     Application shutdown complete.",
                      "timestamp": "2025-04-18T20:34:17.153706059Z"
                    },
                    {
                      "log": "INFO:     Waiting for application shutdown.",
                      "timestamp": "2025-04-18T20:34:17.153611029Z"
                    },
                    {
                      "log": "INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)",
                      "timestamp": "2025-04-18T20:32:42.246099974Z"
                    },
                    {
                      "log": "INFO:     Application startup complete.",
                      "timestamp": "2025-04-18T20:32:42.245760327Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Invalid timestamp format",
                  "code": "GENERIC_BAD_REQUEST"
                }
              }
            }
          },
          "404": {
            "description": "Agent not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Not found",
                  "code": "NOT_FOUND"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Internal server error",
                  "code": "INTERNAL_SERVER_ERROR"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PrivateKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authentication requires a Pipecat Cloud Private API token.\n\nGenerate a Private API key from your Dashboard (Settings > API Keys > Private > Create key) and include it as a Bearer token in the Authorization header."
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Error message"
          },
          "code": {
            "type": "string",
            "description": "Error code"
          }
        }
      }
    }
  },
  "security": [
    {
      "PrivateKeyAuth": []
    }
  ]
}