---
title: "Finalize an uploaded context"
method: POST
path: "/preview/contexts/{id}/finalize"
tags: ["contexts"]
---

# Finalize an uploaded context

`POST /preview/contexts/{id}/finalize`

## Request

- Base URL: `https://autoresearch.sfcompute.com`
- URL: `https://autoresearch.sfcompute.com/preview/contexts/{id}/finalize`
- Auth: HTTP bearer

Finalize an uploaded context (create_context): completes a multipart upload server-side (no ETag bookkeeping) and verifies the declared sha256 against the uploaded bytes. Small contexts answer `{status: "ready", size_bytes}` directly; a multi-GiB verify outlives your call - you get `{status: "finalizing"}` and the work continues server-side (your timeout never cancels it): poll get_context until status=ready. Re-calling while finalizing is safe (reports progress, never restarts). If the detached work fails, get_context reports `{status: "failed", error}` - re-calling finalize_context then starts a fresh attempt. A checksum mismatch is reported so you re-upload and resubmit. A no-op once ready. A finalized context feeds submit_job (`context_id`) and get_context (a download url to land it on a node), and stays reusable for ~30 days.

## Path parameters

- `id` string, required: Context id from create_context (e.g. "ctx-5rq8d").

## Query parameters

- `workspace` string

## Response `200`

The capability's JSON result.

- Result: The capability's result: the same object the MCP tool returns as structuredContent. Resources carry an `object` type discriminator and an immutable id; money is integer micro-dollars in `*_usd_micros` fields.
  - `object` string: The resource type, when the result is one resource.

## Other responses

- `400`: Malformed request: bad JSON, a parameter that does not parse, or a value outside its range. Code `invalid`.
- `401`: No bearer token, or one this API cannot verify. Code `unauthenticated`.
- `403`: Authenticated, but the token's scopes or the account's role do not reach this operation. The message names the scope word to request. Code `forbidden`.
- `404`: No such route. Code `not_found`; the body names the OpenAPI document.
- `422`: A well-formed request the platform declined: no such node, a cap reached, a state that forbids the move. The message says which, and what to do instead. Code `refused`.
- `429`: Over this door's per-customer budget. Wait `Retry-After` seconds. Code `rate_limited`.
- `500`: Our fault. Retry; if it persists, quote the request-id. Code `internal`.

---

[API](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api.md) · [All operations](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api/revisions/f88dcb70ac6c?raw)
