---
title: "Creates a new Integration Log Drain (deprecated)"
method: POST
path: "/v2/integrations/log-drains"
tags: ["logDrains"]
---

# Creates a new Integration Log Drain (deprecated)

`POST /v2/integrations/log-drains`

Creates an Integration log drain. This endpoint must be called with an OAuth2 client (integration), since log drains are tied to integrations. If it is called with a different token type it will produce a 400 error.

## Query parameters

- `teamId` string
- `slug` string

## Request body

- object
  - `name` string, required — The name of the log drain
  - `projectIds` string[]
  - `secret` string — A secret to sign log drain notification headers so a consumer can verify their authenticity
  - `deliveryFormat` 'json' | 'ndjson' — The delivery log format
  - `url` string, uri, required — The url where you will receive logs. The protocol must be `https://` or `http://` when type is `json` and `ndjson`.
  - `sources` string[]
  - `headers` object — Headers to be sent together with the request
  - `environments` string[]

## Response `200`

The log drain was successfully created

- object
  - `clientId` string — The oauth2 client application id that created this log drain
  - `configurationId` string — The client configuration this log drain was created with
  - `createdAt` number, required — A timestamp that tells you when the log drain was created
  - `id` string, required — The unique identifier of the log drain. Always prefixed with `ld_`
  - `deliveryFormat` 'json' | 'ndjson' | 'protobuf' — The delivery log format
  - `name` string, required — The name of the log drain
  - `ownerId` string, required — The identifier of the team or user whose events will trigger the log drain
  - `projectId` string, nullable
  - `projectIds` string[] — The identifier of the projects this log drain is associated with
  - `url` string, required — The URL to call when logs are generated
  - `sources` string[] — The sources from which logs are currently being delivered to this log drain.
  - `createdFrom` 'integration' | 'self-served' — Whether the log drain was created by an integration or by a user
  - `headers` object — The headers to send with the request
  - `environments` string[] — The environment of log drain
  - `branch` string — The branch regexp of log drain
  - `samplingRate` number — The sampling rate of log drain
  - `source` union, required
    - object
      - `kind` 'self-served', required
    - object
      - `kind` 'integration', required
      - `resourceId` string
      - `externalResourceId` string
      - `integrationId` string, required
      - `integrationConfigurationId` string, required

## Other responses

- `400` — One of the provided values in the request body is invalid. The provided token is not from an OAuth2 Client
- `401` — The request is not authorized.
- `403` — You do not have permission to access this resource.
- `410`

---

[API](https://skmtc.net/vercel/apis/api.md) · [All operations](https://skmtc.net/vercel/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vercel/api/versions/61d1ba3f6dac/schema)
