Smart Insights API Beta

Smart Insights is powered by feedback events your application sends after evaluating a flag. ReleaseAnchor aggregates these events to produce per-environment metrics — success rate, feedback coverage, and average latency — visible on the flag detail page.

Prerequisites

Smart Insights must be enabled for the target environment in the dashboard before feedback data is collected. See Smart Insights → for setup steps.

Authentication

All feedback endpoints require an API key in the Authorization header:

Authorization: ApiKey <YOUR_API_KEY>

Report feedback

Send a single feedback event after evaluating a flag.

POST https://api.releaseanchor.com/v1/feedback/report

Request body

{
  "evaluationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "result": true,
  "latencyMs": 142,
  "errorType": null
}
FieldTypeRequiredDescription
evaluationIdstringThe evaluation ID returned by the /v1/evaluate response. Links this feedback to a specific flag evaluation.
resultbooleantrue if the flagged experience succeeded for the user; false if it failed.
latencyMsnumberTime in milliseconds from flag evaluation to outcome. Used to compute average latency in Smart Insights.
errorTypestringAn optional application-level error label (e.g. "TIMEOUT", "API_ERROR"). For your own tracking; not currently surfaced in metrics.

Example request

curl --location 'https://api.releaseanchor.com/v1/feedback/report' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: ApiKey <YOUR_API_KEY>' \
  --data '{
    "evaluationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "result": true,
    "latencyMs": 142,
    "errorType": null
  }'

Response

Returns HTTP 204 No Content on success. No response body.

Unauthorized 401

{
  "status": 401,
  "error": "Unauthorized",
  "message": "Missing or invalid Authorization header"
}

Bulk report feedback

Send up to 500 feedback events in a single request. Use this for batch processing scenarios — e.g. after sending an email campaign where you know outcomes for many users at once.

POST https://api.releaseanchor.com/v1/feedback/bulk

Request body

{
  "feedbacks": [
    {
      "evaluationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "result": true,
      "latencyMs": 142,
      "errorType": null
    },
    {
      "evaluationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "result": false,
      "latencyMs": 890,
      "errorType": "TIMEOUT"
    }
  ]
}
FieldTypeRequiredDescription
feedbacksarrayList of feedback events. Max 500 per request. Each item has the same fields as the single report body.

Example request

curl --location 'https://api.releaseanchor.com/v1/feedback/bulk' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: ApiKey <YOUR_API_KEY>' \
  --data '{
    "feedbacks": [
      { "evaluationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "result": true, "latencyMs": 142, "errorType": null },
      { "evaluationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901", "result": false, "latencyMs": 890, "errorType": "TIMEOUT" }
    ]
  }'

Response

Returns HTTP 204 No Content on success.


What gets aggregated

After receiving feedback events, ReleaseAnchor periodically aggregates the data per flag environment and computes:

MetricHow it is calculated
EvaluationsTotal evaluation events received for the environment
Feedback countTotal feedback events received
Feedback coveragefeedbackCount / totalEvaluations × 100
Success ratesuccessCount / feedbackCount × 100
Failure ratefailureCount / feedbackCount × 100
Avg latencyMean of all reported latencyMs values
Coverage matters

Feedback coverage reflects how consistently your integration reports outcomes. A low coverage percentage means Smart Insights metrics are based on a small sample — aim for coverage above 80% for reliable signals.


Integration pattern

  1. 1
    Evaluate the flag

    Call POST /v1/evaluate and capture the evaluationId from the response (available in the JavaScript SDK as the return value of evaluate()).

  2. 2
    Run the feature

    Execute the flagged code path for the user.

  3. 3
    Capture the outcome

    Once you know whether the experience succeeded or failed, send a feedback event with the evaluationId and result.

  4. 4
    Optionally include latency

    Measure the time from evaluation to outcome and include it as latencyMs to populate the latency metric in Smart Insights.

const start = Date.now();

const evaluation = await client.evaluate("new-checkout", userId);

if (evaluation.value) {
  try {
    await runNewCheckout(userId);
    await client.reportFeedback(evaluation.evaluationId, { result: true, latencyMs: Date.now() - start });
  } catch (err) {
    await client.reportFeedback(evaluation.evaluationId, { result: false, latencyMs: Date.now() - start, errorType: "CHECKOUT_ERROR" });
  }
}

Next steps

Was this helpful?