Skip to main content

integrations

Creates, updates, deletes, gets or lists an integrations resource.

Overview

Nameintegrations
TypeResource
Idvercel.log_drains.integrations

Fields

The following fields are returned by SELECT queries:

A list of log drains

NameDatatypeDescription
idstringThe unique identifier of the log drain. Always prefixed with ld_ (example: ld_nBuA7zCID8g4QZ8g)
namestringThe name of the log drain (example: My first log drain)
branchstringThe branch regexp of log drain (example: feature/*)
clientIdstringThe oauth2 client application id that created this log drain (example: oac_xRhY4LAB7yLhUADD69EvV7ct)
configurationIdstringThe client configuration this log drain was created with (example: icfg_cuwj0AdCdH3BwWT4LPijCC7t)
createdAtnumberA timestamp that tells you when the log drain was created
createdFromstringWhether the log drain was created by an integration or by a user (example: integration)
deliveryFormatstringThe delivery log format (example: json)
environmentstringThe environment of log drain (example: production)
headersobjectThe headers to send with the request (example: {"Authorization": "Bearer 123"})
ownerIdstringThe identifier of the team or user whose events will trigger the log drain (example: kr1PsOIzqEL5Xg6M4VZcZosf)
projectIdstring (example: AbCgVkqoxXeXCDWehVir51LHGrrcWL4mkYm14W6UBPWQeb)
projectIdsarrayThe identifier of the projects this log drain is associated with (example: AbCgVkqoxXeXCDWehVir51LHGrrcWL4mkYm14W6UBPWQeb)
sourcesarrayThe sources from which logs are currently being delivered to this log drain.
urlstringThe URL to call when logs are generated (example: https://example.com/log-drain)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_integration_log_drainsselectteamIdRetrieves a list of all Integration log drains that are defined for the authenticated user or team. When using an OAuth2 token, the list is limited to log drains created by the authenticated integration.
create_log_draininsertteamId, data__name, data__urlCreates 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.
delete_integration_log_draindeleteid, teamIdupdateFlowDeletes the Integration log drain with the provided id. When using an OAuth2 Token, the log drain can be deleted only if the integration owns it.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
idstringID of the log drain to be deleted
teamIdstringThe Team identifier or slug to perform the request on behalf of.
updateFlowbooleanIf this API is being called as part of an update flow, this should be set to true

SELECT examples

Retrieves a list of all Integration log drains that are defined for the authenticated user or team. When using an OAuth2 token, the list is limited to log drains created by the authenticated integration.

SELECT
id,
name,
branch,
clientId,
configurationId,
createdAt,
createdFrom,
deliveryFormat,
environment,
headers,
ownerId,
projectId,
projectIds,
sources,
url
FROM vercel.log_drains.integrations
WHERE teamId = '{{ teamId }}' -- required
;

INSERT examples

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.

INSERT INTO vercel.log_drains.integrations (
data__name,
data__projectIds,
data__secret,
data__deliveryFormat,
data__url,
data__sources,
data__headers,
data__environment,
data__branch,
data__previousLogDrainId,
teamId
)
SELECT
'{{ name }}' /* required */,
'{{ projectIds }}',
'{{ secret }}',
'{{ deliveryFormat }}',
'{{ url }}' /* required */,
'{{ sources }}',
'{{ headers }}',
'{{ environment }}',
'{{ branch }}',
'{{ previousLogDrainId }}',
'{{ teamId }}'
RETURNING
id,
name,
branch,
clientId,
configurationId,
createdAt,
createdFrom,
deliveryFormat,
environment,
headers,
ownerId,
projectId,
projectIds,
sources,
url
;

DELETE examples

Deletes the Integration log drain with the provided id. When using an OAuth2 Token, the log drain can be deleted only if the integration owns it.

DELETE FROM vercel.log_drains.integrations
WHERE id = '{{ id }}' --required
AND teamId = '{{ teamId }}' --required
AND updateFlow = '{{ updateFlow }}'
;