Documentation
Tracing and exports
View .mdOpenAPI

Add a trace destination

POSThttps://weights.fyi/run/v1/trace-sinksscope: manage
text
POST https://weights.fyi/run/v1/trace-sinks
Authorization: Bearer <token>                    scope: manage
Content-Type: application/json

{"name": "<name>", "kind": "otlp_http" | "mlflow" | "webhook", "url": "https://...",
 ["headers": {"<Name>": "<value>"}], ["include_outputs": true | false]}
Available since
2026-10-08, when the service went live on weights.fyi/run. a sample of logged inputs and outputs for a destination with include_outputs.
Answer time
synchronous: the destination is checked, its address resolved, and the destination stored before the answer comes. Nothing is sent to it by this call; use POST /v1/trace-sinks/{sink_id}/test to send a test span.

Adds a destination outside this service where every span of your account is delivered as it ends: jobs, calls to the model, moves, charges and credit, in your own tools. otlp_http, the default, is OpenTelemetry over HTTP in JSON for any collector; mlflow sends the same to an MLflow tracking server's trace intake; webhook posts signed JSON lines to a receiver you write. Delivery runs on the Tracing and tracking option, switched on your panel only (Tracing and tracking is free today: its fee per job is $0.00.); while it is off a destination is kept but paused (enabled: false), and spans that end then are not sent later. A destination never gets spans that ended before it was added; use GET /v1/traces for those.

Nothing is lost while your end is down. Spans go in order, at most 512 a request, each answered within 10 s; a 2xx marks them delivered, anything else is retried from 1 s, doubling to 64 s or as your Retry-After asks. A lost answer can mean a second delivery, so key spans on their span id. Test a new destination with POST /v1/trace-sinks/{sink_id}/test.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and a token with manage.
Content-Typeheaderyesapplication/json, at most 65,536 bytes.
namebodyyesYour name for it, not empty. An account has at most 6 destinations, paused ones included.
kindbodynootlp_http (default), mlflow or webhook.
urlbodyyeshttps, a host that resolves only to public addresses (no loopback, private, link-local, multicast or reserved), checked now and at every delivery; redirects never followed; no user name or password (use headers). For otlp_http and mlflow, the base address without a query: /v1/traces is added, and a URL already ending in it is refused. A webhook URL is used as given.
headersbodynoNames and values sent with every delivery, values never shown back. Not allowed: Host, Content-Length, Content-Type, Content-Encoding, Transfer-Encoding, Connection, X-Weights-Signature, X-Weights-Timestamp, or one name twice in any case. mlflow needs x-mlflow-experiment-id.
include_outputsbodynotrue sends each page's result with the calls' spans (weights.output.<seq>.label and so on; outputs for a webhook); default false, content-free. also a bounded sample of logged content on the job span (logged_content, content_cursor), never again once expired or deleted.

Return value

201 Created with the destination.

FieldMeaning
idThe destination's number, the sink_id the other calls take.
account_idYour account's number.
nameThe name you gave, with leading and trailing spaces removed.
kindotlp_http, mlflow or webhook.
urlThe address as you gave it; the OpenTelemetry kinds deliver to it with /v1/traces added.
header_namesThe names of the headers you set, sorted; never their values.
include_outputsWhether each page's result is sent.
enabledtrue when the destination receives spans; false while your Tracing and tracking option is off.
created_atWhen it was added. Only spans that end after this moment are sent to it.
deliveredHow many spans it has received, 0 in this answer.
backlogHow many spans wait for it, 0 in this answer.
backlog_oldest_at, next_try_atWhen the oldest waiting span was queued, and when it will next be tried; null while nothing waits.
last_ok_at, last_error, last_error_atThe last delivery that succeeded, and the last error with its time; null until there is one.
signing_secretFor a webhook only: the secret its deliveries are signed with, fabwh_ followed by 64 hexadecimal characters. It is shown in this answer and never again, so keep it now.

