Skip to content
v1

Reference Library and attachments

Library and attachments

Discover permitted Library entries, review their revisions and deliver them through current channels.

Review and send a Library entry

Use POST /v1/library/list for bounded discovery, then POST /v1/library/get to review the selected entry. Keep opaque references unchanged and send the reviewed revision with POST /v1/library/send. A changed entry must be reviewed again. Sending uses the current conversation and channel policy; a read permission alone does not permit sending.

Delivery is asynchronous. A partial or uncertain result requires reconciliation before another send. For web chat, a prepared response is retained for rendering instead of claiming provider delivery. Read that response with POST /v1/library/prepared, preserve message order and resolve its exact attachment references with POST /v1/attachments/resolve only when separately authorized. References are temporary selections bound to the integration and team; they are not permanent asset identifiers.

List permitted library entries

POST /v1/library/list

Reads a bounded page of current permitted library content with an independent library-content grant. References bind the current source revision; raw file locations, provider identifiers and internal access lists stay private. Hosted discovery preserves the assistant library selection rules.

Scopes
library:read
Rate limit
Read

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

Request body

  • query string ≤ 500 chars

    Optional discovery query; hosted assistant discovery retains its canonical selection rules.

  • type string

    Restrict discovery to this entry type.

    Possible values
    • message
    • media
    • sequence
  • language string ≤ 35 chars

    Optional language filter.

  • cursor string 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Current server-issued opaque content reference; never parse or modify it.

  • limit integer Range 1–50

    Maximum entries on this page, between one and fifty.

Returns

Returns a LibraryEntryList object.

Errors

+ 12 common errors

POST /v1/library/list
# Fictional fixtures: replace references and dates with current API values.
# Send consent or confirmation attestations only after the person confirms.
curl -X POST 'https://api.totemstudio.ai/v1/library/list' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Content-Type: application/json" \
  --data '{}'
Response · 200JSON
{
  "object": "library_entry_list",
  "data": [
    {
      "object": "library_entry",
      "reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "name": "Example service guide",
      "description": "Fictitious public example",
      "type": "message",
      "revision": 1,
      "part_count": 1,
      "file_count": 0,
      "preview": "The first visit includes an initial assessment.",
      "language": "en",
      "parts": [
        {
          "kind": "message",
          "text": "The first visit includes an initial assessment.",
          "file_name": null,
          "media_type": null
        }
      ]
    }
  ],
  "next_cursor": null,
  "coverage": "complete",
  "total": 1,
  "matched_in_page": 1
}

Read a permitted library entry

POST /v1/library/get

Reads authorized text and file metadata for one current library reference. Current grant, source incarnation, revision and hosted assistant access are checked before content is read. It returns no raw media download location.

Scopes
library:read
Rate limit
Read

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

Request body

  • reference string Required 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Current server-issued opaque content reference; never parse or modify it.

Returns

Returns a LibraryEntry object.

Errors

+ 12 common errors

POST /v1/library/get
# Fictional fixtures: replace references and dates with current API values.
# Send consent or confirmation attestations only after the person confirms.
curl -X POST 'https://api.totemstudio.ai/v1/library/get' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Content-Type: application/json" \
  --data '{"reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}'
Response · 200JSON
{
  "object": "library_entry",
  "reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "name": "Example service guide",
  "description": "Fictitious public example",
  "type": "message",
  "revision": 1,
  "part_count": 1,
  "file_count": 0,
  "preview": "The first visit includes an initial assessment.",
  "language": "en",
  "parts": [
    {
      "kind": "message",
      "text": "The first visit includes an initial assessment.",
      "file_name": null,
      "media_type": null
    }
  ]
}

Read a prepared library response

POST /v1/library/prepared

Resolves a current owned prepared-response reference to ordered persisted text and media descriptors. It rechecks the current source, revision and content permission; media locations remain separate opaque attachment references. Prepared content is not a provider delivery claim.

Scopes
library:read
Rate limit
Read

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

Request body

  • reference string Required 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Current server-issued opaque content reference; never parse or modify it.

Returns

Returns a LibraryPreparedResponse object.

Errors

+ 12 common errors

POST /v1/library/prepared
# Fictional fixtures: replace references and dates with current API values.
# Send consent or confirmation attestations only after the person confirms.
curl -X POST 'https://api.totemstudio.ai/v1/library/prepared' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Content-Type: application/json" \
  --data '{"reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}'
