Flags experimentsApiOperations
Attach metrics
Replaces the experiment's metric attachments wholesale. Each entry pairs an existing metric_id with a role (goal / guardrail / secondary).
Returns 422 if any metric_id doesn't exist in the project. Pass { metrics: [] } to detach everything.
Use cases
- Standard setup — one
goal, one or twoguardrail, optionalsecondarymetrics for diagnostics. - Detach all — send
{ "metrics": [] }before archiving.
Authorization
bearerSdkKey AuthorizationBearer <token>
Pass an admin SDK key as Authorization: Bearer sdk_admin_…. Mint via POST /api/admin/keys with type: "admin".
In: header
Path Parameters
id*string
Stable opaque experiment id.
Header Parameters
X-Project-Id*string
Project the request operates on. Must match the project the SDK key belongs to.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://shipeasy.ai/api/admin/experiments/string/metrics" \ -H "X-Project-Id: string" \ -H "Content-Type: application/json" \ -d '{ "metrics": [ { "metric_id": "met_checkout_completed", "role": "goal" }, { "metric_id": "met_page_errors", "role": "guardrail" } ] }'{
"id": "exp_01j7wb12c3d4e5f6g7h8j9k0l1",
"metrics": [
{
"metric_id": "met_checkout_completed",
"role": "goal"
},
{
"metric_id": "met_page_errors",
"role": "guardrail"
}
]
}{
"error": "string",
"code": "string",
"detail": "string"
}{
"error": "string",
"code": "string",
"detail": "string"
}{
"error": "string",
"code": "string",
"detail": "string"
}{
"error": "string",
"code": "string",
"detail": "string"
}{
"error": "string",
"code": "string",
"detail": "string"
}{
"error": "string",
"code": "string",
"detail": "string"
}