Read and write Context Spaces
Admit text or JSON, reference a named source version, consume prepared evidence, and send selected content with an inference request.
Use an Application with a direct grant to the Context Space, and the platform API origin. These content operations do not require an inference endpoint. An endpoint credential can use shared context during inference but does not give raw read, write or export access. See Authentication for the token exchange.
Admit content and keep its handle
Section titled “Admit content and keep its handle”Set SMOL_API_URL to your trusted HTTPS platform API origin without a trailing slash. Set SMOL_ORGANIZATION_ID and SMOL_LINEAGE_ID to the organization ID and Context Space ID. The API’s wire name for a space is lineage.
space="$SMOL_API_URL/v1/organizations/$SMOL_ORGANIZATION_ID/lineages/$SMOL_LINEAGE_ID"curl --silent --show-error --fail-with-body --proto '=https' --max-time 20 \ --header "Authorization: Bearer $SMOL_ACCESS_TOKEN" \ --header 'Content-Type: application/json' \ --data-binary '{"artefact_type":"text","content":"Orchid Kit returns are accepted for 28 days.","labels":["policy"]}' \ "$space/artefacts"A 201 response includes handle, artefact_type and admission_seq. Save the exact returned handle in SMOL_CONTEXT_HANDLE. For structured input, use "artefact_type":"json" and send JSON in content, not a string containing serialized JSON. Changing the content can give it a different handle; do not build or guess a handle on the client.
Read the same content
Section titled “Read the same content”curl --silent --show-error --fail-with-body --proto '=https' --max-time 20 \ --header "Authorization: Bearer $SMOL_ACCESS_TOKEN" \ --get --data-urlencode "handle=$SMOL_CONTEXT_HANDLE" "$space/artefacts"Read the content field in the response. This retrieves the exact content in the authorized space. It does not invoke a model. To make the content available to a model instead, use an explicit selection or endpoint defaults.
Give content a name that survives updates
Section titled “Give content a name that survives updates”- Admit the initial content.
POST …/sourceswith{"name":"Returns policy","handle":"<returned handle>"}. Keep the source ID. - When the policy changes, admit the new version’s content.
POST …/sources/{source_id}/versionswith itshandleand the source’s currentexpected_version. If the version conflicts, reload the source list before deciding which edit to apply. - A caller needing reproducibility can pin the exact handle. For automatic endpoint context, Follow latest context updates and Pinned have different behavior; changing a source does not change an already accepted request.
Reuse prepared evidence
Section titled “Reuse prepared evidence”List GET …/evidence for the space; inspect a preparation with GET …/evidence/{evidence_id}. To use a prepared result, POST …/evidence/{evidence_id}/consume with {"idempotency_key":"<retained-use-key>"}. The response includes output, evidence metadata and whether this use was replayed. A preparation that is not ready cannot be consumed. Stale results are refused by default; set allow_stale: true only when your application explicitly accepts that tradeoff. This is reuse of a derived result, not a new model call.
Browse operation fields and limits or set up the Context Space in the console.