Skip to main content

Management API

Use the management API to configure streams and destinations from code or CI and to read your organization’s usage. It’s available on Pro and Team.

Base URL: https://api.send2bucket.com/v1/manage. The contract is the OpenAPI 3.1 document at /v1/manage/openapi.json; generate a client from it or read it for every field.

Authentication​

Send an account key as a Bearer token: Authorization: Bearer s2b_acct_…. Account keys are made on the dashboard's account page (avatar menu, manage account), act on that organization only, and are shown once. They are not ingest keys: s2b_ingest_ keys cannot call the management API, and s2b_acct_ keys cannot send data.

Endpoints​

MethodPathDoes
GET/streamsLists the organization's streams with their destination's name, kind and status.
POST/streamsCreates a stream: {"name": "web"}, optionally with "destination_id", "aggregation_rules", "transform" and "flush_seconds". Returns 201.
GET/streams/{stream_id}Reads a stream.
PATCH/streams/{stream_id}Renames a stream, changes its destination, replaces its aggregation rules, sets its transform or its flush interval: {"name": "events"}, {"destination_id": "…"}, {"aggregation_rules": […]}, {"transform": "del(.password)"}, {"flush_seconds": 15}. A null destination_id detaches it; a null transform removes it; a null flush_seconds follows the plan.
DELETE/streams/{stream_id}Deletes a stream. Its destination stays. Returns 204, or 409 while aggregation rules send rows to it.
GET/streams/{stream_id}/statsIngestion and delivery counters, and the records the stream's transform dropped and failed on.
GET/destinationsLists the organization's destinations, each with the stream_ids that deliver to it. Secrets are never returned.
POST/destinationsCreates a destination: {"name", "kind", "config", "secret"}. Returns 201.
GET/destinations/{destination_id}Reads a destination.
PATCH/destinations/{destination_id}Changes any of name, kind, config and secret. Leave secret out to keep the stored one.
DELETE/destinations/{destination_id}Deletes a destination no stream delivers to. Returns 204.
POST/destinations/{destination_id}/verifyAsks for verification. Returns 202; read the destination's status until it is active or error.
GET/usageIngested bytes and records per billing period and signal.

A destination belongs to the organization, and any number of its streams can share it. config and secret take the fields of the destination's page, for example S3-compatible storage. A new or changed secret makes the destination unverified until verification or the first successful delivery succeeds; a stream accepts data either way.

curl https://api.send2bucket.com/v1/manage/destinations \
-H "Authorization: Bearer $S2B_ACCOUNT_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"raw","kind":"s3_compatible","config":{"bucket":"raw","endpoint":"https://s3.example.com"},"secret":{"access_key_id":"…","secret_access_key":"…"}}'

curl https://api.send2bucket.com/v1/manage/streams \
-H "Authorization: Bearer $S2B_ACCOUNT_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"web","destination_id":"<the destination id>"}'

Errors​

Errors are JSON with an error code.

StatuserrorMeaning
400invalid_jsonThe body is not a JSON object.
400invalid_requestA field is missing or invalid, such as an empty name, an unknown destination kind or another organization's destination_id. An invalid aggregation rule adds a detail, such as rule 1: unknown output "median", and a transform that does not compile adds the compiler's message. A flush_seconds outside 10 to 60 adds flush_seconds must be an integer from 10 to 60, or null.
401unauthorizedMissing, unknown or revoked account key.
403plan_requiredThe workspace is not on an active Pro or Team plan.
404not_foundNo such stream or destination in the organization.
409name_takenAnother stream, or another destination, of the organization has this name.
409destination_in_useStreams still deliver to the destination. Point them elsewhere first.
409stream_in_useAggregation rules send their rows to the stream. Change those rules first.
503unavailableThe management API is not available on this node.