A webhook delivery is a POST of application/x-ndjson, one span a line with sorted keys: type (span), resource, and the span as the job log shows it, plus outputs when included.

Errors

StatusCodeWhen it happensWhat to do
400invalid_json, invalid_bodyThe body is not a JSON object.Send the object above.
400invalid_headersheaders is not an object of strings; expected shows the shape.Send {"Name": "value"}.
400invalid_header, reserved_headerA header name is not a valid name, a value holds a line break, a name appears twice, or the name is one the service sets.Fix or leave out that header.
400invalid_name, invalid_kindThe name is empty, or the kind is not one of the three.Give a name; use otlp_http, mlflow or webhook.
400invalid_url, url_credentials, url_is_traces_endpointThe URL is not an http(s) address, has a fragment, has a query (for the OpenTelemetry kinds), carries a user name or password, or already ends in /v1/traces.Give the base https address; put credentials in headers.
400https_requiredThe URL is not https.Use https.
400unresolvable_host, address_not_publicThe host does not resolve, or one of its addresses is not public.Use a public host.
400mlflow_experiment_header_missingAn mlflow destination without the x-mlflow-experiment-id header.Add the header with your experiment's id.
400invalid_preferencesThe workspace is confidential: it keeps governed tracing, so no destination can be added, whatever the body holds. The message says so.Nothing to fix in the request. Read traces with GET /v1/traces, or turn confidential mode off first with POST /v1/workspaces.
400too_many_sinksThe account already has 6 destinations.Remove one with DELETE /v1/trace-sinks/{sink_id}.
401unauthorized, invalid_token, token_revoked, token_expiredNo token, or one that does not work (any more).Use a valid token.
403scope_required, account_suspendedThe token lacks manage, or the account is suspended.Use a token with manage.
413body_too_largeThe body is larger than limit_bytes.Send fewer or shorter headers.

Examples

A webhook; the signing secret is in the answer, once:

sh
curl -s https://weights.fyi/run/v1/trace-sinks \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
  -d '{"name": "my receiver", "kind": "webhook", "url": "https://hooks.example.org/weights"}'
json
{
  "id": 2,
  "account_id": 1,
  "name": "my receiver",
  "kind": "webhook",
  "url": "https://hooks.example.org/weights",
  "header_names": [],
  "include_outputs": false,
  "enabled": false,
  "created_at": "2026-10-09T09:13:02.540Z",
  "delivered": 0,
  "backlog": 0,
  "backlog_oldest_at": null,
  "next_try_at": null,
  "last_ok_at": null,
  "last_error": null,
  "last_error_at": null,
  "signing_secret": "fabwh_59bdfdff0cf290c56dc43a24107a50c8484636d95603088ca0edb08b2e8fde59"
}

Patterns

Checking a webhook's signature

X-Weights-Timestamp is the signing time in Unix seconds; X-Weights-Signature is sha256= and the HMAC-SHA256 of the timestamp, a dot and the raw body, keyed with the secret. Compute it from the raw body, compare in constant time, refuse timestamps too far from your clock, and answer 2xx once stored:

python
import hashlib, hmac

def genuine(secret: str, timestamp: str, body: bytes, signature: str) -> bool:
    expected = hmac.new(secret.encode(), timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest("sha256=" + expected, signature)

History

  • 2026-10-08: live: three kinds, public https only, secret headers, ordered delivery that never drops a span.
  • 2026-10-08: delivery runs on the Tracing and tracking option, off by default; existing destinations were paused when it arrived.
  • 2026-10-09: destinations receive exactly the fields of GET /v1/traces and the job log; before, the charge event carried two internal pricing fields.
  • 2026-10-10 implementation review: logged content on the job span.
  • 2026-11-16: the confidential-workspace refusal documented.

See also

GET /v1/trace-sinks, DELETE /v1/trace-sinks/{sink_id}, Tracing and exports.