Skip to content
Docs

Creates a new Integration Log Drain (deprecated)

POSThttps://api.vercel.com/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.
https://api.vercel.com/v2/integrations/log-drains
const response = await fetch('https://api.vercel.com/v2/integrations/log-drains?teamId=string&slug=string', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "My first log drain",
"projectIds": [],
"secret": "a1Xsfd325fXcs",
"deliveryFormat": "json",
"url": "https://example.com/log-drain",
"sources": [],
"headers": "value",
"environments": []
}),
});
const data = await response.json();
console.log(data);
Response
{
"branch": "feature/*",
"clientId": "oac_xRhY4LAB7yLhUADD69EvV7ct",
"configurationId": "icfg_3bwCLgxL8qt5kjRLcv2Dit7F",
"createdAt": "1558531915505",
"createdFrom": "integration",
"deliveryFormat": "json",
"environments": [],
"headers": "{\"Authorization\": \"Bearer 123\"}",
"id": "ld_nBuA7zCID8g4QZ8g",
"name": "My first log drain",
"ownerId": "kr1PsOIzqEL5Xg6M4VZcZosf",
"projectId": "AbCgVkqoxXeXCDWehVir51LHGrrcWL4mkYm14W6UBPWQeb",
"projectIds": [],
"samplingRate": "0.5",
"source": {
"defaultFor": "eve-tracing",
"kind": "self-served"
},
"sources": [],
"url": "https://example.com/log-drain"
}
AuthorizationbearerToken

Default authentication mechanism

teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
namestringRequired
The name of the log drain
projectIdsarrayOptional
secretstringOptional
A secret to sign log drain notification headers so a consumer can verify their authenticity
deliveryFormatobjectOptional
The delivery log format
urlstringRequired
The url where you will receive logs. The protocol must be https:// or http:// when type is json and ndjson.
sourcesarrayOptional
headersobjectOptional
Headers to be sent together with the request
environmentsarrayOptional
200The log drain was successfully created
branchstringOptional
The branch regexp of log drain
clientIdstringOptional
The oauth2 client application id that created this log drain
configurationIdstringOptional
The client configuration this log drain was created with
createdAtnumberRequired
A timestamp that tells you when the log drain was created
createdFromstringOptional
Whether the log drain was created by an integration or by a user
deliveryFormatstringOptional
The delivery log format
environmentsarrayOptional
The environment of log drain
headersobjectOptional
The headers to send with the request
idstringRequired
The unique identifier of the log drain. Always prefixed with ld_
namestringRequired
The name of the log drain
ownerIdstringRequired
The identifier of the team or user whose events will trigger the log drain
projectIdstringOptional
projectIdsarrayOptional
The identifier of the projects this log drain is associated with
samplingRatenumberOptional
The sampling rate of log drain
sourceobjectRequired2 variants
sourcesarrayOptional
The sources from which logs are currently being delivered to this log drain.
urlstringRequired
The URL to call when logs are generated
400One of the provided values in the request body is invalid. The provided token is not from an OAuth2 Client
401The request is not authorized.
403You do not have permission to access this resource.
404Error
410Error