Response · 200JSON
{
  "object": "library_prepared_response",
  "version": 1,
  "messages": [
    {
      "id": "prepared_example",
      "role": "assistant",
      "kind": "text",
      "content": "The first visit includes an initial assessment.",
      "timestamp": "2026-10-01T09:30:00.000Z"
    }
  ]
}

Send a reviewed library entry

POST /v1/library/send

Starts a durable delivery of the current reviewed library revision to an owned retained conversation. Existing per-part progress, channel policy and uncertainty guards apply. Prepared web chat content is distinct from provider delivery; partial or uncertain delivery is never silently repeated.

Scopes
library:readmessages:send
Rate limit
write

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

  • Idempotency-Key string Required 1–255 chars Pattern ^[\x21-\x7e]+$

    One unique visible-ASCII key per logical write; reuse exactly on retries and never retry outcome_unknown automatically.

Request body

  • reference string Required 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Current server-issued opaque content reference; never parse or modify it.

  • expected_revision integer Required Range ≥ 0

    Current authored revision; sending requires the revision you reviewed.

  • conversation_id string ID prefix conv_…

    Current retained conversation. Required for a tenant key; hosted execution derives its exact source when omitted.

  • caption string ≤ 4000 chars

    Optional caption where the canonical entry and channel permit one.

Returns

Returns an Operation object.

Errors

+ 12 common errors

POST /v1/library/send
# Fictional fixtures: replace references and dates with current API values.
# Send consent or confirmation attestations only after the person confirms.
curl -X POST 'https://api.totemstudio.ai/v1/library/send' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Idempotency-Key: ${TOTEM_IDEMPOTENCY_KEY:?Set one unique key for this logical write}" \
  -H "Content-Type: application/json" \
  --data '{"reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "expected_revision": 1, "conversation_id": "conv_m3GhGjRHmFbww1g10oqOp7j3gWqPJ"}'
Response · 202JSON
{
  "object": "operation",
  "id": "op_m3yGe1tkVy6hn3m9LH9m7e640wg0O",
  "status": "queued",
  "endpoint": "library.send",
  "created_at": "2026-10-01T09:30:00.000Z",
  "updated_at": "2026-10-01T09:30:00.000Z",
  "result": null,
  "error": null
}

Resolve an authorized attachment

POST /v1/attachments/resolve

Intentionally discloses the current canonical application-bucket file URL and bounded file metadata under an independent attachment-content grant. Only the exact retained owned library file from a prepared response may resolve; provider, foreign-bucket and caller-supplied URLs are refused. Current source and permission are checked on each resolution.

Scopes
library:readattachments:read
Rate limit
Read

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

Request body

  • reference string Required 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Current server-issued opaque content reference; never parse or modify it.

Returns

Returns an Attachment object.

Errors

+ 12 common errors

POST /v1/attachments/resolve
# Fictional fixtures: replace references and dates with current API values.
# Send consent or confirmation attestations only after the person confirms.
curl -X POST 'https://api.totemstudio.ai/v1/attachments/resolve' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Content-Type: application/json" \
  --data '{"reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}'
Response · 200JSON
{
  "object": "attachment",
  "url": "https://storage.googleapis.com/totem-402908-eu/teams/example/media/example/guide.pdf",
  "mime_type": "application/pdf",
  "file_name": "guide.pdf",
  "file_size": 100
}

The LibraryEntry object

Attributes

  • object string

    Always library_entry.

  • reference string 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Current server-issued opaque content reference; never parse or modify it.

  • name string ≤ 2000 chars

    Current entry display name.

  • description string ≤ 20000 chars

    Current authored entry description.

  • type string

    A text message, media entry or ordered sequence.

    Possible values
    • message
    • media
    • sequence
  • revision integer Range ≥ 0

    Current authored revision; sending requires the revision you reviewed.

  • part_count integer Range ≥ 0

    Number of sendable parts in this current entry.

  • file_count integer Range ≥ 0

    Number of files in this current entry.

  • preview string ≤ 1200 chars

    Bounded authorized content preview.

  • language string Nullable ≤ 100 chars

    Configured entry language, or null.

  • parts Array<object> May be absent ≤ 25 items

    Ordered authorized parts, included by the detail read.

