Approve actual output as the new expected baseline

POST /runs/{run_id}/samples/{sample_id}/baseline-approval

Requires baselines:write scope and admin or contributor role. This is a destructive write — the approved output becomes the new expected baseline for the regression test. Provide a reason; it is stored in the audit log.

Path parameters

  • run_id integer Required

    Numeric run ID

    Minimum value is 1.

  • sample_id integer Required

    Numeric sample or regression result ID

    Minimum value is 1.

application/json

Body Required

  • regression_id integer Required

    Minimum value is 1.

  • output_id integer Required

    Minimum value is 1.

  • reason string Required

    Required justification stored in the audit log. Minimum 10 characters; do not accept placeholder values.

    Minimum length is 10, maximum length is 500.

  • apply_to_variants boolean

    If true, apply this baseline to all command variants of the regression test, not just the specific output_id.

    Default value is false.

Responses

  • 202 application/json

    Baseline approval recorded. Status begins as pending_review.

    Hide response attributes Show response attributes object
    • approval_id string Required

      Maximum length is 100.

    • status string Required

      Values are pending_review, approved, or rejected.

    • run_id integer Required

      Minimum value is 1.

    • sample_id integer Required

      Minimum value is 1.

    • regression_id integer Required

      Minimum value is 1.

    • output_id integer Required

      Minimum value is 1.

    • requested_by string(email) Required

      Maximum length is 255.

    • created_at string(date-time) Required
  • 400 application/json

    Request body or query parameters failed schema validation

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • 401 application/json

    Missing, expired, or invalid bearer token

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • 403 application/json

    Token is valid but lacks the required scope or role

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • 404 application/json

    Resource not found

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • 429 application/json

    Too many requests. Retry after the indicated number of seconds.

    Hide headers attributes Show headers attributes
    • Retry-After integer

      Seconds to wait before retrying

    • X-RateLimit-Limit

      Maximum requests allowed in the current window

    • X-RateLimit-Remaining

      Requests remaining in the current window

    • X-RateLimit-Reset

      Unix timestamp when the rate limit window resets

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • default application/json

    Unexpected server error

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

POST /runs/{run_id}/samples/{sample_id}/baseline-approval
curl \
 --request POST 'https://sampleplatform.ccextractor.org/api/v1/runs/{run_id}/samples/{sample_id}/baseline-approval' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"regression_id":42,"output_id":42,"reason":"string","apply_to_variants":false}'
Request examples
{
  "regression_id": 42,
  "output_id": 42,
  "reason": "string",
  "apply_to_variants": false
}
Response examples (202)
{
  "approval_id": "string",
  "status": "pending_review",
  "run_id": 42,
  "sample_id": 42,
  "regression_id": 42,
  "output_id": 42,
  "requested_by": "hello@example.com",
  "created_at": "2026-05-04T09:42:00Z"
}
Response examples (400)
{
  "code": "validation_error",
  "message": "Request failed schema validation.",
  "details": {
    "fields": {
      "commit_sha": "Must match pattern ^[a-fA-F0-9]{40}$",
      "platform": "Must be one of [linux, windows]"
    }
  }
}
Response examples (401)
{
  "code": "unauthorized",
  "message": "Bearer token is missing, expired, or invalid.",
  "details": {}
}
Response examples (403)
{
  "code": "forbidden",
  "message": "Token does not have the required scope for this operation.",
  "details": {
    "required_scope": "runs:write",
    "token_scopes": [
      "runs:read",
      "results:read"
    ]
  }
}
Response examples (404)
{
  "code": "not_found",
  "message": "Run 9317 not found.",
  "details": {
    "resource": "run",
    "id": 9317
  }
}
Response examples (429)
{
  "code": "rate_limited",
  "message": "Rate limit exceeded. Retry after 30 seconds.",
  "details": {
    "retry_after": 30,
    "limit": 120,
    "window": "60s"
  }
}
Response examples (default)
{
  "code": "not_found",
  "message": "Run 9317 not found.",
  "details": {}
}