Add a sink
const url = 'https://example.com/api/v1/projects/example/sinks';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","kind":"example","clickhouse":{"url":"example","database":"example","table_prefix":"example","username":"example","password":"example","tls_skip_verify":true,"create_tables":true,"settings":{"additionalProperty":"example"}},"object_storage":{"endpoint":"example","region":"example","bucket":"example","prefix":"example","access_key_id":"example","secret_access_key":"example","path_style":true,"format":"example","compression":"example"},"webhook":{"url":"example","headers":{"additionalProperty":"example"}},"event_kinds":["example"],"environments":["example"],"batch_size":1,"flush_interval":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/projects/example/sinks \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "kind": "example", "clickhouse": { "url": "example", "database": "example", "table_prefix": "example", "username": "example", "password": "example", "tls_skip_verify": true, "create_tables": true, "settings": { "additionalProperty": "example" } }, "object_storage": { "endpoint": "example", "region": "example", "bucket": "example", "prefix": "example", "access_key_id": "example", "secret_access_key": "example", "path_style": true, "format": "example", "compression": "example" }, "webhook": { "url": "example", "headers": { "additionalProperty": "example" } }, "event_kinds": [ "example" ], "environments": [ "example" ], "batch_size": 1, "flush_interval": 1 }'Creates a sink of the kind given and the configuration of that kind
alone (clickhouse, object_storage or webhook), disabled: it
delivers nothing until it is enabled. The ClickHouse password and
the object storage secret_access_key are required, stored sealed
under FLAGNETIC_SECRET_KEY and read back as ***. A webhook sink’s
secret is drawn by the server, 32 random bytes as unpadded base64url,
and answered as secret this once; audit entries record every secret
as [redacted]. Receivers verify a webhook sink’s calls as they
verify a webhook subscription’s.
Batching defaults by kind: ClickHouse 5,000 events every 10 s, object
storage 500,000 every 300 s (flush interval 60 to 3,600 s), webhook
500 every 5 s (at most 5,000). event_kinds and environments left
empty mean every one.
Refused as invalid_sink, with errors naming each field by JSON
Pointer: a blank name, a configuration missing or of another kind,
a URL that is not an absolute http or https URL without credentials,
a required field left out, a setting delivery sets itself, a header
of the platform’s own, an event kind or a batching value out of
range. An environment the project does not have is
unknown_environment. A webhook sink’s url must be https
(insecure_url) unless the operator set
FLAGNETIC_WEBHOOK_ALLOW_HTTP, and its name must resolve only to
global unicast addresses, not loopback, private, link-local,
carrier-grade NAT or any other special-purpose range, nor a NAT64 or
6to4 address embedding one (private_network_target), unless the
operator set FLAGNETIC_WEBHOOK_ALLOW_PRIVATE_NETWORKS. A ClickHouse
or object storage target may be on a private or loopback address,
never on a link-local one, EC2’s IPv6 metadata address
fd00:ec2::254, or a NAT64 or 6to4 address embedding a link-local
one (link_local_target), which no setting lifts. A name that does
not resolve is accepted.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The project’s key.
Request Bodyrequired
Section titled “Request Bodyrequired”object
clickhouse, object_storage or webhook.
A ClickHouse sink’s configuration as it is written. Required, and
refused invalid_sink when absent: url, database, username
and, when creating, password.
object
flagnetic when empty.
Sealed on arrival. *** or absent keeps the stored password when editing, unless url, username or tls_skip_verify changes, and then it must be sent again.
True when absent.
object
An object storage sink’s configuration as it is written. Required,
and refused invalid_sink when absent: bucket, access_key_id and,
when creating, secret_access_key.
object
Sealed on arrival. *** or absent keeps the stored key when editing, unless endpoint or access_key_id changes, and then it must be sent again.
jsonl when empty.
gzip for jsonl and zstd for parquet when empty.
A webhook sink’s configuration as it is written. url is required.
object
object
Empty or absent for every event kind.
The keys of the environments whose events to export; empty or absent for every one.
The kind’s default when absent.
Seconds; the kind’s default when absent.
Example generated
{ "name": "example", "kind": "example", "clickhouse": { "url": "example", "database": "example", "table_prefix": "example", "username": "example", "password": "example", "tls_skip_verify": true, "create_tables": true, "settings": { "additionalProperty": "example" } }, "object_storage": { "endpoint": "example", "region": "example", "bucket": "example", "prefix": "example", "access_key_id": "example", "secret_access_key": "example", "path_style": true, "format": "example", "compression": "example" }, "webhook": { "url": "example", "headers": { "additionalProperty": "example" } }, "event_kinds": [ "example" ], "environments": [ "example" ], "batch_size": 1, "flush_interval": 1}Responses
Section titled “Responses”The new sink, with its secret when it is a webhook sink, shown this once.
object
object
Which target a sink delivers to; fixed when the sink is created.
A ClickHouse sink’s configuration, written to its HTTP interface. The
platform creates {table_prefix}_exposures, _aliases and
_evaluation_summaries when it enables the sink and create_tables
is true.
object
Where the HTTP interface answers; http or https, without credentials.
Letters, digits and underscores, not starting with a digit.
Always ***; the stored password is never answered.
ClickHouse settings sent with every insert. The ones delivery sets itself are refused.
object
An object storage sink’s configuration, for any S3-compatible service.
object
A scheme, a host and a port; empty for AWS.
Empty asks the bucket.
Without outer slashes.
Always ***; the stored key is never answered.
For jsonl; parquet files are always zstd.
A webhook sink’s configuration. Its secret is the sink’s, drawn by the server.
object
Where every batch is posted: https unless the operator set
FLAGNETIC_WEBHOOK_ALLOW_HTTP.
Sent with every call, before the platform’s own. Names starting X-Flagnetic- are refused.
object
The event kinds exported; empty for all of them.
The keys of the environments whose events are exported; empty for every one.
The most events one delivery carries.
Seconds the sink waits between deliveries once it has caught up.
The first that holds: disabled by a member; stopped after the
target kept rejecting batches, until resumed; failing while a
stream cannot reach its target; degraded while a dead letter waits;
lagging while the oldest undelivered event is older than the
operator’s FLAGNETIC_SINK_LAG_WARNING; otherwise healthy.
Whether retention is about to drop events the sink has not delivered.
The age of the oldest undelivered event; null while the sink is disabled.
The dead letters waiting to be redelivered or discarded.
The gaps not yet dismissed.
What the last check of the target found wrong without making delivery impossible.
One per event kind exported once the sink has been enabled; empty before.
One event kind’s delivery. Cursors are never exposed.
object
A kind of raw event a sink exports, each delivered through a stream of its own. The columns of each kind’s rows, with their types, are in Exported events.
object
Why a call to a target failed, from a closed list; a target’s own words are never kept or answered.
The HTTP status the target answered, when it did.
The protocol’s own error code, such as a ClickHouse exception or an S3 error code, when the target speaks one.
Counts the entity’s accepted changes, from 1; send it back in If-Match to change the entity.
object
Which target a sink delivers to; fixed when the sink is created.
A ClickHouse sink’s configuration, written to its HTTP interface. The
platform creates {table_prefix}_exposures, _aliases and
_evaluation_summaries when it enables the sink and create_tables
is true.
object
Where the HTTP interface answers; http or https, without credentials.
Letters, digits and underscores, not starting with a digit.
Always ***; the stored password is never answered.
ClickHouse settings sent with every insert. The ones delivery sets itself are refused.
object
An object storage sink’s configuration, for any S3-compatible service.
object
A scheme, a host and a port; empty for AWS.
Empty asks the bucket.
Without outer slashes.
Always ***; the stored key is never answered.
For jsonl; parquet files are always zstd.
A webhook sink’s configuration. Its secret is the sink’s, drawn by the server.
object
Where every batch is posted: https unless the operator set
FLAGNETIC_WEBHOOK_ALLOW_HTTP.
Sent with every call, before the platform’s own. Names starting X-Flagnetic- are refused.
object
The event kinds exported; empty for all of them.
The keys of the environments whose events are exported; empty for every one.
The most events one delivery carries.
Seconds the sink waits between deliveries once it has caught up.
The first that holds: disabled by a member; stopped after the
target kept rejecting batches, until resumed; failing while a
stream cannot reach its target; degraded while a dead letter waits;
lagging while the oldest undelivered event is older than the
operator’s FLAGNETIC_SINK_LAG_WARNING; otherwise healthy.
Whether retention is about to drop events the sink has not delivered.
The age of the oldest undelivered event; null while the sink is disabled.
The dead letters waiting to be redelivered or discarded.
The gaps not yet dismissed.
What the last check of the target found wrong without making delivery impossible.
One per event kind exported once the sink has been enabled; empty before.
One event kind’s delivery. Cursors are never exposed.
object
A kind of raw event a sink exports, each delivered through a stream of its own. The columns of each kind’s rows, with their types, are in Exported events.
object
Why a call to a target failed, from a closed list; a target’s own words are never kept or answered.
The HTTP status the target answered, when it did.
The protocol’s own error code, such as a ClickHouse exception or an S3 error code, when the target speaks one.
Counts the entity’s accepted changes, from 1; send it back in If-Match to change the entity.
object
Which target a sink delivers to; fixed when the sink is created.
A ClickHouse sink’s configuration, written to its HTTP interface. The
platform creates {table_prefix}_exposures, _aliases and
_evaluation_summaries when it enables the sink and create_tables
is true.
object
Where the HTTP interface answers; http or https, without credentials.
Letters, digits and underscores, not starting with a digit.
Always ***; the stored password is never answered.
ClickHouse settings sent with every insert. The ones delivery sets itself are refused.
object
An object storage sink’s configuration, for any S3-compatible service.
object
A scheme, a host and a port; empty for AWS.
Empty asks the bucket.
Without outer slashes.
Always ***; the stored key is never answered.
For jsonl; parquet files are always zstd.
A webhook sink’s configuration. Its secret is the sink’s, drawn by the server.
object
Where every batch is posted: https unless the operator set
FLAGNETIC_WEBHOOK_ALLOW_HTTP.
Sent with every call, before the platform’s own. Names starting X-Flagnetic- are refused.
object
The event kinds exported; empty for all of them.
The keys of the environments whose events are exported; empty for every one.
The most events one delivery carries.
Seconds the sink waits between deliveries once it has caught up.
The first that holds: disabled by a member; stopped after the
target kept rejecting batches, until resumed; failing while a
stream cannot reach its target; degraded while a dead letter waits;
lagging while the oldest undelivered event is older than the
operator’s FLAGNETIC_SINK_LAG_WARNING; otherwise healthy.
Whether retention is about to drop events the sink has not delivered.
The age of the oldest undelivered event; null while the sink is disabled.
The dead letters waiting to be redelivered or discarded.
The gaps not yet dismissed.
What the last check of the target found wrong without making delivery impossible.
One per event kind exported once the sink has been enabled; empty before.
One event kind’s delivery. Cursors are never exposed.
object
A kind of raw event a sink exports, each delivered through a stream of its own. The columns of each kind’s rows, with their types, are in Exported events.
object
Why a call to a target failed, from a closed list; a target’s own words are never kept or answered.
The HTTP status the target answered, when it did.
The protocol’s own error code, such as a ClickHouse exception or an S3 error code, when the target speaks one.
Counts the entity’s accepted changes, from 1; send it back in If-Match to change the entity.
A webhook sink’s secret, base64url of 32 random bytes, the key of every signature under the sink. Shown once, by the operation that issued it: it is stored sealed and never answered again. Absent for the other kinds.
Example
{ "kind": "clickhouse", "object_storage": { "format": "jsonl", "compression": "gzip" }, "event_kinds": [ "exposure" ], "health": "disabled", "streams": [ { "event_kind": "exposure", "last_failure": { "class": "dns" } } ]}Headers
Section titled “Headers”The entity’s version as a strong entity tag, such as "7", to send back in If-Match.
invalid_request: a parameter that is malformed or out of its range, such as a cursor this API did not return.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}No credential, or one that is not accepted: unauthenticated without
a credential (a session cookie the server did not issue counts as
none); invalid_token, token_revoked or token_expired for an API
token, with a WWW-Authenticate header naming the code;
session_expired for a session that has ended, whose cookie is
cleared; invalid_credentials for a sign-in.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}Headers
Section titled “Headers”The caller may not perform the operation: forbidden (with the
missing permission), session_required, insufficient_scope,
cross_origin for a request signed in by the session cookie, a read
included, that the browser says comes from another origin, or, for a
write, change_request_required when it would change what a
protected environment’s SDKs receive; detail names those
environments.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}not_found: no such project, or nothing under that identifier in it. An unknown project is answered before any permission is judged.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}The request is well formed but breaks a rule; errors names each field to fix.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}