---
title: update-an-existing-drain
product: vercel
url: /docs/rest-api/drains/update-an-existing-drain
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about update-an-existing-drain on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Update an existing Drain

```http
PATCH /v1/drains/{id}
```

Update the configuration of an existing drain.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | Yes |  |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Request body

Required: No

Content-Type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "projects": {
      "type": "string",
      "enum": [
        "some",
        "all"
      ]
    },
    "projectIds": {
      "type": "array",
      "nullable": true,
      "items": {
        "type": "string"
      }
    },
    "filter": {
      "oneOf": [
        {
          "type": "string",
          "nullable": true
        },
        {
          "type": "object",
          "required": [
            "version",
            "filter"
          ],
          "properties": {
            "version": {
              "type": "string"
            },
            "filter": {
              "oneOf": [
                {
                  "type": "object",
                  "required": [
                    "type"
                  ],
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "project": {
                      "type": "object",
                      "properties": {
                        "ids": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "log": {
                      "type": "object",
                      "properties": {
                        "sources": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "build",
                              "edge",
                              "lambda",
                              "static",
                              "external",
                              "firewall",
                              "redirect"
                            ]
                          }
                        }
                      }
                    },
                    "deployment": {
                      "type": "object",
                      "properties": {
                        "environments": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "production",
                              "preview"
                            ]
                          }
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "type",
                    "text"
                  ],
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    },
    "schemas": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "string"
          }
        }
      }
    },
    "delivery": {
      "type": "object",
      "oneOf": [
        {
          "type": "object",
          "required": [
            "type",
            "endpoint",
            "encoding",
            "headers"
          ],
          "properties": {
            "type": {
              "type": "string"
            },
            "endpoint": {
              "type": "string"
            },
            "compression": {
              "type": "string",
              "enum": [
                "gzip",
                "none"
              ]
            },
            "encoding": {
              "type": "string",
              "enum": [
                "json",
                "ndjson"
              ]
            },
            "headers": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "secret": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "type",
            "endpoint",
            "encoding",
            "headers"
          ],
          "properties": {
            "type": {
              "type": "string"
            },
            "endpoint": {
              "oneOf": [
                {
                  "type": "object",
                  "required": [
                    "traces"
                  ],
                  "properties": {
                    "traces": {
                      "type": "string"
                    }
                  }
                }
              ]
            },
            "encoding": {
              "type": "string",
              "enum": [
                "proto",
                "json"
              ]
            },
            "headers": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "secret": {
              "type": "string"
            }
          }
        }
      ]
    },
    "sampling": {
      "type": "array",
      "nullable": true,
      "items": {
        "type": "object",
        "required": [
          "type",
          "rate"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "description": "Sampling rate from 0 to 1 (e.g., 0.1 for 10%)",
            "minimum": 0,
            "maximum": 1
          },
          "env": {
            "type": "string",
            "description": "Environment to apply sampling to",
            "enum": [
              "production",
              "preview"
            ]
          },
          "requestPath": {
            "type": "string",
            "description": "Request path prefix to apply the sampling rule to"
          }
        }
      }
    },
    "transforms": {
      "type": "array",
      "nullable": true,
      "items": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string"
          }
        }
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "enabled",
        "disabled"
      ]
    },
    "source": {
      "type": "object",
      "oneOf": [
        {
          "oneOf": [
            {
              "required": [
                "externalResourceId"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "default": "integration"
                },
                "externalResourceId": {
                  "type": "string"
                }
              }
            },
            {
              "required": [
                "resourceId"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "default": "integration"
                },
                "resourceId": {
                  "type": "string"
                }
              }
            },
            {
              "required": [
                "kind"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "default": "integration"
                }
              }
            }
          ]
        },
        {
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "default": "self-served"
            }
          }
        }
      ]
    }
  }
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "createdAt",
        "delivery",
        "id",
        "name",
        "ownerId",
        "schemas",
        "source",
        "updatedAt"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "createdAt": {
          "type": "number"
        },
        "updatedAt": {
          "type": "number"
        },
        "projectIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "teamId": {
          "type": "string",
          "nullable": true
        },
        "ownerId": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "enabled",
            "disabled",
            "errored"
          ]
        },
        "firstErrorTimestamp": {
          "type": "number"
        },
        "disabledAt": {
          "type": "number"
        },
        "disabledBy": {
          "type": "string"
        },
        "disabledReason": {
          "type": "string",
          "enum": [
            "disabled-by-owner",
            "feature-not-available",
            "account-plan-downgrade",
            "disabled-by-admin"
          ]
        },
        "schemas": {
          "type": "object",
          "properties": {
            "log": {
              "type": "object"
            },
            "trace": {
              "type": "object"
            },
            "analytics": {
              "type": "object"
            },
            "speed_insights": {
              "type": "object"
            },
            "ai_gateway": {
              "type": "object"
            }
          }
        },
        "delivery": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "encoding",
                "endpoint",
                "headers",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "http"
                  ]
                },
                "endpoint": {
                  "type": "string"
                },
                "encoding": {
                  "type": "string",
                  "enum": [
                    "json",
                    "ndjson"
                  ]
                },
                "compression": {
                  "type": "string",
                  "enum": [
                    "none",
                    "gzip"
                  ]
                },
                "headers": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "secret": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "INTEGRATION_SECRET"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "encoding",
                "endpoint",
                "headers",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "otlphttp"
                  ]
                },
                "endpoint": {
                  "type": "object",
                  "required": [
                    "traces"
                  ],
                  "properties": {
                    "traces": {
                      "type": "string"
                    }
                  }
                },
                "encoding": {
                  "type": "string",
                  "enum": [
                    "json",
                    "proto"
                  ]
                },
                "headers": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "secret": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "INTEGRATION_SECRET"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "endpoint",
                "table",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "clickhouse"
                  ]
                },
                "endpoint": {
                  "type": "string"
                },
                "table": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "target",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "internal"
                  ]
                },
                "target": {
                  "type": "string",
                  "enum": [
                    "vercel-otel-traces-db"
                  ]
                }
              }
            }
          ]
        },
        "sampling": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "rate",
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "head_sampling"
                ]
              },
              "rate": {
                "type": "number"
              },
              "env": {
                "type": "string",
                "enum": [
                  "production",
                  "preview"
                ]
              },
              "requestPath": {
                "type": "string"
              }
            }
          }
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "kind"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "self-served"
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "integrationConfigurationId",
                "integrationId",
                "kind"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "integration"
                  ]
                },
                "resourceId": {
                  "type": "string"
                },
                "externalResourceId": {
                  "type": "string"
                },
                "integrationId": {
                  "type": "string"
                },
                "integrationConfigurationId": {
                  "type": "string"
                }
              }
            }
          ]
        },
        "filter": {
          "type": "string"
        },
        "filterV2": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "version"
              ],
              "properties": {
                "version": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "filter",
                "version"
              ],
              "properties": {
                "version": {
                  "type": "string",
                  "enum": [
                    "v2"
                  ]
                },
                "filter": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "basic"
                          ]
                        },
                        "project": {
                          "type": "object",
                          "properties": {
                            "ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "log": {
                          "type": "object",
                          "properties": {
                            "sources": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "build",
                                  "edge",
                                  "lambda",
                                  "static",
                                  "external",
                                  "firewall",
                                  "redirect"
                                ]
                              }
                            },
                            "legacy_excludeCachedStaticAssetLogs": {
                              "type": "boolean",
                              "enum": [
                                false,
                                true
                              ]
                            }
                          }
                        },
                        "deployment": {
                          "type": "object",
                          "properties": {
                            "environments": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "production",
                                  "preview"
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "text",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "odata"
                          ]
                        },
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "createdAt",
        "delivery",
        "id",
        "name",
        "ownerId",
        "schemas",
        "source",
        "updatedAt"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "createdAt": {
          "type": "number"
        },
        "updatedAt": {
          "type": "number"
        },
        "projectIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "teamId": {
          "type": "string",
          "nullable": true
        },
        "ownerId": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "enabled",
            "disabled",
            "errored"
          ]
        },
        "firstErrorTimestamp": {
          "type": "number"
        },
        "disabledAt": {
          "type": "number"
        },
        "disabledBy": {
          "type": "string"
        },
        "disabledReason": {
          "type": "string",
          "enum": [
            "disabled-by-owner",
            "feature-not-available",
            "account-plan-downgrade",
            "disabled-by-admin"
          ]
        },
        "schemas": {
          "type": "object",
          "properties": {
            "log": {
              "type": "object"
            },
            "trace": {
              "type": "object"
            },
            "analytics": {
              "type": "object"
            },
            "speed_insights": {
              "type": "object"
            },
            "ai_gateway": {
              "type": "object"
            }
          }
        },
        "delivery": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "encoding",
                "endpoint",
                "headers",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "http"
                  ]
                },
                "endpoint": {
                  "type": "string"
                },
                "encoding": {
                  "type": "string",
                  "enum": [
                    "json",
                    "ndjson"
                  ]
                },
                "compression": {
                  "type": "string",
                  "enum": [
                    "none",
                    "gzip"
                  ]
                },
                "headers": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "secret": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "INTEGRATION_SECRET"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "encoding",
                "endpoint",
                "headers",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "otlphttp"
                  ]
                },
                "endpoint": {
                  "type": "object",
                  "required": [
                    "traces"
                  ],
                  "properties": {
                    "traces": {
                      "type": "string"
                    }
                  }
                },
                "encoding": {
                  "type": "string",
                  "enum": [
                    "json",
                    "proto"
                  ]
                },
                "headers": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "secret": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "INTEGRATION_SECRET"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "endpoint",
                "table",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "clickhouse"
                  ]
                },
                "endpoint": {
                  "type": "string"
                },
                "table": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "target",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "internal"
                  ]
                },
                "target": {
                  "type": "string",
                  "enum": [
                    "vercel-otel-traces-db"
                  ]
                }
              }
            }
          ]
        },
        "sampling": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "rate",
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "head_sampling"
                ]
              },
              "rate": {
                "type": "number"
              },
              "env": {
                "type": "string",
                "enum": [
                  "production",
                  "preview"
                ]
              },
              "requestPath": {
                "type": "string"
              }
            }
          }
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "kind"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "self-served"
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "integrationConfigurationId",
                "integrationId",
                "kind"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "integration"
                  ]
                },
                "resourceId": {
                  "type": "string"
                },
                "externalResourceId": {
                  "type": "string"
                },
                "integrationId": {
                  "type": "string"
                },
                "integrationConfigurationId": {
                  "type": "string"
                }
              }
            }
          ]
        },
        "filter": {
          "type": "string"
        },
        "filterV2": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "version"
              ],
              "properties": {
                "version": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "filter",
                "version"
              ],
              "properties": {
                "version": {
                  "type": "string",
                  "enum": [
                    "v2"
                  ]
                },
                "filter": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "basic"
                          ]
                        },
                        "project": {
                          "type": "object",
                          "properties": {
                            "ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "log": {
                          "type": "object",
                          "properties": {
                            "sources": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "build",
                                  "edge",
                                  "lambda",
                                  "static",
                                  "external",
                                  "firewall",
                                  "redirect"
                                ]
                              }
                            },
                            "legacy_excludeCachedStaticAssetLogs": {
                              "type": "boolean",
                              "enum": [
                                false,
                                true
                              ]
                            }
                          }
                        },
                        "deployment": {
                          "type": "object",
                          "properties": {
                            "environments": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "production",
                                  "preview"
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "text",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "odata"
                          ]
                        },
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          ]
        },
        "integrationIcon": {
          "type": "string"
        },
        "integrationConfigurationUri": {
          "type": "string"
        },
        "integrationWebsite": {
          "type": "string"
        },
        "projectAccess": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "access",
                "managedBy"
              ],
              "properties": {
                "access": {
                  "type": "string",
                  "enum": [
                    "all"
                  ]
                },
                "managedBy": {
                  "type": "string",
                  "enum": [
                    "integration",
                    "drain"
                  ]
                }
              }
            },
            {
              "type": "object",
              "required": [
                "access",
                "managedBy",
                "projectIds"
              ],
              "properties": {
                "access": {
                  "type": "string",
                  "enum": [
                    "some"
                  ]
                },
                "projectIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "managedBy": {
                  "type": "string",
                  "enum": [
                    "integration",
                    "drain"
                  ]
                }
              }
            }
          ]
        }
      }
    }
  ]
}
```

### 400: One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.

### 401: The request is not authorized.

### 403: You do not have permission to access this resource.

### 404: No description

---

## Related

- [drains endpoints](/docs/rest-api#drains)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://openapi.vercel.sh/) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
