{
  "schema_version": 2,
  "id": "develop/ai/context-engine/agent-playbooks/manage-faqs",
  "title": "Manage FAQs",
  "url": "https://redis.io/docs/latest/develop/ai/context-engine/agent-playbooks/manage-faqs/",
  "summary": "Write answers, promote reviewed proposals, and publish FAQ versions for retrieval.",
  "tags": [
    "docs",
    "develop",
    "ai"
  ],
  "last_updated": "2026-11-02T15:54:35-08:00",
  "page_type": "content",
  "content_hash": "2e47c6c9828627e5604cbf542fe03468be5c0cb1bcb00692070510e539c0e559",
  "sections": [
    {
      "id": "code-examples",
      "title": "Code examples",
      "role": "example",
      "text": "These examples connect to Iris services using SDKs or HTTP requests with curl. Follow one language throughout each walkthrough.\n\n\nPublish a FAQ to give agents an approved answer to a recurring question. Write it directly or promote a reviewed proposal."
    },
    {
      "id": "before-you-begin",
      "title": "Before you begin",
      "role": "content",
      "text": "Use an existing playbook and an API key with `write` permission to create and maintain entries. Publishing and withdrawing require `publish`. See [access permissions](https://redis.io/docs/latest/develop/ai/context-engine/agent-playbooks/concepts#playbooks).\n\nStart with the quickstart's [client setup](https://redis.io/docs/latest/develop/ai/context-engine/agent-playbooks/quickstart#connect-to-the-playbook), then append this page's snippets in order. Run each write once.\n\nThe CLI uses flat FAQ JSON files and `faqs push` to reconcile content by entry key. A changed file appends a version; an unchanged file does not. Publication remains a separate command."
    },
    {
      "id": "write-an-answer",
      "title": "Write an answer",
      "role": "content",
      "text": "Write a question in the language a user would use. Include conditions that distinguish it from similar questions, such as the product or region. Make the answer self-contained: the agent receives it without the source conversation or document.\n\nThe sample FAQ explains where to find refund status. Use a [skill](https://redis.io/docs/latest/develop/ai/context-engine/agent-playbooks/manage-skills) when the agent must interpret the customer's reported stage, choose a template, and draft a reply.\n\nSDK and HTTP requests nest content fields; CLI FAQ files use flat fields:\n\n| Request field | CLI file field | Use it for |\n|:--------------|:---------------|:-----------|\n| `content.payload.faq.question` | `question` | The recurring question. |\n| `content.payload.faq.answer` | `answer` | The approved answer. |\n| `content.intents` | `intents` | Optional task phrases returned with discovery previews. |\n| `content.attributes` | `attributes` | Exact-match filters, such as audience, locale, or product. |\n| `content.metadata` | `metadata` | Application context, such as a source-document reference. |\n\nSemantic matching uses the question, not the answer or intents. Use attributes to filter the audience. Metadata does not control publication.\n\nFor example, prefer “How do I check the status of an existing refund?” to “Refund help.” Keep “How do I request a refund?” separate: it needs a different answer."
    },
    {
      "id": "create-a-draft-faq",
      "title": "Create a draft FAQ",
      "role": "content",
      "text": "Submit the complete content with `create_faq`. The sample assigns `refund-status` as its entry key. Keys are immutable and unique within a playbook; choose another key if that one is already in use. Save the returned entry identifier and version number.\n\nThe new FAQ is unpublished. Review it before publishing; search and discovery do not return it yet.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]"
    },
    {
      "id": "promote-a-reviewed-proposal",
      "title": "Promote a reviewed proposal",
      "role": "content",
      "text": "If an answer comes from the proposal inbox, [review the candidate and its evidence](https://redis.io/docs/latest/develop/ai/context-engine/agent-playbooks/proposals#review-and-edit-a-candidate) first. Accept the proposal with the revision you reviewed.\n\nAcceptance returns an entry and version for one unpublished FAQ. Save those values and continue with publication. Promotion does not make the answer available to agents, and it does not update an existing FAQ."
    },
    {
      "id": "publish-a-version",
      "title": "Publish a version",
      "role": "content",
      "text": "1. Retrieve the exact version you intend to publish.\n2. Review its answer, intents, and audience attributes.\n3. Publish that version with `publish_faq`.\n4. Test retrieval with a reader key and a representative question.\n\nTest a paraphrase such as “Where can I see my refund?” and a nearby question the answer does not cover, such as “How do I request a refund?” Check the returned entry and audience, then use the [retrieval guide](https://redis.io/docs/latest/develop/ai/context-engine/agent-playbooks/retrieval) to tune matching.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]\n\n\n\nPublish the version you reviewed.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]\n\n\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]"
    },
    {
      "id": "update-an-answer",
      "title": "Update an answer",
      "role": "content",
      "text": "Append a complete replacement version to the same entry with `append_faq_version`. Include the intents, attributes, and metadata you want that version to contain.\n\nCoordinate publishers for the same entry. Concurrent publication changes are last-write-wins. Publishing an already published version is a no-op.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]\n\n\n\nThe identifier stays the same, and search still serves the first publication. Review and publish the new version, then search again.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]\n\n\n\nRepublish the first version to roll back.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]"
    },
    {
      "id": "list-entries-and-inspect-history",
      "title": "List entries and inspect history",
      "role": "content",
      "text": "Use `list_faqs` to list entries, including unpublished ones, and `get_faq` to read a summary. Both require `read`. Summaries show the latest version number and any publication, without draft content.\n\nFollow the pagination cursor until it is absent, even after an empty page. Keep filters and sort settings unchanged. Responses return `items` and `nextCursor` and don't include a total count. Lists can change while you page through them.\n\nCLI lists and version history follow all cursors automatically and return an array. Use `--page` for one page with `nextCursor`, and `--cursor` to continue it. The CLI's version output currently omits `contentDigest`; use an SDK or cURL example when you need that field.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]\n\n\n\nFor inventory counts, call `get_playbook_stats` with a reader key. Each count has an `available` flag: unavailable is different from zero. Counts are observations, not a fixed snapshot of the lists.\n\n**Available in:** Python (Iris), cURL (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n\n\nTo select only published or unpublished entries, set `published` to `true` or `false`. Omit it to include both.\n\nListing full version history requires `write` or `publish`. Versions arrive newest first. This example uses the FAQ created in this guide:\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]"
    },
    {
      "id": "look-up-entry-state",
      "title": "Look up entry state",
      "role": "content",
      "text": "Use `lookup_entries` with `write` or `publish` permission to inspect known FAQs or skills. Supply 1–100 references, each containing either an entry identifier or an entry key. Results preserve request order and report missing entries explicitly. The batch is not a fixed snapshot.\n\nThe published CLI has no batch lookup command. Use one of the SDK or cURL tabs for this operation.\n\nEach found entry includes `latest`, optional `publication`, and `versionCount`. The response also reports the playbook's `maxVersions` limit. The two version summaries include `contentDigest`: a server-generated hash of normalized authored content. Compare their digests to check whether the latest and published content match. It is not a hash of the uploaded ZIP or the raw request, and it is not an idempotency key.\n\n**Available in:** Python (Iris), cURL (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n\n\nThe example finds the same FAQ by identifier and by key. Either identifies the entry across versions, not a particular publication. Before retrying an uncertain write, inspect its state and relevant version. Appending identical content can still create another version."
    },
    {
      "id": "withdraw-or-delete-an-faq",
      "title": "Withdraw or delete an FAQ",
      "role": "content",
      "text": "Use `withdraw_faq` to stop serving the answer while retaining the entry and its versions. Use `delete_faq` to remove the entry and its history permanently.\n\nSet `PLAYBOOK_FAQ_ID` to the printed entry identifier before running a withdrawal or deletion example with the same connection values.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]\n\n\n\nWhen you no longer need the sample history, delete the entry.\n\n**Available in:** Python (Iris), cURL (Iris), CLI (Iris)\n\n##### Python (Iris)\n\n[code example]\n\n##### cURL (Iris)\n\n[code example]\n\n##### CLI (Iris)\n\n[code example]"
    }
  ],
  "examples": [
    {
      "id": "create-a-draft-faq-ex0",
      "language": "python",
      "code": "faq_content = {\n    \"intents\": [\"Check a refund\", \"Find an existing refund\"],\n    \"attributes\": {\"locale\": \"en-US\", \"topic\": \"refund\"},\n    \"payload\": {\n        \"faq\": {\n            \"question\": \"How do I check the status of a refund?\",\n            \"answer\": (\n                \"Open the order in your order history and select Refund status. \"\n                \"If no refund is listed, contact support with your order number.\"\n            ),\n        }\n    },\n}\n\ndraft = playbook.client.create_faq(content=faq_content, entry_key=\"refund-status\")\nfaq_id = draft.entry.entry_id\nversion = draft.version.version\nprint(faq_id, version, draft.entry.publication)",
      "section_id": "create-a-draft-faq"
    },
    {
      "id": "create-a-draft-faq-ex1",
      "language": "bash",
      "code": "cat > faq.json <<'JSON'\n{\n  \"entryKey\": \"refund-status\",\n  \"content\": {\n    \"intents\": [\"Check a refund\", \"Find an existing refund\"],\n    \"attributes\": {\"locale\": \"en-US\", \"topic\": \"refund\"},\n    \"payload\": {\"faq\": {\n      \"question\": \"How do I check the status of a refund?\",\n      \"answer\": \"Open the order in your order history and select Refund status. If no refund is listed, contact support with your order number.\"\n    }}\n  }\n}\nJSON\ncurl --fail-with-body --silent --show-error \\\n  -X POST \"$PLAYBOOK_API/faqs\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n  -H 'Content-Type: application/json' --data-binary @faq.json > draft.json\nFAQ_ID=$(jq -er '.entry.entryId' draft.json)\nVERSION=$(jq -er '.version.version' draft.json)\njq '{entryId: .entry.entryId, version: .version.version, publication: .entry.publication}' draft.json",
      "section_id": "create-a-draft-faq"
    },
    {
      "id": "create-a-draft-faq-ex2",
      "language": "bash",
      "code": "cat > faq.json <<'JSON'\n{\n  \"entryKey\": \"refund-status\",\n  \"question\": \"How do I check the status of a refund?\",\n  \"answer\": \"Open the order in your order history and select Refund status. If no refund is listed, contact support with your order number.\",\n  \"intents\": [\"Check a refund\", \"Find an existing refund\"],\n  \"attributes\": {\"locale\": \"en-US\", \"topic\": \"refund\"}\n}\nJSON\niris agent-playbooks faqs validate faq.json\niris --json agent-playbooks faqs push faq.json > faq-draft.json\nFAQ_ID=$(jq -er '.results[0].entryId' faq-draft.json)\nVERSION=$(jq -er '.results[0].version' faq-draft.json)\njq . faq-draft.json",
      "section_id": "create-a-draft-faq"
    },
    {
      "id": "publish-a-version-ex0",
      "language": "python",
      "code": "stored = playbook.client.get_faq_version(faq_id=faq_id, version=version)\nprint(stored.content)",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex1",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  \"$PLAYBOOK_API/faqs/$FAQ_ID/versions/$VERSION\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" | jq .content",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex2",
      "language": "bash",
      "code": "iris --json agent-playbooks faqs show \"$FAQ_ID\" --version \"$VERSION\" | jq .content",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex3",
      "language": "python",
      "code": "playbook.client.publish_faq(faq_id=faq_id, version=version)",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex4",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  -X PUT \"$PLAYBOOK_API/faqs/$FAQ_ID/publication\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data \"$(jq -n --argjson version \"$VERSION\" '{version: $version}')\" | jq .publication",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex5",
      "language": "bash",
      "code": "iris agent-playbooks faqs publish \"$FAQ_ID\" --version \"$VERSION\"",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex6",
      "language": "python",
      "code": "results = playbook.client.search_faqs(\n    query=\"Where can I see how my refund is progressing?\",\n    filter_={\"eq\": {\"name\": \"locale\", \"value\": \"en-US\"}},\n    limit=5,\n)\nfor match in results.items:\n    if match.faq is not None:\n        print(match.entry_id, match.version, match.score, match.faq.answer)",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex7",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  -X POST \"$PLAYBOOK_API/faqs/search\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data '{\"query\":\"Where can I see how my refund is progressing?\",\"filter\":{\"eq\":{\"name\":\"locale\",\"value\":\"en-US\"}},\"limit\":5}' \\\n  | jq '.items[] | {entryId, version, score, answer: .faq.answer}'",
      "section_id": "publish-a-version"
    },
    {
      "id": "publish-a-version-ex8",
      "language": "bash",
      "code": "cat > search.json <<'JSON'\n{\n  \"query\": \"Where can I see how my refund is progressing?\",\n  \"filter\": {\"eq\": {\"name\": \"locale\", \"value\": \"en-US\"}},\n  \"limit\": 5\n}\nJSON\niris --json agent-playbooks faqs search --input search.json | jq .items",
      "section_id": "publish-a-version"
    },
    {
      "id": "update-an-answer-ex0",
      "language": "python",
      "code": "from copy import deepcopy\n\nupdated_content = deepcopy(faq_content)\nupdated_content[\"payload\"][\"faq\"][\"answer\"] += (\n    \" Support can check the current stage but cannot guarantee a bank posting date.\"\n)\nupdated = playbook.client.append_faq_version(faq_id=faq_id, content=updated_content)\nprint(\"Review this version:\", updated.version.version, updated.version.content)",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex1",
      "language": "bash",
      "code": "jq 'del(.entryKey) | .content.payload.faq.answer += \" Support can check the current stage but cannot guarantee a bank posting date.\"' \\\n  faq.json > faq-update.json\ncurl --fail-with-body --silent --show-error \\\n  -X POST \"$PLAYBOOK_API/faqs/$FAQ_ID/versions\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n  -H 'Content-Type: application/json' --data-binary @faq-update.json > updated.json\njq .version updated.json",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex2",
      "language": "bash",
      "code": "jq '.answer += \" Support can check the current stage but cannot guarantee a bank posting date.\"' \\\n  faq.json > faq-update.json\niris --json agent-playbooks faqs push faq-update.json > faq-updated.json\nUPDATED_VERSION=$(jq -er '.results[0].version' faq-updated.json)\niris --json agent-playbooks faqs show \"$FAQ_ID\" --version \"$UPDATED_VERSION\" | jq .content",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex3",
      "language": "python",
      "code": "playbook.client.publish_faq(faq_id=faq_id, version=updated.version.version)",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex4",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  -X PUT \"$PLAYBOOK_API/faqs/$FAQ_ID/publication\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data \"$(jq '{version: .version.version}' updated.json)\" | jq .publication",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex5",
      "language": "bash",
      "code": "iris agent-playbooks faqs publish \"$FAQ_ID\" --version \"$UPDATED_VERSION\"",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex6",
      "language": "python",
      "code": "playbook.client.publish_faq(faq_id=faq_id, version=version)",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex7",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  -X PUT \"$PLAYBOOK_API/faqs/$FAQ_ID/publication\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data \"$(jq -n --argjson version \"$VERSION\" '{version: $version}')\" | jq .publication",
      "section_id": "update-an-answer"
    },
    {
      "id": "update-an-answer-ex8",
      "language": "bash",
      "code": "iris agent-playbooks faqs publish \"$FAQ_ID\" --version \"$VERSION\"",
      "section_id": "update-an-answer"
    },
    {
      "id": "list-entries-and-inspect-history-ex0",
      "language": "python",
      "code": "cursor = None\nwhile True:\n    page = playbook.client.list_faqs(sort_by=\"updatedAt\", sort_order=\"DESC\", limit=50, cursor=cursor)\n    for entry in page.items:\n        print(entry.entry_id, entry.latest_version, entry.publication)\n    cursor = page.next_cursor\n    if cursor is None:\n        break",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "list-entries-and-inspect-history-ex1",
      "language": "bash",
      "code": "CURSOR=''\nwhile true; do\n  PAGE_ARGS=(--data-urlencode sortBy=updatedAt --data-urlencode sortOrder=DESC --data-urlencode limit=50)\n  if [[ -n \"$CURSOR\" ]]; then PAGE_ARGS+=(--data-urlencode \"cursor=$CURSOR\"); fi\n  curl --fail-with-body --silent --show-error --get \"$PLAYBOOK_API/faqs\" \\\n    -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \"${PAGE_ARGS[@]}\" > faq-page.json\n  jq '.items[] | {entryId, latestVersion, publication}' faq-page.json\n  CURSOR=$(jq -r '.nextCursor // empty' faq-page.json)\n  [[ -n \"$CURSOR\" ]] || break\ndone",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "list-entries-and-inspect-history-ex2",
      "language": "bash",
      "code": "iris --json agent-playbooks faqs list --sort-by updatedAt --sort-order desc --page-size 50 | jq .",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "list-entries-and-inspect-history-ex3",
      "language": "python",
      "code": "stats = playbook.client.get_playbook_stats()\nprint(\"Observed at:\", stats.observed_at)\nfor label, count in ((\"FAQs\", stats.faqs.total), (\"Skills\", stats.skills.total)):\n    print(label, count.value if count.available else \"unavailable\")",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "list-entries-and-inspect-history-ex4",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  \"$PLAYBOOK_API/stats\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n  | jq '{observedAt, faqs: (if .faqs.total.available then .faqs.total.value else \"unavailable\" end), skills: (if .skills.total.available then .skills.total.value else \"unavailable\" end)}'",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "list-entries-and-inspect-history-ex5",
      "language": "python",
      "code": "cursor = None\nwhile True:\n    page = playbook.client.list_faq_versions(faq_id=faq_id, limit=50, cursor=cursor)\n    for item in page.items:\n        print(item.version, item.content_digest, item.content)\n    cursor = page.next_cursor\n    if cursor is None:\n        break",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "list-entries-and-inspect-history-ex6",
      "language": "bash",
      "code": "CURSOR=''\nwhile true; do\n  PAGE_ARGS=(--data-urlencode limit=50)\n  if [[ -n \"$CURSOR\" ]]; then PAGE_ARGS+=(--data-urlencode \"cursor=$CURSOR\"); fi\n  curl --fail-with-body --silent --show-error --get \"$PLAYBOOK_API/faqs/$FAQ_ID/versions\" \\\n    -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \"${PAGE_ARGS[@]}\" > faq-versions.json\n  jq '.items[] | {version, contentDigest, content}' faq-versions.json\n  CURSOR=$(jq -r '.nextCursor // empty' faq-versions.json)\n  [[ -n \"$CURSOR\" ]] || break\ndone",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "list-entries-and-inspect-history-ex7",
      "language": "bash",
      "code": "iris --json agent-playbooks faqs versions \"$FAQ_ID\" --page-size 50 | jq .",
      "section_id": "list-entries-and-inspect-history"
    },
    {
      "id": "look-up-entry-state-ex0",
      "language": "python",
      "code": "from redis_agent_playbook.models import Found\n\nlookup = playbook.client.lookup_entries(\n    references=[\n        {\"entry_id\": faq_id},\n        {\"entry_key\": \"refund-status\"},\n    ]\n)\nprint(\"Version limit:\", lookup.max_versions)\nfor result in lookup.items:\n    if isinstance(result, Found):\n        state = result.found.entry\n        print(state.entry_id, state.version_count, state.latest, state.publication)\n    else:\n        print(\"Missing:\", result.missing.reference)",
      "section_id": "look-up-entry-state"
    },
    {
      "id": "look-up-entry-state-ex1",
      "language": "bash",
      "code": "jq -n --arg id \"$FAQ_ID\" '{references: [{entryId: $id}, {entryKey: \"refund-status\"}]}' \\\n  | curl --fail-with-body --silent --show-error \\\n    -X POST \"$PLAYBOOK_API/entries/lookup\" \\\n    -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" \\\n    -H 'Content-Type: application/json' --data-binary @- \\\n  | jq '{maxVersions, items}'",
      "section_id": "look-up-entry-state"
    },
    {
      "id": "withdraw-or-delete-an-faq-ex0",
      "language": "python",
      "code": "playbook.client.withdraw_faq(faq_id=faq_id)",
      "section_id": "withdraw-or-delete-an-faq"
    },
    {
      "id": "withdraw-or-delete-an-faq-ex1",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  -X DELETE \"$PLAYBOOK_API/faqs/$FAQ_ID/publication\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\" | jq .",
      "section_id": "withdraw-or-delete-an-faq"
    },
    {
      "id": "withdraw-or-delete-an-faq-ex2",
      "language": "bash",
      "code": "iris agent-playbooks faqs withdraw \"$PLAYBOOK_FAQ_ID\"",
      "section_id": "withdraw-or-delete-an-faq"
    },
    {
      "id": "withdraw-or-delete-an-faq-ex3",
      "language": "python",
      "code": "playbook.client.delete_faq(faq_id=faq_id)",
      "section_id": "withdraw-or-delete-an-faq"
    },
    {
      "id": "withdraw-or-delete-an-faq-ex4",
      "language": "bash",
      "code": "curl --fail-with-body --silent --show-error \\\n  -X DELETE \"$PLAYBOOK_API/faqs/$FAQ_ID\" \\\n  -H \"Authorization: Bearer $IRIS_AGENT_PLAYBOOKS_API_KEY\"",
      "section_id": "withdraw-or-delete-an-faq"
    },
    {
      "id": "withdraw-or-delete-an-faq-ex5",
      "language": "bash",
      "code": "iris agent-playbooks faqs delete \"$PLAYBOOK_FAQ_ID\" --yes",
      "section_id": "withdraw-or-delete-an-faq"
    }
  ]
}
