Skip to content
smol.Docs

    Open console

    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.

    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.

    Terminal window
    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.

    Terminal window
    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.

    1. Admit the initial content. POST …/sources with {"name":"Returns policy","handle":"<returned handle>"}. Keep the source ID.
    2. When the policy changes, admit the new version’s content. POST …/sources/{source_id}/versions with its handle and the source’s current expected_version. If the version conflicts, reload the source list before deciding which edit to apply.
    3. 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.

    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.