POST
/
v1
/
log-drains
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.logDrains.createConfigurableLogDrain({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      deliveryFormat: "json",
      url: "https://sugary-technician.name",
      sources: [
        "external",
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();
{
  "secret": "<string>",
  "clientId": "<string>",
  "configurationId": "<string>",
  "sources": [
    "build"
  ],
  "environments": [
    "production"
  ],
  "disabledBy": "<string>",
  "firstErrorTimestamp": 123,
  "samplingRate": 123,
  "hideIpAddresses": true,
  "id": "<string>",
  "createdAt": 123,
  "deletedAt": 123,
  "updatedAt": 123,
  "url": "<string>",
  "headers": {},
  "projectIds": [
    "<string>"
  ],
  "name": "<string>",
  "teamId": "<string>",
  "ownerId": "<string>",
  "createdFrom": "self-served",
  "deliveryFormat": "json",
  "status": "enabled",
  "disabledAt": 123,
  "disabledReason": "disabled-by-owner"
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Query Parameters

teamId
string

The Team identifier to perform the request on behalf of.

Example:

"team_1a2b3c4d5e6f7g8h9i0j1k2l"

slug
string

The Team slug to perform the request on behalf of.

Example:

"my-team-url-slug"

Body

application/json
deliveryFormat
enum<string>
required

The delivery log format

Available options:
json,
ndjson
Example:

"json"

url
string
required

The log drain url

sources
enum<string>[]
required
Available options:
static,
lambda,
build,
edge,
external,
firewall
headers
object

Headers to be sent together with the request

projectIds
string[]
environments
enum<string>[]
Available options:
preview,
production
secret
string

Custom secret of log drain

samplingRate
number

The sampling rate for this log drain. It should be a percentage rate between 0 and 100. With max 2 decimal points

Required range: 0.01 <= x <= 1Must be a multiple of 0.01
name
string

The custom name of this log drain.

Response

200
application/json
environments
enum<string>[]
required
Available options:
production,
preview
id
string
required
createdAt
number
required
deletedAt
number | null
required
updatedAt
number
required
url
string
required
name
string
required
ownerId
string
required
deliveryFormat
enum<string>
required
Available options:
json,
ndjson,
syslog,
protobuf
secret
string

The secret to validate the log-drain payload

clientId
string
configurationId
string
sources
enum<string>[]
Available options:
build,
edge,
lambda,
static,
external,
firewall
disabledBy
string
firstErrorTimestamp
number
samplingRate
number
hideIpAddresses
boolean
headers
object
projectIds
string[]
teamId
string | null
createdFrom
enum<string>
Available options:
self-served,
integration
status
enum<string>
Available options:
enabled,
disabled,
errored
disabledAt
number
disabledReason
enum<string>
Available options:
disabled-by-owner,
feature-not-available,
account-plan-downgrade,
disabled-by-admin