LibraryEntry · exampleJSON
{
  "object": "library_entry",
  "reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "name": "Example service guide",
  "description": "Fictitious public example",
  "type": "message",
  "revision": 1,
  "part_count": 1,
  "file_count": 0,
  "preview": "The first visit includes an initial assessment.",
  "language": "en",
  "parts": [
    {
      "kind": "message",
      "text": "The first visit includes an initial assessment.",
      "file_name": null,
      "media_type": null
    }
  ]
}

The LibraryEntryList object

Attributes

  • object string

    Always library_entry_list.

  • data Array<LibraryEntry> ≤ 50 items

    Current permitted entries on this page.

  • next_cursor string Nullable 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Opaque next-page cursor, or null after the last page.

  • coverage string

    Whether more discovery pages remain or this result is complete.

    Possible values
    • page
    • complete
  • total integer Nullable Range ≥ 0

    Total entries when established by the bounded discovery, otherwise null.

  • matched_in_page integer Range ≥ 0

    Number of entries matched within this returned page.

LibraryEntryList · exampleJSON
{
  "object": "library_entry_list",
  "data": [
    {
      "object": "library_entry",
      "reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "name": "Example service guide",
      "description": "Fictitious public example",
      "type": "message",
      "revision": 1,
      "part_count": 1,
      "file_count": 0,
      "preview": "The first visit includes an initial assessment.",
      "language": "en",
      "parts": [
        {
          "kind": "message",
          "text": "The first visit includes an initial assessment.",
          "file_name": null,
          "media_type": null
        }
      ]
    }
  ],
  "next_cursor": null,
  "coverage": "complete",
  "total": 1,
  "matched_in_page": 1
}

The LibraryDeliveryReceipt object

Attributes

  • object string

    Always library_delivery_receipt.

  • status string

    Current durable delivery state. Reconcile partial or uncertain delivery before repeating it.

    Possible values
    • sent
    • partial
    • uncertain
    • failed
    • held
    • in_progress
    • prepared
  • sent_parts integer Range ≥ 0

    Parts with retained provider acceptance; prepared web chat parts are separate.

  • total_parts integer Range ≥ 0

    Total parts of this reviewed delivery.

  • prepared boolean

    True only for a persisted web chat response prepared for the caller to render.

  • prepared_reference string Nullable 40–16384 chars Pattern ^tcnt1\.[A-Za-z0-9_-]+$

    Current source-bound prepared response reference, or null for other delivery states.

  • reason string

    Closed delivery disposition without private provider errors.

    Possible values
    • none
    • already_sent
    • resource_changed
    • conversation_changed
    • session_closed
    • delivery_refused
LibraryDeliveryReceipt · exampleJSON
{
  "object": "library_delivery_receipt",
  "status": "prepared",
  "sent_parts": 0,
  "total_parts": 1,
  "prepared": true,
  "prepared_reference": "tcnt1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "reason": "none"
}

The LibraryPreparedResponse object

Attributes

  • object string

    Always library_prepared_response.

  • version number

    Prepared visitor response format version, always one.

    Value
    • 1
  • messages Array<object> ≤ 25 items

    Ordered persisted visitor messages; preserve this order when rendering.

LibraryPreparedResponse · exampleJSON
{
  "object": "library_prepared_response",
  "version": 1,
  "messages": [
    {
      "id": "prepared_example",
      "role": "assistant",
      "kind": "text",
      "content": "The first visit includes an initial assessment.",
      "timestamp": "2026-10-01T09:30:00.000Z"
    }
  ]
}

The Attachment object

Attributes

  • object string

    Always attachment.

  • url string Format uri ≤ 8192 chars

    Intentionally disclosed canonical URL of the exact owned EU application-bucket file.

  • mime_type string ≤ 200 chars

    Canonical file MIME type.

  • file_name string Nullable ≤ 2000 chars

    Canonical file name when known, otherwise null.

  • file_size integer Nullable Range ≥ 0

    Known file size in bytes, otherwise null.

Attachment · exampleJSON
{
  "object": "attachment",
  "url": "https://storage.googleapis.com/totem-402908-eu/teams/example/media/example/guide.pdf",
  "mime_type": "application/pdf",
  "file_name": "guide.pdf",
  "file_size": 100
}

API version 1.0.0