# List log drains (/docs/api/logs/drains_list)

Log drains with their target, filter, batching and delivery health. Credentials are never returned.

`GET /v1/drains`

```json
{
  "operationId": "drains_list",
  "summary": "List log drains",
  "description": "Log drains with their target, filter, batching and delivery health. Credentials are never returned.",
  "tags": [
    "drains"
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "log_drain"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "pattern": "^drn_[a-z0-9]{8,32}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "config": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "webhook"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2000,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "type",
                            "url"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "axiom"
                              ]
                            },
                            "dataset": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_.-]{1,128}$"
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2000,
                              "format": "uri",
                              "default": "https://api.axiom.co"
                            }
                          },
                          "required": [
                            "type",
                            "dataset"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "datadog"
                              ]
                            },
                            "site": {
                              "type": "string",
                              "enum": [
                                "datadoghq.com",
                                "us3.datadoghq.com",
                                "us5.datadoghq.com",
                                "datadoghq.eu",
                                "ap1.datadoghq.com",
                                "ddog-gov.com"
                              ],
                              "default": "datadoghq.com"
                            },
                            "service": {
                              "type": "string",
                              "pattern": "^[a-z0-9_.-]{1,64}$",
                              "default": "gridrouter"
                            },
                            "tags": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_.:,/-]{0,200}$",
                              "default": ""
                            }
                          },
                          "required": [
                            "type"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "s3"
                              ]
                            },
                            "bucket": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$"
                            },
                            "region": {
                              "type": "string",
                              "pattern": "^[a-z0-9-]{2,32}$"
                            },
                            "endpoint": {
                              "type": "string",
                              "maxLength": 2000,
                              "format": "uri"
                            },
                            "prefix": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[A-Za-z0-9_./=-]*$",
                              "default": "gridrouter/logs/"
                            },
                            "format": {
                              "type": "string",
                              "enum": [
                                "ndjson",
                                "ndjson_gzip"
                              ],
                              "default": "ndjson_gzip"
                            }
                          },
                          "required": [
                            "type",
                            "bucket",
                            "region"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "gcs"
                              ]
                            },
                            "bucket": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$"
                            },
                            "prefix": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[A-Za-z0-9_./=-]*$",
                              "default": "gridrouter/logs/"
                            },
                            "format": {
                              "type": "string",
                              "enum": [
                                "ndjson",
                                "ndjson_gzip"
                              ],
                              "default": "ndjson_gzip"
                            }
                          },
                          "required": [
                            "type",
                            "bucket"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "r2"
                              ]
                            },
                            "bucket": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$"
                            },
                            "account_id": {
                              "type": "string",
                              "pattern": "^[a-f0-9]{32}$"
                            },
                            "jurisdiction": {
                              "type": "string",
                              "enum": [
                                "default",
                                "eu",
                                "fedramp"
                              ],
                              "default": "default"
                            },
                            "prefix": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[A-Za-z0-9_./=-]*$",
                              "default": "gridrouter/logs/"
                            },
                            "format": {
                              "type": "string",
                              "enum": [
                                "ndjson",
                                "ndjson_gzip"
                              ],
                              "default": "ndjson_gzip"
                            }
                          },
                          "required": [
                            "type",
                            "bucket",
                            "account_id"
                          ]
                        }
                      ]
                    },
                    "filter": {
                      "type": "object",
                      "properties": {
                        "kinds": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "call",
                                  "run",
                                  "job",
                                  "list",
                                  "alert"
                                ]
                              },
                              "maxItems": 5
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ],
                          "description": "Event kinds (default: all)"
                        },
                        "provider": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "capability": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "endpoint_id": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "key_id": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "app_id": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "mode": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "client_mode": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "sync",
                                  "wait",
                                  "async",
                                  "batch",
                                  "list",
                                  "mcp"
                                ]
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "supply_mode": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "byok",
                                  "managed",
                                  "connected"
                                ]
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "credential": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "managed",
                                  "byok",
                                  "none"
                                ]
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "status": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "hit",
                                  "miss",
                                  "failed",
                                  "error"
                                ]
                              },
                              "maxItems": 4
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ],
                          "description": "hit, miss, failed (or error)"
                        },
                        "http_status": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "integer",
                                "minimum": 100,
                                "maximum": 599
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "error_code": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
                              },
                              "maxItems": 25
                            },
                            {
                              "type": "string",
                              "maxLength": 4000
                            }
                          ]
                        },
                        "run_id": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$",
                          "description": "A run, waterfall run, list or job id: matches run_id, parent_id or the id itself"
                        },
                        "waterfall_id": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$",
                          "description": "Only this waterfall's runs and attempts"
                        },
                        "latency_min": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0
                        },
                        "cost_min": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Micro-USD"
                        },
                        "query": {
                          "type": "string",
                          "maxLength": 2000,
                          "description": "Log query text, the /logs grammar (`provider:mock -capability:email.find status:>=400`): includes, exclusions, ranges and search; calls only"
                        },
                        "sample": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 1,
                          "description": "Keep this share of events (0-1)"
                        }
                      }
                    },
                    "batch": {
                      "type": "object",
                      "properties": {
                        "max_events": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000,
                          "default": 200
                        },
                        "max_wait_s": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 60,
                          "default": 5
                        }
                      }
                    },
                    "credential_fields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "health": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "idle",
                            "healthy",
                            "degraded",
                            "failing",
                            "disabled"
                          ]
                        },
                        "delivered_events": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "delivered_batches": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "failed_batches": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "dead_lettered": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "last_success_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "last_error_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "last_error": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 300
                        }
                      },
                      "required": [
                        "status",
                        "delivered_events",
                        "delivered_batches",
                        "failed_batches",
                        "dead_lettered",
                        "last_success_at",
                        "last_error_at",
                        "last_error"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "name",
                    "enabled",
                    "config",
                    "filter",
                    "batch",
                    "credential_fields",
                    "health",
                    "created_at",
                    "updated_at"
                  ]
                }
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "limit"
            ]
          }
        }
      }
    },
    "default": {
      "description": "Error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "invalid_request",
                      "unauthorized",
                      "insufficient_balance",
                      "max_cost_exceeded",
                      "scope_denied",
                      "budget_blocked",
                      "not_found",
                      "idempotency_mismatch",
                      "invalid_meta",
                      "rate_limited",
                      "upstream_error",
                      "response_buffer_limit",
                      "provider_capacity_unavailable",
                      "grid_saturated",
                      "upstream_timeout",
                      "conflict",
                      "internal_error",
                      "account_frozen",
                      "strict_filters",
                      "plan_limit_reached",
                      "validation_failed",
                      "deadline_exceeded",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": "string"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "call_id": {
                    "type": "string"
                  },
                  "retry_after_ms": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "details": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  }
}
```
