Set project trace-export configuration

PUT /api/v1/projects/{id}/trace-export/config

Stores the project-level OTLP trace-export settings. The auth secret is referenced only (headers_secret_ref); the raw value is never accepted or stored. Bumps the generation counter and marks the config pending for downstream delivery. The project scope is carried by the route id path parameter and the org is derived from that project.

Path parameters

  • id string Required

    Project ID

application/json

Body Required

Typed JSON config

  • content_mode string

    ContentMode selects span content redaction. Empty means metadata_only.

    Values are metadata_only or full.

  • egress_mode string

    EgressMode selects where spans are delivered. Empty means platform_only.

    Values are platform_only, platform_and_customer_mirror, or customer_only.

  • enabled boolean Required

    Enabled is a pointer so the handler can distinguish an omitted field (nil, rejected) from an explicit false (a valid "disable export" request).

  • endpoint string

    Endpoint is the customer's OTLP/HTTP endpoint. Required when enabled. Must be https and must not point at an internal/loopback address (see Validate).

    Maximum length is 2048.

  • headers object

    Headers holds NON-SECRET export headers a preset requires (e.g. a workspace id). Secret values must never be placed here — use HeadersSecretRef.

    Hide headers attribute Show headers attribute object
    • * string Additional properties
  • headers_secret_ref string

    HeadersSecretRef is a pointer to the single stored auth secret (typically an API key). It is a reference — never the secret value. Must be scoped to the caller's project (see Validate).

    Maximum length is 512.

  • insecure_skip_verify boolean

    InsecureSkipVerify disables TLS verification of the customer endpoint. A pointer so nil (verify, the default) is distinct from an explicit opt-out; the UI surfaces enabling this as a deliberate reduction in security.

  • protocol string

    Protocol is the outbound OTLP protocol. v1 supports http/protobuf only.

    Value is http/protobuf.

  • resource_attributes object

    ResourceAttributes are extra OTLP resource attributes stamped onto every span sent to the customer endpoint (e.g. a destination-required project/model identifier). Which keys a given destination requires comes from its preset (see pkg/traceexportconfig/presets); values are always customer-supplied, since they typically name a project on the destination's own side that this platform has no way to look up.

    Hide resource_attributes attribute Show resource_attributes attribute object
    • * string Additional properties
  • sampling_policy object

    SamplingPolicy selects the head sampler applied before export.

    Hide sampling_policy attributes Show sampling_policy attributes object
    • ratio number

      Ratio is the sampling probability (0..1); required and used only when Type is ratio.

      Minimum value is 0, maximum value is 1.

    • type string

      Type is one of always_on, always_off, ratio, parent_based.

      Values are always_on, always_off, ratio, or parent_based.

  • secret_header_name string

    SecretHeaderName is the header name the referenced secret's value is sent as (e.g. "api_key"), taken from the preset's secret_header_keys or entered by the user for a custom destination. The platform composes the outbound ": " header line, so the stored secret is always the bare value (never a pre-formatted header line). Required when HeadersSecretRef is set (see Validate).

    Maximum length is 128.

Responses

  • Unsupported or malformed API version, an operation unavailable in the selected published contract, or an unacceptable representation (including unsupported media-type parameters or excluded SSE). Existing authentication, authorization, and rate-limit failures take precedence.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Optional validation details defined by the standard error schema; API negotiation errors do not emit this field.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Fields with validation failures.

        Hide fields attributes Show fields attributes object

        A field and its validation failure.

        • description string Required

          Human-readable validation failure.

        • field string Required

          Name or path of the invalid request field.

    • detail string Required

      Human-readable error details.

    • error integer Required

      HTTP status code.

    • errorCode string Required

      Machine-readable error code.

    • parameters array[string]

      Request parameter names associated with the error; omitted when none apply.

    • reason string Required

      HTTP status reason phrase.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Optional validation details defined by the standard error schema; API negotiation errors do not emit this field.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Fields with validation failures.

        Hide fields attributes Show fields attributes object

        A field and its validation failure.

        • description string Required

          Human-readable validation failure.

        • field string Required

          Name or path of the invalid request field.

    • detail string Required

      Human-readable error details.

    • error integer Required

      HTTP status code.

    • errorCode string Required

      Machine-readable error code.

    • parameters array[string]

      Request parameter names associated with the error; omitted when none apply.

    • reason string Required

      HTTP status reason phrase.

  • 200

    OK

    Hide response attributes Show response attributes object
    • generation integer
    • updated_at string
    Hide response attributes Show response attributes object
    • generation integer
    • updated_at string
  • 400

    Invalid config

    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
  • 401

    Missing or invalid credentials

    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
  • 403

    Caller lacks project-owner permission

    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
  • 413

    Config exceeds 16 KB

    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
    Hide response attributes Show response attributes object
    • code string
    • error string
    • success boolean
PUT /api/v1/projects/{id}/trace-export/config
curl \
 --request PUT 'https://agentengine.mongodb.com/api/v1/projects/{id}/trace-export/config' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{
  "content_mode": "metadata_only",
  "egress_mode": "platform_only",
  "enabled": true,
  "endpoint": "string",
  "headers": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  },
  "headers_secret_ref": "string",
  "insecure_skip_verify": true,
  "protocol": "http/protobuf",
  "resource_attributes": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  },
  "sampling_policy": {
    "ratio": 42.0,
    "type": "always_on"
  },
  "secret_header_name": "string"
}'
Request examples
{
  "content_mode": "metadata_only",
  "egress_mode": "platform_only",
  "enabled": true,
  "endpoint": "string",
  "headers": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  },
  "headers_secret_ref": "string",
  "insecure_skip_verify": true,
  "protocol": "http/protobuf",
  "resource_attributes": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  },
  "sampling_policy": {
    "ratio": 42.0,
    "type": "always_on"
  },
  "secret_header_name": "string"
}
Response examples (406)
{
  "detail": "This operation is not available in API version 2026-09-20-preview.",
  "error": 406,
  "errorCode": "OPERATION_NOT_IN_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
{
  "detail": "This operation supports text/event-stream, which the Accept header excludes. Remove unsupported media-type parameters or accept this type with a positive q value.",
  "error": 406,
  "errorCode": "UNACCEPTABLE_MEDIA_TYPE",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
{
  "detail": "The requested API version is not supported. Supported versions: 2026-09-20-preview.",
  "error": 406,
  "errorCode": "UNSUPPORTED_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
Response examples (406)
{
  "detail": "This operation is not available in API version 2026-09-20-preview.",
  "error": 406,
  "errorCode": "OPERATION_NOT_IN_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
Response examples (200)
{
  "generation": 42,
  "updated_at": "string"
}
Response examples (200)
{
  "generation": 42,
  "updated_at": "string"
}
Response examples (400)
{
  "code": "string",
  "error": "string",
  "success": true
}
Response examples (400)
{
  "code": "string",
  "error": "string",
  "success": true
}
Response examples (401)
{
  "code": "string",
  "error": "string",
  "success": true
}
Response examples (401)
{
  "code": "string",
  "error": "string",
  "success": true
}
Response examples (403)
{
  "code": "string",
  "error": "string",
  "success": true
}
Response examples (403)
{
  "code": "string",
  "error": "string",
  "success": true
}
Response examples (413)
{
  "code": "string",
  "error": "string",
  "success": true
}
Response examples (413)
{
  "code": "string",
  "error": "string",
  "success": true
}