diff --git a/content/.metadata.json b/content/.metadata.json index 76a2dd4166..8b7e66b147 100644 --- a/content/.metadata.json +++ b/content/.metadata.json @@ -1,7 +1,7 @@ { "metadata": { "version": "2.0", - "fetch_date": "2026-11-24T20:57:06.239509Z", + "fetch_date": "2026-11-25T00:28:34.510305Z", "section": "all" }, "items": [ @@ -30,7 +30,7 @@ "url": "https://platform.claude.com/docs/en/get-started", "status": "success", "path": "en/get-started.md", - "sha256": "76aa29c015b9cc53c78210ac411e5b706bc579f1a9a07866791feb8a0b8fcd91", + "sha256": "8346bb0d3f6b3eb83ef121573219994caad7c469d29769b9f9227aabc2d752c5", "size": 21310 }, { @@ -44,8 +44,8 @@ "url": "https://platform.claude.com/docs/en/build-with-claude/overview", "status": "success", "path": "en/build-with-claude/overview.md", - "sha256": "c4a235cd54767f0ea12a15b88adbe6743a4fa077cb05217163cbeeee655e3f9a", - "size": 22325 + "sha256": "5ce74eb435ed412ae99c230dbea78c0e1d34600e5d23247e845405f1d8d218e2", + "size": 22525 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/working-with-messages", @@ -555,7 +555,7 @@ "url": "https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart", "status": "success", "path": "en/agents-and-tools/agent-skills/quickstart.md", - "sha256": "10f3a982dd95ec3ce5fef63c416b14fb8145ce40a3684efd7ccc78b438562ea1", + "sha256": "a0b21713005d74ffacaf0d6cb22101034fb9bb6f4ffbb17974e493a35fea07e5", "size": 44102 }, { @@ -590,7 +590,7 @@ "url": "https://platform.claude.com/docs/en/agents-and-tools/mcp-connector", "status": "success", "path": "en/agents-and-tools/mcp-connector.md", - "sha256": "327445d6da5ded3dc51372dc8f97570ea82ceee9a43883cf9b9b9b7c25f8f483", + "sha256": "c490dfa1143c0175daafa01f5e4f20d0f16d695270ddea59b638f78e78e17989", "size": 71430 }, { @@ -660,7 +660,7 @@ "url": "https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock", "status": "success", "path": "en/build-with-claude/claude-in-amazon-bedrock.md", - "sha256": "7f589a0922820402ba330499e33d3133f46260d012d57e6988958a7c35097a0a", + "sha256": "3a16c25504956745a7e5c95d863f9977f1f64c2974d4b3ab1159a7d53ec86a66", "size": 22846 }, { @@ -674,14 +674,14 @@ "url": "https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws", "status": "success", "path": "en/build-with-claude/claude-platform-on-aws.md", - "sha256": "692b72574f8be5b4c9fbfff534a18fba85ab30fc4721383355b75f13486eed20", - "size": 87949 + "sha256": "ebf212c87cac0a1fb17f8f961fb519abb8273706f32c7115a8ad1c70bb082473", + "size": 87931 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry", "status": "success", "path": "en/build-with-claude/claude-in-microsoft-foundry.md", - "sha256": "ad607691ae0d9e7f9484caec3666596863776ebf1e5375c3cde46c3b8ee6269c", + "sha256": "4da1ae6dc6c71f4cc5f2c25642f249eab5fe421550834a8458aa0fb592d5e1ca", "size": 35566 }, { @@ -695,14 +695,14 @@ "url": "https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed", "status": "success", "path": "en/build-with-claude/claude-models-on-google-cloud/anthropic-managed.md", - "sha256": "b0a610ab03fba16373127e5dbbb40e1e0e1be7d30f41478f787abdd94367cdfa", - "size": 67256 + "sha256": "334bd54ba799bcbf41a038c6680772e5b4ed5d4ea43a145d15f4c247c4b0ff7e", + "size": 67238 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/google-managed", "status": "success", "path": "en/build-with-claude/claude-models-on-google-cloud/google-managed.md", - "sha256": "a6ec079b4530f3ce3f1bb0dbc9dc8ab455ac78f074c6ee94b92e2e3ca3a078e8", + "sha256": "ed4c1d031253c5d89e081479b9b4f9c5a2b5ad19955df79228fa3060ba389fc9", "size": 31768 }, { @@ -716,7 +716,7 @@ "url": "https://platform.claude.com/docs/en/managed-agents/quickstart", "status": "success", "path": "en/managed-agents/quickstart.md", - "sha256": "61420ff8379bc7ccdb1e81b1279d048e0ab12003a5b81309eec6e2b615942c18", + "sha256": "fe59398110e79885850254e751e35bbbc446b532e6fe2240a06c8da139319185", "size": 42749 }, { @@ -800,7 +800,7 @@ "url": "https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes", "status": "success", "path": "en/managed-agents/self-hosted-sandboxes.md", - "sha256": "12a98f6f642a179cc3ef911908b956242a6f50b8ad1621ec8960de25bfba01c2", + "sha256": "874e24062929cc43d6ae8acc85e08b70277950367f9f908a056750da1eb031b7", "size": 30975 }, { @@ -814,7 +814,7 @@ "url": "https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-per-session", "status": "success", "path": "en/managed-agents/self-hosted-sandboxes-per-session.md", - "sha256": "dfb9f9ca5dd8dc79d773fc09756a21264bdf11c382fab8c6769d251141bfb26c", + "sha256": "4d4a575f508431645f8731cbb41f5673eab40311c87d3a5728ea5a789b1a10e1", "size": 28407 }, { @@ -1129,8 +1129,8 @@ "url": "https://platform.claude.com/docs/en/manage-claude/user-profiles", "status": "success", "path": "en/manage-claude/user-profiles.md", - "sha256": "392ecc983ea2f487d3e837bbf7a1132166849c9b46d61459ae9e1071217b28fd", - "size": 38297 + "sha256": "5a633bbee7fbed6c34efa1b66032b327e9b5a72245548e6d0809ec59214aecef", + "size": 38261 }, { "url": "https://platform.claude.com/docs/en/manage-claude/user-profiles-verification-portal", @@ -1139,6 +1139,83 @@ "sha256": "67dfde78a77b537c718493980026715cc94a40f1332e9a279592a20a7838bf36", "size": 11325 }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview", + "status": "success", + "path": "en/manage-claude/oauth-apps/overview.md", + "sha256": "192e7de0f672082ff0541ff537f9ac159d26b2b029454ce9881225c0b454b96d", + "size": 5717 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters", + "status": "success", + "path": "en/manage-claude/oauth-apps/endpoints-and-parameters.md", + "sha256": "cf90be16024bc43e3e3e02154ece23cbd4ce8ab12a3f2cdb6e9162d79c2388ac", + "size": 24076 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing.md", + "sha256": "42b4f953e4dca6c28c93d69a02b8d21f3b4807d544ef0d0b02c896b414e73157", + "size": 12784 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/set-up-your-app.md", + "sha256": "f3d25968b2a96be0e30b3e62bee8a2496f308c3519e064892568ddae5f4fa945", + "size": 20414 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer.md", + "sha256": "470ab035aeda80ce50667e6d8a04e7b286f02696834cda71924872de73804e6f", + "size": 68878 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/link-button.md", + "sha256": "101ec35c50c7e49d68ce6aeb415764cbe5d6f0f44affdff848674beee46dc0e7", + "size": 12623 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/what-your-customers-see.md", + "sha256": "82ea24ee33b34332a7ace965fab969fe12f3a4b7a0a2c1e7861bfa867727ea71", + "size": 12213 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/test-and-publish.md", + "sha256": "a1016bbbb7eeec98a797dfff09933733aa2d92324e4630ce9dfc2c129c50aa70", + "size": 18241 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/manage-customers.md", + "sha256": "06f41bcdf09456c1e9204bda89f7588423871b80f9bc6b7b5271d8f7a1f0827a", + "size": 29207 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer.md", + "sha256": "e0cdc6dfbb684d3159752f8a48fc4e80b01120a570a0346fe79232d25b398e9f", + "size": 101998 + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors", + "status": "success", + "path": "en/manage-claude/oauth-apps/linked-billing/errors.md", + "sha256": "12a6dafabba8c2599678cd3fda0e2cb1547061dd198221cbd07b603d7472e34d", + "size": 24564 + }, { "url": "https://platform.claude.com/docs/en/manage-claude/admin-api-keys", "status": "success", @@ -1283,7 +1360,7 @@ "url": "https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk", "status": "success", "path": "en/manage-claude/opentelemetry/sdk.md", - "sha256": "2fed5f239930489705a4118a4aa40cb029985cb11ab1bf048ed0a8f6c97c76fd", + "sha256": "d237164a531458edb639d0885fffbfd94f1d7f12a2209e3f18fe267e8e4cd1c9", "size": 34222 }, { @@ -1311,8 +1388,8 @@ "url": "https://platform.claude.com/docs/en/manage-claude/access-transparency", "status": "success", "path": "en/manage-claude/access-transparency.md", - "sha256": "996d15e64c309a499164e4bfc54335f7d817e246451ac466d7b5b9ab9f6ffa6f", - "size": 25473 + "sha256": "fe6cf46dd0b9f89b5be08b7b3134232ecb36745d3d67eb690d862515a3ec6450", + "size": 25795 }, { "url": "https://platform.claude.com/docs/en/manage-claude/access-transparency-log", @@ -1941,8 +2018,8 @@ "url": "https://platform.claude.com/docs/en/about-claude/model-deprecations", "status": "success", "path": "en/about-claude/model-deprecations.md", - "sha256": "035274dd190aeed4914c26cf72b5d17cfcb7ea81138c6c63e5b1b7c0372d217e", - "size": 15035 + "sha256": "0289ee368d522d984505015751c7ddddb394d05a12caa205253e38f40606f4e3", + "size": 13278 }, { "url": "https://platform.claude.com/docs/en/resources/overview", @@ -2137,14 +2214,14 @@ "url": "https://platform.claude.com/docs/en/cli-sdks-libraries/overview", "status": "success", "path": "en/cli-sdks-libraries/overview.md", - "sha256": "ecef1d3dffe92e347dc126e6c332a2d7ab45f777ada9a3a6915aea2f90e5d45b", + "sha256": "777267a2f2c173f9a63bc0681321e0d01d4c86f83007d6233f23415846782803", "size": 5226 }, { "url": "https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart", "status": "success", "path": "en/cli-sdks-libraries/cli/quickstart.md", - "sha256": "feec71e877036144156986078f4b80baae8c9a26a9d7befd7f3a61b746c749ba", + "sha256": "1d59df611e248f08ab6c551db367766698a0ed7eff07229fff16496f9ba1f1de", "size": 5563 }, { @@ -2221,7 +2298,7 @@ "url": "https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/java", "status": "success", "path": "en/cli-sdks-libraries/sdks/java.md", - "sha256": "48f2a6aa3581115f25d9d9d96d8deedbc12fb1d8ceefa132c61d1c5eede6323e", + "sha256": "def5972dd97500fed68d3ea189fbdae6f25cde85dbbfe24198f2b27470fd9999", "size": 51021 }, { @@ -2354,8 +2431,8 @@ "url": "https://platform.claude.com/docs/en/release-notes/overview", "status": "success", "path": "en/release-notes/overview.md", - "sha256": "90cfa2196e8091c113777fa3a6799d5894c7bccb7a32b1ad2529bbf6a87bd2c1", - "size": 148608 + "sha256": "1d3fb48bc2ac8490f4d465c93a101a7a1b7d3ba469c4ee31807d40f86270ba80", + "size": 148590 }, { "url": "https://platform.claude.com/docs/en/api/messages", @@ -6676,41 +6753,6 @@ "sha256": "1eb85f1d9f652ee7a92bdd631e330faa9db07ec5e3918ea53c280fd2e2b38936", "size": 1059 }, - { - "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/app-review", - "status": "success", - "path": "en/manage-claude/oauth-apps/app-review.md", - "sha256": "5b169b34e489880144ef368845f2858320484eaa1c3dfbdbcd89af780bb39a32", - "size": 16521 - }, - { - "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/branding-samples", - "status": "success", - "path": "en/manage-claude/oauth-apps/branding-samples.md", - "sha256": "b4e2bcccdcba491dcc9dc738c601173fdfd013559104fa4376e31738f46af07e", - "size": 9751 - }, - { - "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/oauth-reference", - "status": "success", - "path": "en/manage-claude/oauth-apps/oauth-reference.md", - "sha256": "b196a48b4cc0576233d80ae27e49490aea8ece292f5bbdc52218242a81f6f64f", - "size": 27030 - }, - { - "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/organization-billing-connections", - "status": "success", - "path": "en/manage-claude/oauth-apps/organization-billing-connections.md", - "sha256": "7d489055093e243c86715fc467885be6bcd6478d0b33d975d62458db52ab62dd", - "size": 121980 - }, - { - "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview", - "status": "success", - "path": "en/manage-claude/oauth-apps/overview.md", - "sha256": "feb5181a2019c39b4c95525df3dc55365338f81267c338a709e3606017bf6daf", - "size": 4460 - }, { "url": "https://code.claude.com/docs/en/overview", "status": "success", @@ -6764,8 +6806,8 @@ "url": "https://code.claude.com/docs/en/prompt-caching", "status": "success", "path": "en/docs/claude-code/prompt-caching.md", - "sha256": "e152e2fe7bcdba32515581ad298a6f8fdbfe820e25a5a6cced667ea65a4483e5", - "size": 43089 + "sha256": "3fa54a7efe54261936bfce916dfdad539381e8ea5ba292bab1cfbea0f568f444", + "size": 43226 }, { "url": "https://code.claude.com/docs/en/memory", @@ -6820,8 +6862,8 @@ "url": "https://code.claude.com/docs/en/claude-projects", "status": "success", "path": "en/docs/claude-code/claude-projects.md", - "sha256": "2cf89f88f05f7527ce00b88d47b39fdca417616808468ecc306fb0d5659c609c", - "size": 62468 + "sha256": "5bb767bacdc146169fb4e59f2d16750d16c08445c7e84ba4130f993dc80c54b4", + "size": 62633 }, { "url": "https://code.claude.com/docs/en/mobile", @@ -6848,8 +6890,8 @@ "url": "https://code.claude.com/docs/en/vs-code", "status": "success", "path": "en/docs/claude-code/vs-code.md", - "sha256": "df0bc7f14e5d3a352f61296bb10f23c49fc62f0647cff199a1e9bcb5fb21809a", - "size": 107471 + "sha256": "b3b547d5f0cddd0408801efbde1d98183d5be4a8d06a827dbdb68f7c6ec3f2c4", + "size": 108234 }, { "url": "https://code.claude.com/docs/en/jetbrains", @@ -6904,8 +6946,8 @@ "url": "https://code.claude.com/docs/en/desktop", "status": "success", "path": "en/docs/claude-code/desktop.md", - "sha256": "ff412ff7b4abb79b3f7d2a8c583200a93f4f8233ced8394027e2deb63ac10bc8", - "size": 229978 + "sha256": "265d24c53d3db19fe2c847738e20b8da9a5b795b43d6871ed0404a4223011280", + "size": 230181 }, { "url": "https://code.claude.com/docs/en/desktop-linux", @@ -7002,8 +7044,8 @@ "url": "https://code.claude.com/docs/en/pr-steward-setup", "status": "success", "path": "en/docs/claude-code/pr-steward-setup.md", - "sha256": "35125c3a9f8b4df31b451416bfdf7795ee5a1aacb03056b103f7c9c2a0bdef99", - "size": 15771 + "sha256": "548674f04287e62879011a525e36a83d69640fde308ce74b3c8c961630c65a41", + "size": 16189 }, { "url": "https://code.claude.com/docs/en/pr-steward-pull-requests", @@ -7023,8 +7065,8 @@ "url": "https://code.claude.com/docs/en/pr-steward-troubleshooting", "status": "success", "path": "en/docs/claude-code/pr-steward-troubleshooting.md", - "sha256": "84796d7b5f63ae9268cec63df01c34d6d461627f80fd03651dfc3bf203a47cf2", - "size": 9782 + "sha256": "931083565cd129e3cbe12fa9dd4c3655d601b209e5ac24a230ee26de0c8c5406", + "size": 10745 }, { "url": "https://code.claude.com/docs/en/approvals", @@ -7037,15 +7079,15 @@ "url": "https://code.claude.com/docs/en/approvals-setup", "status": "success", "path": "en/docs/claude-code/approvals-setup.md", - "sha256": "837216b31e67a95e321aeb451ab761f11ac8d336d0e7a8428b7c18888580e217", - "size": 15621 + "sha256": "f56b666a558b50c22eea17c554a2141a94b1b03ce2e8f318b54de6ff28010422", + "size": 15838 }, { "url": "https://code.claude.com/docs/en/approvals-pull-requests", "status": "success", "path": "en/docs/claude-code/approvals-pull-requests.md", - "sha256": "120c16bdad9373a062cd377cbe72fbfeaecdc9ccd616cfc2d206cba981ffb476", - "size": 13169 + "sha256": "2d335e32bc3c752859ce42fd011ded946f6e3f434d18a61511a87d6edad08442", + "size": 12954 }, { "url": "https://code.claude.com/docs/en/approvals-github-rules", @@ -7079,15 +7121,15 @@ "url": "https://code.claude.com/docs/en/ship-command", "status": "success", "path": "en/docs/claude-code/ship-command.md", - "sha256": "56d20bd24896580ae28456b3307161f319296cda00080406f35e494087ebfb28", - "size": 20741 + "sha256": "58840ee54e1b232fb5d5f85db28df95d047162c8d36632ae2128603950bc3a7b", + "size": 27148 }, { "url": "https://code.claude.com/docs/en/ship-command-troubleshooting", "status": "success", "path": "en/docs/claude-code/ship-command-troubleshooting.md", - "sha256": "ed02eb7f63a5044a2834bcf445b300241319a379f578b7adb7dc0d4134f0b08e", - "size": 18909 + "sha256": "27880632e452a2a377cc266253d242394688bcd6d5f7b9499200a787466882e5", + "size": 25227 }, { "url": "https://code.claude.com/docs/en/code-review-local", @@ -7114,8 +7156,8 @@ "url": "https://code.claude.com/docs/en/claude-security", "status": "success", "path": "en/docs/claude-code/claude-security.md", - "sha256": "066e0c992efe84f483e98caecd1b0d9166cffbb694fd8ad1d02bf49031aa4fc3", - "size": 16781 + "sha256": "5b7324657a5045492c3be3097a95f55262051e1e53356c1cc09882258e1e8757", + "size": 28474 }, { "url": "https://code.claude.com/docs/en/github-actions", @@ -7149,15 +7191,15 @@ "url": "https://code.claude.com/docs/en/sub-agents", "status": "success", "path": "en/docs/claude-code/sub-agents.md", - "sha256": "357c2e39a5f773b8594c72ee23e007b6a751998404cd0cbbe35b4b0935dad672", - "size": 114675 + "sha256": "a751a8e69f618d15d4a5a6c66075fd4306b0cced42e7c411039890ae70c594ef", + "size": 114706 }, { "url": "https://code.claude.com/docs/en/agent-view", "status": "success", "path": "en/docs/claude-code/agent-view.md", - "sha256": "102fda743c242f91256b48d078152763fd39e9f7b9908626ef2b230755759c46", - "size": 145821 + "sha256": "09e4870a39d9f4bb01b04bae641cbdd139f7ae9717aeecd161b876489a52f5c6", + "size": 146664 }, { "url": "https://code.claude.com/docs/en/agent-teams", @@ -7205,8 +7247,8 @@ "url": "https://code.claude.com/docs/en/skills", "status": "success", "path": "en/docs/claude-code/skills.md", - "sha256": "5039010e0f743573a5d9d1ecb0b61b5d96fe53e656f7e4321fe4bef3e2ffc9ca", - "size": 121289 + "sha256": "537004c08aad82555e5abc166d39bdcae46efd68372f08b06a65c528f2d795fd", + "size": 120971 }, { "url": "https://code.claude.com/docs/en/artifacts", @@ -7268,8 +7310,8 @@ "url": "https://code.claude.com/docs/en/troubleshoot-install", "status": "success", "path": "en/docs/claude-code/troubleshoot-install.md", - "sha256": "3d74f8b4edca2df0c0959fcc04d2e17637c76b7abf4af1604e23bdfd53891841", - "size": 82064 + "sha256": "e37daa530b1646bccad27e2c3bf3239e5851d155f0d8c8e4959cca44b0bff092", + "size": 82233 }, { "url": "https://code.claude.com/docs/en/troubleshooting", @@ -7289,8 +7331,8 @@ "url": "https://code.claude.com/docs/en/errors", "status": "success", "path": "en/docs/claude-code/errors.md", - "sha256": "a5b718fe3c49c00bd3bdc3f4b222fadd9db534f9ca2018468638bf07b507f9cd", - "size": 645161 + "sha256": "4f01b691d34a7168130973e19bedb312d5d07e56d2d115b4da41656f2e0b8364", + "size": 647428 }, { "url": "https://code.claude.com/docs/en/plugins/overview", @@ -7394,15 +7436,15 @@ "url": "https://code.claude.com/docs/en/plugins/mods/reference", "status": "success", "path": "en/docs/claude-code/plugins/mods/reference.md", - "sha256": "8e3fe5b055b1b4b3f8ba67ce5490703d80b4dc61754ac94a5fcd69686d6e6ffb", - "size": 54709 + "sha256": "a654a17c7e618c0ca7a74aa01160a3ddba3095454c1a9992c0e295d90d875522", + "size": 56175 }, { "url": "https://code.claude.com/docs/en/plugins/mods/interface", "status": "success", "path": "en/docs/claude-code/plugins/mods/interface.md", - "sha256": "b4766bca62b1cc6be45888c1f2e9c72d46b57890f6491a9a681d8cbe7ad51963", - "size": 65798 + "sha256": "4e9d17ced69ccc569a57d3d5bb8099be1175ed32017fb81e8b1e5fedc12567fd", + "size": 65813 }, { "url": "https://code.claude.com/docs/en/plugins/mods/gallery", @@ -7436,8 +7478,8 @@ "url": "https://code.claude.com/docs/en/plugins/mods/troubleshoot", "status": "success", "path": "en/docs/claude-code/plugins/mods/troubleshoot.md", - "sha256": "f75e4724df7ac7d8da8eea5e58ba065890cd8a48802438194a73e34eee16244a", - "size": 40056 + "sha256": "4e73e2142a109e215d6a2af1445947833bf9fc270b001cda613a37ce8ceae693", + "size": 40109 }, { "url": "https://code.claude.com/docs/en/plugins/create-marketplace", @@ -7478,8 +7520,8 @@ "url": "https://code.claude.com/docs/en/plugins/troubleshooting", "status": "success", "path": "en/docs/claude-code/plugins/troubleshooting.md", - "sha256": "8ea8c9b006c9faff9663339c9ebc463690295bfec65ac55efdced3bd594e8930", - "size": 100974 + "sha256": "ab4a7a78fa9ddb2c3252f83007a3c3da118a1c6edb5b94ed5022c7fb433fe9c7", + "size": 101230 }, { "url": "https://code.claude.com/docs/en/plugins/loading", @@ -7534,8 +7576,8 @@ "url": "https://code.claude.com/docs/en/managed-settings", "status": "success", "path": "en/docs/claude-code/managed-settings.md", - "sha256": "f4bf099ccefb1f37f7e4b8f69374765b475ac83da1143c65fc85e5fa9ca0116f", - "size": 66610 + "sha256": "7132f52b628914befc6f9d76344694b4d976901fe6bd86eb5255767176c02536", + "size": 66581 }, { "url": "https://code.claude.com/docs/en/server-managed-settings", @@ -7576,8 +7618,8 @@ "url": "https://code.claude.com/docs/en/amazon-bedrock", "status": "success", "path": "en/docs/claude-code/amazon-bedrock.md", - "sha256": "bf97c0351fbb18b8a8435014287aeb76bc77fa1ba950656d3bbc83d49fed5f7f", - "size": 47785 + "sha256": "d0629cf8d2287fac4f04898da0701ade07ea38448ecbfb389951c0522eb47f9c", + "size": 48475 }, { "url": "https://code.claude.com/docs/en/claude-platform-on-aws", @@ -7597,15 +7639,15 @@ "url": "https://code.claude.com/docs/en/google-vertex-ai", "status": "success", "path": "en/docs/claude-code/google-vertex-ai.md", - "sha256": "31f11029f9f8f8d474bdf81a2355dcd12459fbeb55db6ed864844295ade2c7ef", - "size": 22854 + "sha256": "a403446c53e31661ba47c8f77b39924fa69431c9ff24ebe798257a18fa4188a9", + "size": 23438 }, { "url": "https://code.claude.com/docs/en/microsoft-foundry", "status": "success", "path": "en/docs/claude-code/microsoft-foundry.md", - "sha256": "0f033cdc09ba33b988e4524fe11f8f201cdb563fdf839d60cdd0c351d349a9b3", - "size": 10527 + "sha256": "6b8dfe12055e61487361dfdf0ca283d623cdad90a8b4017fb100f2a9b33dba80", + "size": 11210 }, { "url": "https://code.claude.com/docs/en/network-config", @@ -7709,8 +7751,8 @@ "url": "https://code.claude.com/docs/en/monitoring-usage", "status": "success", "path": "en/docs/claude-code/monitoring-usage.md", - "sha256": "94d0a0e7f0b39c1ad6a888b4810f78b0c2a0baed8c989c6192c0201a05971639", - "size": 182541 + "sha256": "92d730e29fa952ac7cb8f72c522cc0f69a5f7d64d260b68dbcb1ed170bb55212", + "size": 182577 }, { "url": "https://code.claude.com/docs/en/costs", @@ -7905,8 +7947,8 @@ "url": "https://code.claude.com/docs/en/code-mode", "status": "success", "path": "en/docs/claude-code/code-mode.md", - "sha256": "91a350966753bf8a351ee5d6b7d794d8beb6addfbeb9cc71bcf17511e78c0ee4", - "size": 32507 + "sha256": "3ee4d085c4cdacede22e9d314b74ba78c0a8dc520dbca0682863c73ece4c4881", + "size": 32787 }, { "url": "https://code.claude.com/docs/en/output-styles", @@ -7968,22 +8010,22 @@ "url": "https://code.claude.com/docs/en/commands", "status": "success", "path": "en/docs/claude-code/commands.md", - "sha256": "9ac997398740f747ffa7a8795cdf54d6549f6f543c5aae053d90518e076e6746", - "size": 59642 + "sha256": "625e4bf89701ed30f21454cb28f914f6e225f9ea773628491c83a181bac8316f", + "size": 60336 }, { "url": "https://code.claude.com/docs/en/env-vars", "status": "success", "path": "en/docs/claude-code/env-vars.md", - "sha256": "2735bf20fa52c7246598cf0ae3d55cde63aecf33fe07241f8fc7be3e02217d92", - "size": 193965 + "sha256": "126e4a1f848303a8c2b82ac765cac340837bee45dd30a87c3c2c8630628c0bcb", + "size": 194724 }, { "url": "https://code.claude.com/docs/en/tools-reference", "status": "success", "path": "en/docs/claude-code/tools-reference.md", - "sha256": "7db25a74b5ab6c3f440235e0cfd3801f9dc201458076aa18ce43476dcd4309c8", - "size": 98518 + "sha256": "43d1fb02bb8ac3f886a575bd31fe1a799f37cdeb107ed2b1d2e4892eebb9aacf", + "size": 99740 }, { "url": "https://code.claude.com/docs/en/interactive-mode", @@ -7996,8 +8038,8 @@ "url": "https://code.claude.com/docs/en/checkpointing", "status": "success", "path": "en/docs/claude-code/checkpointing.md", - "sha256": "3252beadf277a5e944e0525b8c81958df1bab7158c2ad38f4c4b7db15ae3cfa1", - "size": 9499 + "sha256": "85ea86e5ff9f7265b3b9cfd2ddb56156310dd60482fd6c253c5007947d849279", + "size": 9427 }, { "url": "https://code.claude.com/docs/en/hooks", @@ -8052,8 +8094,8 @@ "url": "https://code.claude.com/docs/en/agent-sdk/configuration", "status": "success", "path": "en/docs/claude-code/agent-sdk/configuration.md", - "sha256": "e8eaeff8e41acc725cb781af740f2c42a1e83825a7a3ebd74738d2f7136b13f5", - "size": 19140 + "sha256": "0a751ffef2d3b5ee68a0f5c018a2a3320e09ba05153d4433300baf18f40cadd0", + "size": 19116 }, { "url": "https://code.claude.com/docs/en/agent-sdk/examples", @@ -8199,8 +8241,8 @@ "url": "https://code.claude.com/docs/en/agent-sdk/observability", "status": "success", "path": "en/docs/claude-code/agent-sdk/observability.md", - "sha256": "01e682cd9021a18dc9d162abc2354c4eda3478f2879c1666cd438ff23100515d", - "size": 18303 + "sha256": "dce6e11b0875415e0bc849146a45f28f2ef2d0fcf538c69ddf3432b2ec6edfab", + "size": 18268 }, { "url": "https://code.claude.com/docs/en/agent-sdk/todo-tracking", @@ -8227,8 +8269,8 @@ "url": "https://code.claude.com/docs/en/agent-sdk/typescript", "status": "success", "path": "en/docs/claude-code/agent-sdk/typescript.md", - "sha256": "a995c50ea6fa99b392b91eb878dabfe91ce2475551e3d5022c70f503587f17b2", - "size": 335942 + "sha256": "e3b593095ddfbbc8f042fe2ee65480b90e32e3a51e1fd1112a689b83cb61c348", + "size": 336226 }, { "url": "https://code.claude.com/docs/en/agent-sdk/typescript-v2-preview", @@ -8241,8 +8283,8 @@ "url": "https://code.claude.com/docs/en/agent-sdk/python", "status": "success", "path": "en/docs/claude-code/agent-sdk/python.md", - "sha256": "7e6d264f3cf0bec78c25e5d14cc8e775b7b18921a650c90eb5c864600f59fd84", - "size": 165683 + "sha256": "2052e106e05945d9176ce342d9feafe72fbd4114fad34552b0990b9e11df2787", + "size": 165724 }, { "url": "https://code.claude.com/docs/en/legal-and-compliance", @@ -8955,14 +8997,14 @@ "url": "https://modelcontextprotocol.io/docs/2026-07-28/develop/build-client", "status": "success", "path": "mcp/docs/2026-07-28/develop/build-client.md", - "sha256": "7bfbff95d9cc4f86fa69386fd5de7fba369618a9e8c6c191743bd7e285595ad0", - "size": 103852 + "sha256": "fc5ff524b07e3ff9be1fb9fa97b24c539eb28aed657b9e098cab65a04e33f2f5", + "size": 104125 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/develop/build-server", "status": "success", "path": "mcp/docs/2026-07-28/develop/build-server.md", - "sha256": "e5713ec4ed1ad0bec52d78136d1c90f297c5a07af6694dda73bc066918c9dd41", + "sha256": "356b77e89a73c8ffb91e919d1ee446bd924947d01aa56c65d116fffbf070e174", "size": 98537 }, { @@ -8976,36 +9018,36 @@ "url": "https://modelcontextprotocol.io/docs/2026-07-28/develop/clients/client-best-practices", "status": "success", "path": "mcp/docs/2026-07-28/develop/clients/client-best-practices.md", - "sha256": "9af959deb8930b9d1d0a35694c898e6df25f2514fede5f3fe3d697cfdbaa5f1e", - "size": 19576 + "sha256": "41ac5d5017fccb4df99dfb1fbe97aea797cd29c2c564c625d2c73ba796f7f911", + "size": 19793 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/develop/connect-local-servers", "status": "success", "path": "mcp/docs/2026-07-28/develop/connect-local-servers.md", - "sha256": "20f20a1fc4905b3d37c42c1fc1c41176942a47d5a4bb18beff243dc3f259c28d", - "size": 12780 + "sha256": "4d6aadfc8b941c458c6a9ca2b1dc17e6cddf7891068ddec9461b3749608c7cc3", + "size": 12758 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/develop/connect-remote-servers", "status": "success", "path": "mcp/docs/2026-07-28/develop/connect-remote-servers.md", - "sha256": "fc5dbabde19f60621f094ff6741720796dd00e9a5520894b00b073dd70ea0e93", - "size": 9430 + "sha256": "ae0730c37b267a722068dd0a4dfa3ad8b6525603297a385b41f6690a88675926", + "size": 9427 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/getting-started/intro", "status": "success", "path": "mcp/docs/2026-07-28/getting-started/intro.md", - "sha256": "bb1fb894f566264fa28cc696adf8075927eb1fa440141ba08af183549e43032e", - "size": 3528 + "sha256": "a5eca40a7b11cdd8f847ef3b510ca8967616cbad78374fe5cc4f7f7d258935c3", + "size": 3799 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture", "status": "success", "path": "mcp/docs/2026-07-28/learn/architecture.md", - "sha256": "ab60220d34eb4e85469486ce721e6e88aa17d0451274d5426bbbee31249f574c", - "size": 32757 + "sha256": "61f78a1b4ffaefecf0e470700353fc0ceb0aa1f2f3cfb71bb0029592a0fc87e3", + "size": 32752 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/learn/client-concepts", @@ -9039,8 +9081,8 @@ "url": "https://modelcontextprotocol.io/docs/2026-07-28/tools/debugging", "status": "success", "path": "mcp/docs/2026-07-28/tools/debugging.md", - "sha256": "e46737ccaad00af83fd601fed60e196247f1540b65cd2f339694f4efe1e0f201", - "size": 11426 + "sha256": "888713624839cc0c73eac1e48544b85c0c20243d254336ebad41638b8d1880c4", + "size": 11442 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/tools/inspector", @@ -9053,8 +9095,8 @@ "url": "https://modelcontextprotocol.io/docs/2026-07-28/tools/inspector/authorization", "status": "success", "path": "mcp/docs/2026-07-28/tools/inspector/authorization.md", - "sha256": "0d7257d215bc7439613284376467bfbd1622c4f519c225bd409ca21f4820da29", - "size": 11761 + "sha256": "80cb4aaf1b00bb55205ed306bb364e3a3ed27afc305db24b5dab8b77fde701a5", + "size": 11777 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/tools/inspector/cli", @@ -9109,8 +9151,8 @@ "url": "https://modelcontextprotocol.io/docs/2026-07-28/tools/inspector/tui", "status": "success", "path": "mcp/docs/2026-07-28/tools/inspector/tui.md", - "sha256": "8749732d7a2d03d9727ca19043b6e01ddddca51cca3f520ffd966a937906cf98", - "size": 7503 + "sha256": "26ba3f5fd22e9911279167a5a1540367887c610c864cc26ce92d173c06a1791d", + "size": 7511 }, { "url": "https://modelcontextprotocol.io/docs/2026-07-28/tools/inspector/web", @@ -9137,21 +9179,21 @@ "url": "https://modelcontextprotocol.io/docs/2026-07-28/tutorials/security/security_best_practices", "status": "success", "path": "mcp/docs/2026-07-28/tutorials/security/security_best_practices.md", - "sha256": "3f654ff190ddf7d882e6a496a2de35b8fe31df2ba5d2edb4461df91afe013964", - "size": 43631 + "sha256": "65dfe1b8774e47cb461fa706998a08aa8ae17b1baed5035f9e3be0489bc9c6e7", + "size": 43643 }, { "url": "https://modelcontextprotocol.io/docs/draft/develop/build-client", "status": "success", "path": "mcp/docs/draft/develop/build-client.md", - "sha256": "966a23a4430134b569d9e00e137a6d3026da1486e3a8c1135bdb9a069aebc1aa", - "size": 103827 + "sha256": "b81fcaa84fbc4307eebaa866862e2128ec5cf3b3a74cc807986b2ac90890e231", + "size": 104100 }, { "url": "https://modelcontextprotocol.io/docs/draft/develop/build-server", "status": "success", "path": "mcp/docs/draft/develop/build-server.md", - "sha256": "eb104468a299a398aa6e0f9cd231881da5b56589e5f8101661534256caa44173", + "sha256": "6d212037a8529dbc1758c599c2f2e4087265dd856e75a3bf82887a00a8caa872", "size": 98472 }, { @@ -9165,36 +9207,36 @@ "url": "https://modelcontextprotocol.io/docs/draft/develop/clients/client-best-practices", "status": "success", "path": "mcp/docs/draft/develop/clients/client-best-practices.md", - "sha256": "4ef3d7dc97dfb06a7583d54c6dae7acf10f160fc373fc11d3c59e2bb60e970fd", - "size": 19551 + "sha256": "cb99309adc27e0c87c3a120c854e612a851bcecb098c675e76a81093a52cc637", + "size": 19763 }, { "url": "https://modelcontextprotocol.io/docs/draft/develop/connect-local-servers", "status": "success", "path": "mcp/docs/draft/develop/connect-local-servers.md", - "sha256": "e93fd4870b699a82f79fe8216ea63d88ca7620218640f4c97b9dd01f5bb06d48", - "size": 12760 + "sha256": "52248bf988e3f7ab2005b16fa545eda8a046eba94dec511bf7d4ed8d639390ea", + "size": 12738 }, { "url": "https://modelcontextprotocol.io/docs/draft/develop/connect-remote-servers", "status": "success", "path": "mcp/docs/draft/develop/connect-remote-servers.md", - "sha256": "8e89c5a5d292c1be034af82453e605a534729e20e1913e4d72c71e631f26a949", - "size": 9410 + "sha256": "a316455ea0f2aeb12ff05efd0ead98424adfc67f88e5a639c81de796e34ff539", + "size": 9407 }, { "url": "https://modelcontextprotocol.io/docs/draft/getting-started/intro", "status": "success", "path": "mcp/docs/draft/getting-started/intro.md", - "sha256": "6f60044d8ab17be5592a28c9369bd3fdfcd478d267f17b14de6f9c31cf3164e6", - "size": 3508 + "sha256": "503925b3c1e7766c44846be555f0b3cb56b27e0a3b8e2d46025f12a2ff47b4b5", + "size": 3779 }, { "url": "https://modelcontextprotocol.io/docs/draft/learn/architecture", "status": "success", "path": "mcp/docs/draft/learn/architecture.md", - "sha256": "857384d76baae160a204f7642b548b2e93b2764891ad5121fb73ea76120424a2", - "size": 32642 + "sha256": "d039d8063e804df43da2c2ab63ef52d662cf8d9ee32083ebd61c58f1179e706f", + "size": 32637 }, { "url": "https://modelcontextprotocol.io/docs/draft/learn/client-concepts", @@ -9228,8 +9270,8 @@ "url": "https://modelcontextprotocol.io/docs/draft/tools/debugging", "status": "success", "path": "mcp/docs/draft/tools/debugging.md", - "sha256": "d1e3148f2b89eb9f7da87dd1052c9ec11bc74e7cc114ddb0547ad847b7b115f1", - "size": 11336 + "sha256": "edf2de4096d4ecdbf8346f3104cae4e27423e5493da0868e35498044046f810b", + "size": 11332 }, { "url": "https://modelcontextprotocol.io/docs/draft/tools/inspector", @@ -9242,8 +9284,8 @@ "url": "https://modelcontextprotocol.io/docs/draft/tools/inspector/authorization", "status": "success", "path": "mcp/docs/draft/tools/inspector/authorization.md", - "sha256": "20eea2d28882ecaf86fbdac79f141cd9eaacc6121e705dfd960625f9adaff82a", - "size": 11731 + "sha256": "9ad2bbe909930843a48f9ec49a87849e443875aca69d19d9b6fb0ea7c0a8ecd7", + "size": 11727 }, { "url": "https://modelcontextprotocol.io/docs/draft/tools/inspector/cli", @@ -9298,8 +9340,8 @@ "url": "https://modelcontextprotocol.io/docs/draft/tools/inspector/tui", "status": "success", "path": "mcp/docs/draft/tools/inspector/tui.md", - "sha256": "d66aaa48098407cae5fd66363c8811126b260056cc6fdcede7592f57d0910560", - "size": 7468 + "sha256": "03c07872722955fe65704c5dac07a5fe7b4ec0ccb28aa846870e95f72c705901", + "size": 7466 }, { "url": "https://modelcontextprotocol.io/docs/draft/tools/inspector/web", @@ -9326,8 +9368,8 @@ "url": "https://modelcontextprotocol.io/docs/draft/tutorials/security/security_best_practices", "status": "success", "path": "mcp/docs/draft/tutorials/security/security_best_practices.md", - "sha256": "0152633d84864516cce01862e4dcd00e0f6a377b800069658d3d5b5590b5faab", - "size": 43585 + "sha256": "2e0fbe034bfb373aae250897ff0c15c2970f2db84da39848d5390c637803d679", + "size": 43582 }, { "url": "https://modelcontextprotocol.io/examples", @@ -10390,14 +10432,14 @@ "url": "https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration", "status": "success", "path": "mcp/specification/2026-07-28/basic/authorization/client-registration.md", - "sha256": "126c17e82edb0dae6d5772f51ebaa5ba56d475ef2e22cf69ff338abf8977f35f", - "size": 10367 + "sha256": "707ae8e2572959bf57ec9224017701c44c8ea462da2c63d3eb773f99f17d8f1d", + "size": 10888 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization", "status": "success", "path": "mcp/specification/2026-07-28/basic/authorization.md", - "sha256": "d9ff08c88f8867670ee32a0c74859c3f5b7d4276953f66f48c68858253bab0e6", + "sha256": "aaa76e15c4955b3836db7739d6d3176439194a44fe2c36bbacbcb78c3ce2033e", "size": 26106 }, { @@ -10439,8 +10481,8 @@ "url": "https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/progress", "status": "success", "path": "mcp/specification/2026-07-28/basic/patterns/progress.md", - "sha256": "aa476b075b0f07cf3b1994d33b4bcd2d7f0353e17b88b09d7c052efea69ad03d", - "size": 2783 + "sha256": "ecaf9a8681b15dbebc663eb9d9bdcc71ec2e894b1f6e003b3dc6fb1a2c619fbd", + "size": 3204 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/subscriptions", @@ -10474,22 +10516,22 @@ "url": "https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning", "status": "success", "path": "mcp/specification/2026-07-28/basic/versioning.md", - "sha256": "f42c89c87d9ac718cffa8bfc3be2e0002f92027274cec50399ea17a613edc46a", - "size": 9000 + "sha256": "db86ee144346aa9c6141d08a423000f4cddc40659b7255754bbfb1e436877010", + "size": 9507 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/changelog", "status": "success", "path": "mcp/specification/2026-07-28/changelog.md", - "sha256": "3467bcf82d52282332abf50efe0b5875d36f84a9a47205413e97018b4b4c8ea1", - "size": 12427 + "sha256": "fd286a50738078eb7d8a815b13a547eaa430e4abb517d3989bb25983466da37a", + "size": 12546 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation", "status": "success", "path": "mcp/specification/2026-07-28/client/elicitation.md", - "sha256": "7389352b9bdf8b96bf2514f24d71393bff99b205219fb75b3b57331a2b53a3a8", - "size": 28850 + "sha256": "79a069ebc84decc2edc9721b14f21d54d030e94ccf973850b346d20458497977", + "size": 28985 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/client/roots", @@ -10502,8 +10544,8 @@ "url": "https://modelcontextprotocol.io/specification/2026-07-28/client/sampling", "status": "success", "path": "mcp/specification/2026-07-28/client/sampling.md", - "sha256": "c0fe7e48496ccc02f054848f58394b5002e787b4e74fe593100417bc64d57749", - "size": 22419 + "sha256": "2dd49f6be2fb126a6e92f11099d9df9cd4dd46b10c3be1f71111d205fb3ef792", + "size": 22941 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/deprecated", @@ -10516,15 +10558,15 @@ "url": "https://modelcontextprotocol.io/specification/2026-07-28", "status": "success", "path": "mcp/specification/2026-07-28.md", - "sha256": "fa6c3afbf991d2b05d3dbc88e2e9c640dc9e7b588a8a8f15c2b7ffa3973625bf", - "size": 6175 + "sha256": "3367805038b443c1d2100d683eebe7d582c9cdf3354b4b53cb9e6f11b64dbbb6", + "size": 6212 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/schema", "status": "success", "path": "mcp/specification/2026-07-28/schema.md", - "sha256": "70f5057881df00d725b73aad2eb2d7bb0f79d17442738064108638f0108a024a", - "size": 216645 + "sha256": "df0480d13643610b23d5b13d5df4d4996630d947b7674f97ee472ce7294da226", + "size": 216694 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/server/discover", @@ -10544,36 +10586,36 @@ "url": "https://modelcontextprotocol.io/specification/2026-07-28/server/prompts", "status": "success", "path": "mcp/specification/2026-07-28/server/prompts.md", - "sha256": "327703d6a30f47a64c6f06669576c59ef14f9179ebe90edf5b54473c5d224f5b", - "size": 10371 + "sha256": "22359123051962389625cef1202123c7de1c3d3907c536589d392f84241c1c29", + "size": 10470 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/server/resources", "status": "success", "path": "mcp/specification/2026-07-28/server/resources.md", - "sha256": "56be062571b959c4e5bb35dc7b2409c3b3b415db4b8a09b419121a6f52b10657", - "size": 13882 + "sha256": "94844c5515ec78d9a101e73a7a83d013c48c46dde6e88d2c9500835fa4bf69f7", + "size": 14729 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/server/tools", "status": "success", "path": "mcp/specification/2026-07-28/server/tools.md", - "sha256": "30b2db501261cfeeaa621d26d55890f53fa38a3012f740a1a3fcdb02e0316cba", - "size": 24981 + "sha256": "e4fcffe263254cb7cc6b95854436091a541e77ea88cd53431ab26f9e2429f9b7", + "size": 25089 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/server/utilities/caching", "status": "success", "path": "mcp/specification/2026-07-28/server/utilities/caching.md", - "sha256": "1753fd95fbdf7098236515651217098a9166564a4c3d45f87166a88157b25a1b", - "size": 8660 + "sha256": "3ffc689771074e75c510025f8587aad26ef755d58b8cc86744494c174dd4b002", + "size": 8895 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/server/utilities/completion", "status": "success", "path": "mcp/specification/2026-07-28/server/utilities/completion.md", - "sha256": "8660cf965a4cfa470881ab58d5516f919204d607622f875da1bc503025a654bf", - "size": 5495 + "sha256": "3ad9975e7c18d86ad290e6f661c23f0dea45900fa20af2bf1cfc431964f3ca9b", + "size": 5520 }, { "url": "https://modelcontextprotocol.io/specification/2026-07-28/server/utilities/logging", @@ -10607,14 +10649,14 @@ "url": "https://modelcontextprotocol.io/specification/draft/basic/authorization/client-registration", "status": "success", "path": "mcp/specification/draft/basic/authorization/client-registration.md", - "sha256": "fcaa1200ae4498958f7fd20786407590e88552190d3299173c4c77b2bf3e00d8", - "size": 10351 + "sha256": "043098057d1d664c1c1d62207d62967c2eb8cc95dfd24a024026908bb6b3dbb5", + "size": 10867 }, { "url": "https://modelcontextprotocol.io/specification/draft/basic/authorization", "status": "success", "path": "mcp/specification/draft/basic/authorization.md", - "sha256": "371fcf52c8e58a6999f5f03a13eb4a2815f15284e6eb0dcb3cc008e2324713dd", + "sha256": "0d7c52ff2af2f1d55ecfc79674bdd8cd526430c4b2701f4f2c736aa466ad720d", "size": 26051 }, { @@ -10656,8 +10698,8 @@ "url": "https://modelcontextprotocol.io/specification/draft/basic/patterns/progress", "status": "success", "path": "mcp/specification/draft/basic/patterns/progress.md", - "sha256": "aa476b075b0f07cf3b1994d33b4bcd2d7f0353e17b88b09d7c052efea69ad03d", - "size": 2783 + "sha256": "ee9166f8e8465fc7e4d17f53954d716c22240c82f0de12f1c3842b51bece0150", + "size": 3199 }, { "url": "https://modelcontextprotocol.io/specification/draft/basic/patterns/subscriptions", @@ -10691,8 +10733,8 @@ "url": "https://modelcontextprotocol.io/specification/draft/basic/versioning", "status": "success", "path": "mcp/specification/draft/basic/versioning.md", - "sha256": "8c968b2f8ed15dc3346cf79fe3e14e612a9253f5633136f344784d2a7b80b595", - "size": 8955 + "sha256": "39d7ecd54183a94c32b4b8cbd80a3492d71da169d3121411378c340af165dddd", + "size": 9462 }, { "url": "https://modelcontextprotocol.io/specification/draft/changelog", @@ -10705,22 +10747,22 @@ "url": "https://modelcontextprotocol.io/specification/draft/client/elicitation", "status": "success", "path": "mcp/specification/draft/client/elicitation.md", - "sha256": "3ca88b2ea9d8365928be0efeee66e6d2b24db669d712b91b3c0b5a9abaa45376", - "size": 28785 + "sha256": "3ac1c00da8ee0f8b63c521c1aa0552be717acde8b55525d73d44fac35bae138e", + "size": 28920 }, { "url": "https://modelcontextprotocol.io/specification/draft/client/roots", "status": "success", "path": "mcp/specification/draft/client/roots.md", - "sha256": "764648dfdd87dc70ba072bdfbdd77f6156b4012177434aaa31192cfe64e9042a", + "sha256": "78a6fc9049f0d5a2081a7b5497e22892252b0bee023832c6d67914c257329328", "size": 4877 }, { "url": "https://modelcontextprotocol.io/specification/draft/client/sampling", "status": "success", "path": "mcp/specification/draft/client/sampling.md", - "sha256": "8baf6dd79f6c7694a5b4cdb17b678b448a30582b0472c4f3edd8bec82c9a5da7", - "size": 22404 + "sha256": "4514b0a4e863f81a3783ab47f8ca124d73ed8125062e4cec7aeb91d84e03e440", + "size": 22926 }, { "url": "https://modelcontextprotocol.io/specification/draft/deprecated", @@ -10733,15 +10775,15 @@ "url": "https://modelcontextprotocol.io/specification/draft", "status": "success", "path": "mcp/specification/draft.md", - "sha256": "311e2368552a15bc9c6a1a112d8f417ba8788e6b9af50a21ad95cc1039f8b10f", - "size": 6150 + "sha256": "c103960ee942bda56c86932fb0ce812858d265ddb729f14c7b3cfd669000b8da", + "size": 6187 }, { "url": "https://modelcontextprotocol.io/specification/draft/schema", "status": "success", "path": "mcp/specification/draft/schema.md", - "sha256": "db77787bc9003b7fce7ca60a1a010875bb9e4214a6fc4ea36d4835d3114e570f", - "size": 217286 + "sha256": "710e4c23f18c93cc24855b2ba0cdbc9cd5bfdf6827f11411494cfb746dce66a7", + "size": 217335 }, { "url": "https://modelcontextprotocol.io/specification/draft/server/discover", @@ -10761,42 +10803,42 @@ "url": "https://modelcontextprotocol.io/specification/draft/server/prompts", "status": "success", "path": "mcp/specification/draft/server/prompts.md", - "sha256": "2d83487e0dc061269f01d68cbb5a1a6dce9786eb4e16e042d1a05c2fb4a686e3", - "size": 10311 + "sha256": "c17ffdb363224ad7d4f1d698203f2e0d399c7492084c295f69c3a168fb0d55ff", + "size": 10410 }, { "url": "https://modelcontextprotocol.io/specification/draft/server/resources", "status": "success", "path": "mcp/specification/draft/server/resources.md", - "sha256": "d88e275bef9465621d0fec3cf67a73130f7607084b8c2805fc39d03b307b8776", - "size": 13822 + "sha256": "1b73e3abf07e6c3b37f818bd718efdb0be80934f85d232cfaa39722693f06f40", + "size": 14669 }, { "url": "https://modelcontextprotocol.io/specification/draft/server/tools", "status": "success", "path": "mcp/specification/draft/server/tools.md", - "sha256": "d2c231be93ee5ee41c9fca632556d7f0f37f4cd3beb12cea30f3fe655d69dc11", - "size": 24891 + "sha256": "77ea07603cc45e9019ac1cc9b27e05de7e0e8b8620ebf75c55d35cd083c47e69", + "size": 24999 }, { "url": "https://modelcontextprotocol.io/specification/draft/server/utilities/caching", "status": "success", "path": "mcp/specification/draft/server/utilities/caching.md", - "sha256": "fc4e5c2c799a5766ada08ce41cf48a9fc61a6d11d39c78c7a5b07a232e246545", - "size": 8645 + "sha256": "2db5e8c60a64c274ad289eb1d6e952e88ce472704fc111a26c711957fbc00785", + "size": 8875 }, { "url": "https://modelcontextprotocol.io/specification/draft/server/utilities/completion", "status": "success", "path": "mcp/specification/draft/server/utilities/completion.md", - "sha256": "71ce041dcaab67dc21750e814ad57b1cd03ee0b60ff820a8fbbff12b48e42c3f", - "size": 5490 + "sha256": "fccf6fecb0d6ea9efcc199ff6525ca2aa6ef4327beba5bd553fff972cf0d089d", + "size": 5515 }, { "url": "https://modelcontextprotocol.io/specification/draft/server/utilities/logging", "status": "success", "path": "mcp/specification/draft/server/utilities/logging.md", - "sha256": "caaddb5c78fe41f369df41235f7b68c621590c18ea3500ca6f4313edaffe2191", + "sha256": "d545331e6bfe7e126ff130f3bd588b16ab8eae5dc47836df63d73c6e263db4ea", "size": 4623 }, { @@ -11006,8 +11048,8 @@ "url": "https://support.claude.com/en/articles/8287232-verify-your-phone-number", "status": "success", "path": "support/8287232-verify-your-phone-number.md", - "sha256": "4c37d1bbc0f0f90e7bed0b9d69983431de7cfbf480cd011db52bd9d1c81f0ba9", - "size": 3774 + "sha256": "8c8df0bdd4894323d2c381affad8c3dcd9913d1f90d041976d968849191a58af", + "size": 3926 }, { "url": "https://support.claude.com/en/articles/8325606-what-is-the-pro-plan", @@ -11755,15 +11797,15 @@ "url": "https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp", "status": "success", "path": "support/11175166-get-started-with-custom-connectors-using-remote-mcp.md", - "sha256": "0ecdf2da4af6c02073ce2d4d0565282b559dcab671dc25af921af16980d2c268", - "size": 14893 + "sha256": "d92ba7a147aa72c17693419453cf5b40a68348933ee352954619453c47dace68", + "size": 15027 }, { "url": "https://support.claude.com/en/articles/11176164-use-connectors-to-extend-claude-s-capabilities", "status": "success", "path": "support/11176164-use-connectors-to-extend-claude-s-capabilities.md", - "sha256": "1e657acc3119136b92c7178a4589a3123f88ed09a5f724fc7bb9d86e27db545b", - "size": 16024 + "sha256": "8b78f8d30cc744a0285b836e6070cd4537f5a26d0e0f823fa9eb0ef28cae97e4", + "size": 16521 }, { "url": "https://support.claude.com/en/articles/11199177-anthropic-s-ai-for-science-program", @@ -11958,8 +12000,8 @@ "url": "https://support.claude.com/en/articles/12111783-create-and-edit-files-with-claude", "status": "success", "path": "support/12111783-create-and-edit-files-with-claude.md", - "sha256": "f2bb4984eed80caaefdbca6e40bb0910356acd1aa38db63530d67b01eb4bfedd", - "size": 17902 + "sha256": "da33d9cff14eaec3570e4ce41e5d8e9d59fc0f76e84cca4840582ab485fec321", + "size": 18266 }, { "url": "https://support.claude.com/en/articles/12119250-model-safety-bug-bounty-program", @@ -11979,8 +12021,8 @@ "url": "https://support.claude.com/en/articles/12138966-release-notes", "status": "success", "path": "support/12138966-release-notes.md", - "sha256": "8e5c1d61086c07eecd4df0c4637d8f53b7f0e68f3243dafeae868edd19577933", - "size": 44131 + "sha256": "ed211b074c2c02fcc1231bfabbf0dec160db2f65b620c5f990e4f87ad9947947", + "size": 44582 }, { "url": "https://support.claude.com/en/articles/12157520-claude-code-usage-analytics", @@ -12672,8 +12714,8 @@ "url": "https://support.claude.com/en/articles/14503520-available-beta-and-research-preview-features", "status": "success", "path": "support/14503520-available-beta-and-research-preview-features.md", - "sha256": "cdd0ac46e97b2b7d4086feb96f3f35a65f89f246600af43b80eb2e4db71823db", - "size": 5490 + "sha256": "e52fda293e941996b93dadf20ac9f65341065b9720f9906580a5575b171985f4", + "size": 5688 }, { "url": "https://support.claude.com/en/articles/14546867-set-organization-instructions", @@ -13057,8 +13099,8 @@ "url": "https://support.claude.com/en/articles/16266773-how-claude-marks-ai-generated-content", "status": "success", "path": "support/16266773-how-claude-marks-ai-generated-content.md", - "sha256": "d090cd37430366c92f916c07f54e78f7c5e833ea20aaa042725219f70d85b98e", - "size": 13123 + "sha256": "c90dd83fc36c8c4b1a1a1d1b968281b7f9a1aeeedfc411e159b998b778711e74", + "size": 13060 }, { "url": "https://support.claude.com/en/articles/16559896-set-up-claude-for-teachers-for-your-school-or-district", @@ -13449,8 +13491,8 @@ "url": "https://support.claude.com/en/articles/18342806-set-up-and-manage-the-new-unified-claude-experience-for-your-team-organization", "status": "success", "path": "support/18342806-set-up-and-manage-the-new-unified-claude-experience-for-your-team-organization.md", - "sha256": "1260e12dd72d697f9ef244db1073f89bd66989bc18746cb3cbb4c3c5d6d4ed0e", - "size": 13799 + "sha256": "58bf98975a5c9f203d4e8fc0fce58892733cf6ec860794e88c6ff917526e84a8", + "size": 14470 }, { "url": "https://support.claude.com/en/articles/18426225-move-from-claude-enterprise-to-claude-desktop-on-a-cloud-provider", @@ -13498,15 +13540,15 @@ "url": "https://support.claude.com/en/articles/18467110-offer-linked-billing-in-your-platform", "status": "success", "path": "support/18467110-offer-linked-billing-in-your-platform.md", - "sha256": "d85dbcc4f4afa1457aa3c80dad788871b49418cce8951879b8bf29d97e257a1e", - "size": 10465 + "sha256": "f0730f2a77a46f56e1f1830332488295a529b930a9c05b97a82d48f4eb95d022", + "size": 10434 }, { "url": "https://support.claude.com/en/articles/18467148-use-your-claude-platform-account-in-a-third-party-app", "status": "success", "path": "support/18467148-use-your-claude-platform-account-in-a-third-party-app.md", - "sha256": "b3ca6961e7f9c174437228ba119fdd81c1493eb9408cd1e9d36170ac6813a791", - "size": 6859 + "sha256": "24edeee5aea1cf24813abba51145aabd5e9069b2fa9b6a2183bb447feff5bfdd", + "size": 6828 }, { "url": "https://support.claude.com/en/articles/18483812-set-up-computer-use-for-team-and-enterprise-plans", @@ -13561,8 +13603,8 @@ "url": "https://claude.com/docs/claude-science/changelog", "status": "success", "path": "claude/claude-science/changelog.md", - "sha256": "39d35526cf514a92892103c0df6d14954712cd0e5b3dc037118ff0d4e77c9cee", - "size": 36295 + "sha256": "afcc28212681550992542080d1934d90ae7854f59cc551762ccf5fac07c687bd", + "size": 37413 }, { "url": "https://claude.com/docs/claude-science/cloud-storage", @@ -15304,29 +15346,29 @@ "url": "https://claude.com/docs/third-party/claude-desktop/admin-console", "status": "success", "path": "claude/third-party/claude-desktop/admin-console.md", - "sha256": "ea097da5c6baf583f397bf0e6568dd1c048278cabcadd5d9a4adf0ff9586ef5a", - "size": 100884 + "sha256": "1b48072c0fd9a77663f3b753bb9721ae6e49be6551f67c2f1387f1d81b0ec349", + "size": 100895 }, { "url": "https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code", "status": "success", "path": "claude/third-party/claude-desktop/admin-console-claude-code.md", - "sha256": "ae371b383fb2942d831acfadb548377a5c5bfc8918cfda33eab7233d020cccd5", - "size": 30156 + "sha256": "ac71316aa3812607d3b91913282b128c3da4b4f3c20ccceec735c79e06cf0528", + "size": 30182 }, { "url": "https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code-reference", "status": "success", "path": "claude/third-party/claude-desktop/admin-console-claude-code-reference.md", - "sha256": "5a9ae104fac9aad1b7b3c817884c1955991ca086d87390ecfd1cf5c9d7503036", - "size": 27120 + "sha256": "e9ee33d26e48451c8fa369266e168af614cea891dbf5b6b19a274330e9939297", + "size": 27144 }, { "url": "https://claude.com/docs/third-party/claude-desktop/bedrock", "status": "success", "path": "claude/third-party/claude-desktop/bedrock.md", - "sha256": "79c4f361a06f79465d23fc226796ed26f726730d227429fb4196aea5fbde1a31", - "size": 27071 + "sha256": "49cbc96e2d5b4568e336b02e30dfa6dce4b0045de743c695544c8fc322d767b2", + "size": 27582 }, { "url": "https://claude.com/docs/third-party/claude-desktop/bootstrap", @@ -15388,8 +15430,8 @@ "url": "https://claude.com/docs/third-party/claude-desktop/configuration-format", "status": "success", "path": "claude/third-party/claude-desktop/configuration-format.md", - "sha256": "17bd5f7ae0cae7227d729f2aff02b5e13d8bfcba55b565c18533314cdbccb01b", - "size": 17002 + "sha256": "94b6f8fd7bd9cb2464f039b54c64634f41154c2d6abebee75f2702e73098222c", + "size": 16999 }, { "url": "https://claude.com/docs/third-party/claude-desktop/connectors-box", @@ -15430,15 +15472,15 @@ "url": "https://claude.com/docs/third-party/claude-desktop/credential-helper", "status": "success", "path": "claude/third-party/claude-desktop/credential-helper.md", - "sha256": "5070ea0e1bf60fe7db5d61ed51581fd0e382a71ad28230835f64dfc58c4a5d6c", + "sha256": "f1505a720a7ac96a9cee01cb68a1d5fa29862febcdd60d36f14c296982b43cf3", "size": 10256 }, { "url": "https://claude.com/docs/third-party/claude-desktop/data-storage", "status": "success", "path": "claude/third-party/claude-desktop/data-storage.md", - "sha256": "647402b79d223efb75e7e9db97a2950e441afee730b61d78b0a5ddbe926700a0", - "size": 59421 + "sha256": "11dc5794d336f35d2cee87ad68da299b2826ac8f1d9a1cbaa9b3ba28747c6c1a", + "size": 60911 }, { "url": "https://claude.com/docs/third-party/claude-desktop/design-and-slides", @@ -15458,8 +15500,8 @@ "url": "https://claude.com/docs/third-party/claude-desktop/extensions", "status": "success", "path": "claude/third-party/claude-desktop/extensions.md", - "sha256": "1541c9e81b69895dfbc34e04b7104f0a7d41fa6dcd38a05dcc3de5784fd5d275", - "size": 101443 + "sha256": "de9cde6fe56889f1e85cc0d0ed199bdbebfe8bb7fa6df36b7b95b2c7326597ff", + "size": 101440 }, { "url": "https://claude.com/docs/third-party/claude-desktop/feature-matrix", @@ -15472,29 +15514,29 @@ "url": "https://claude.com/docs/third-party/claude-desktop/foundry", "status": "success", "path": "claude/third-party/claude-desktop/foundry.md", - "sha256": "1a6679cae0865064610360d17ae07ebf4e2856985b736193a461867eb83121ef", - "size": 20524 + "sha256": "d921e28db7edca04a493943d2e48a0045e91f4bc6c5faa93fc4234e24044dbd1", + "size": 20764 }, { "url": "https://claude.com/docs/third-party/claude-desktop/gateway", "status": "success", "path": "claude/third-party/claude-desktop/gateway.md", - "sha256": "446ee3a2c915f8761c77992af8d05e5e6bb9a995752e4f56553758b18c02424d", - "size": 80297 + "sha256": "cce7cd00364edd611e9560339e1686c845e1ebc5a49e651735066589c3853090", + "size": 80909 }, { "url": "https://claude.com/docs/third-party/claude-desktop/import", "status": "success", "path": "claude/third-party/claude-desktop/import.md", - "sha256": "d06939e19729b6a1b445deb9dc70b257bf5112a02757083d3456e828dfeb08ee", - "size": 43273 + "sha256": "5b5bca47e4c5a338e60ab2139c33c106e7b0492ae9e8c177f4527a189b80e320", + "size": 56130 }, { "url": "https://claude.com/docs/third-party/claude-desktop/in-app-configuration", "status": "success", "path": "claude/third-party/claude-desktop/in-app-configuration.md", - "sha256": "4c58561ddde7b7fbdcf8a2c9b5baa5fc4117285cdd424eacb6b13a1e61304a16", - "size": 5848 + "sha256": "510ee276282aad965188f5d444f713c2d4e06cd323f2bfc6de1bae68024f1062", + "size": 6068 }, { "url": "https://claude.com/docs/third-party/claude-desktop/installation", @@ -15521,8 +15563,8 @@ "url": "https://claude.com/docs/third-party/claude-desktop/mantle", "status": "success", "path": "claude/third-party/claude-desktop/mantle.md", - "sha256": "dd6a44fc22799cce6c15552c7816c7d4a1053595bb96da7c3073b170a4b0d216", - "size": 10379 + "sha256": "872c1ca5efff72bed48c31a29eb576015d048f4880aaf1e8b5d3e470602f3a68", + "size": 10625 }, { "url": "https://claude.com/docs/third-party/claude-desktop/mcp-sign-in", @@ -15577,8 +15619,8 @@ "url": "https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions", "status": "success", "path": "claude/third-party/claude-desktop/ssh-remote-sessions.md", - "sha256": "046d2d0181512426b7c9a0080bc068222053f8152af75f413af7cf188ae202ee", - "size": 203088 + "sha256": "1d1802ce3014bc883ad4a251a8cc1fd517411711a6ccfc00a851948d9fda578d", + "size": 203440 }, { "url": "https://claude.com/docs/third-party/claude-desktop/status-line", @@ -15605,8 +15647,8 @@ "url": "https://claude.com/docs/third-party/claude-desktop/vertex", "status": "success", "path": "claude/third-party/claude-desktop/vertex.md", - "sha256": "2399a76c6aef718b113aa41442017a3264265e612eb50553fc2aa1280d9a507b", - "size": 25854 + "sha256": "7f900845628063fdd41209fdab11a1c97010ca387cda04fa7f160afca9bc4741", + "size": 27179 }, { "url": "https://claude.com/docs/third-party/claude-desktop/web-tools", @@ -28093,8 +28135,8 @@ "url": "https://raw.githubusercontent.com/anthropics/claude-plugins-official/main/plugins/claude-security/CI.md", "status": "success", "path": "github/claude-plugins-official/plugins/claude-security/CI.md", - "sha256": "b823e8099124dcc85db4138beab9f9bf3a5465d120752d3dce4a5afc3467a726", - "size": 36680 + "sha256": "8ca88b380c72f81e0a97612b0ca18b537704f0abb689200322d92c9a5426ff11", + "size": 36560 }, { "url": "https://raw.githubusercontent.com/anthropics/claude-plugins-official/main/plugins/claude-security/NOTICE.md", @@ -31950,8 +31992,8 @@ "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/CHANGELOG.md", "status": "success", "path": "github/anthropic-sdk-python/CHANGELOG.md", - "sha256": "0554632ded937f5cd24751e7a75e3c2caff54f2718f7ab829d9031067d713999", - "size": 289139 + "sha256": "29fa9a0f930170e539d09cae5e2b176d9d0873a2d4d634c5a8d84b88bb843b6a", + "size": 290331 }, { "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/CLAUDE.md", @@ -31999,8 +32041,8 @@ "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/api.md", "status": "success", "path": "github/anthropic-sdk-python/api.md", - "sha256": "e451b725aea9bf5c649e58b48e825a11384310733eb683be105e6fda89cb23e7", - "size": 242500 + "sha256": "ddf8cc9cefd62fe0a02e3eeca8138c6b0652d3c20a15b60e368ed3c1781af3b1", + "size": 251380 }, { "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/browser-toolset.md", @@ -32048,8 +32090,8 @@ "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/src/anthropic/lib/google_cloud/README.md", "status": "success", "path": "github/anthropic-sdk-python/src/anthropic/lib/google_cloud/README.md", - "sha256": "e83a67d54801f3653282ad8c44e57b660a8fadc7d93612504012c7730a048a94", - "size": 5409 + "sha256": "531f04d37f7c42bc92aba65ef927c5f6c198d7bbeac2b7d322316da94ea11714", + "size": 5265 }, { "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/tools.md", @@ -32062,8 +32104,8 @@ "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/main/CHANGELOG.md", "status": "success", "path": "github/anthropic-sdk-typescript/CHANGELOG.md", - "sha256": "037b54e7df6728fb18ab1c8473781731f5986893cd3bd82a49ca11a4ac0fbcb0", - "size": 266170 + "sha256": "ab3bedadf81c094b06de0528597faabbefaec6d9747fe119a88911fe8d1fc21d", + "size": 266628 }, { "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/main/CLAUDE.md", @@ -32111,8 +32153,8 @@ "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/main/api.md", "status": "success", "path": "github/anthropic-sdk-typescript/api.md", - "sha256": "8b3ec0ac14a7fdb108747af750f8a8cbd7428db6fd834f40f2e40b85363238d0", - "size": 333647 + "sha256": "d42928feefdea38e4fcfd6143c32bb00bdbbd06db935da7448005021dab92d42", + "size": 349361 }, { "url": "https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/main/browser-toolset.md", @@ -32920,7 +32962,24 @@ "size": 2548 } ], - "failures": [], + "failures": [ + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/app-review", + "error": "moved to https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish.md" + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/branding-samples", + "error": "moved to https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button.md" + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/organization-billing-connections", + "error": "moved to https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing.md" + }, + { + "url": "https://platform.claude.com/docs/en/manage-claude/oauth-apps/oauth-reference", + "error": "moved to https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters.md" + } + ], "dead": [ { "url": "https://code.claude.com/docs/en/claude-tag", @@ -34264,11 +34323,11 @@ } ], "summary": { - "total": 5037, - "downloaded": 4702, + "total": 5047, + "downloaded": 4708, "skipped": 0, "failed": 0, - "dead": 335, + "dead": 339, "success_rate": 100.0 } } \ No newline at end of file diff --git a/content/claude-code-manifest.json b/content/claude-code-manifest.json index 6bdb4b7390..3962ca0cbd 100644 --- a/content/claude-code-manifest.json +++ b/content/claude-code-manifest.json @@ -116,7 +116,6 @@ "_nodeVersion": "24.22.3", "dependencies": {}, "_hasShrinkwrap": false, - "readmeFilename": "README.md", "optionalDependencies": { "@anthropic-ai/claude-code-linux-x64": "2.1.331", "@anthropic-ai/claude-code-win32-x64": "2.1.331", diff --git a/content/claude/claude-science/changelog.md b/content/claude/claude-science/changelog.md index f0058ccf12..3bf445b72c 100644 --- a/content/claude/claude-science/changelog.md +++ b/content/claude/claude-science/changelog.md @@ -6,6 +6,14 @@ > Release notes for Claude Science, including new features, improvements, and bug fixes by version. +**0.1.75** + +November 24, 2026 + +* Mac and Linux: Claude can commit to git again. It commits in its own copy of your repository, then pulls the commit into your **Read & write** folder. It can also pull GitHub's commits into the branch you have checked out. It asks once for each repository in a project. After that, it pulls without asking, even if that changes scripts or deletes files, until you revoke this in **Settings > Permissions** or stop sharing the folder. A pull stops if your uncommitted changes are in the way. Claude's commits can show a name other than yours, and they skip your git hooks and signing. On Windows, Claude usually gives you its commits as a file to fetch instead +* You can now let Claude save skill files (`SKILL.md`) in a repository or **Read & write** folder without asking each time, for the session or, in a git repository, across the project's sessions. It can then overwrite skill files there, even yours, with no backup. It still asks every time in some places, such as `.agents/skills`, and can't save in others, such as `.claude/skills` +* Bug fixes and reliability improvements + **0.1.73** November 18, 2026 diff --git a/content/claude/third-party/claude-desktop/admin-console-claude-code-reference.md b/content/claude/third-party/claude-desktop/admin-console-claude-code-reference.md index 903668d892..c45211c679 100644 --- a/content/claude/third-party/claude-desktop/admin-console-claude-code-reference.md +++ b/content/claude/third-party/claude-desktop/admin-console-claude-code-reference.md @@ -147,7 +147,7 @@ Claude Code keeps these on the developer's computer, among other files: A developer doesn't need administrator access to bypass your settings. These are some of the ways a developer can work without them, and what limits each one: -* **Signs in to another organization that's set up this way, on a computer with no managed settings**: the other organization's settings apply instead of yours, including its OpenTelemetry collector. `forceLoginOrgUUID` in the computer's managed settings limits this. +* **Signs in to another organization that's set up this way, on a computer with no managed settings**: the other organization's settings, including its OpenTelemetry collector, apply instead of your organization's settings. `forceLoginOrgUUID` in the computer's managed settings limits this. * **Signs in to your organization while still signed in to a Claude apps gateway, on a computer with no managed settings**: sessions stay on that gateway, and your settings don't apply. The sign-in then prints `Claude Code still uses the gateway at`. To fix it, the developer runs `claude auth logout` in their terminal and signs in to your organization again. If their own settings set `forceLoginMethod` to `gateway`, they first remove it and `forceLoginGatewayUrl`. `forceLoginOrgUUID` limits this. `/status` in Claude Code shows a session that follows a gateway's own settings as `Cloud gateway`, and the **Allow sign-in from Claude Code in terminals and IDEs** switch doesn't stop it. * **Signs in with their own Claude account**: Claude Code ends the organization sign-in and removes the stored copy of your settings. `forceLoginOrgUUID` limits this. On a computer that requires the sign-in, a claude.ai login still starts sessions on the Anthropic API, without your settings. * **Changes how Claude Code starts on their own computer**: the sign-in keys are checked on the developer's computer. Sessions can run on the Anthropic API under another login, without your settings. `allowedProviders` without `"anthropic"` in the computer's managed settings limits this, if developers don't need direct access to the Anthropic API. Otherwise, only controls outside Claude Code limit this. diff --git a/content/claude/third-party/claude-desktop/admin-console-claude-code.md b/content/claude/third-party/claude-desktop/admin-console-claude-code.md index f9964d1ef4..023253d52a 100644 --- a/content/claude/third-party/claude-desktop/admin-console-claude-code.md +++ b/content/claude/third-party/claude-desktop/admin-console-claude-code.md @@ -135,7 +135,7 @@ Go through your `managed-settings.json`, MDM profile, or registry policy, and pu * **`apiKeyHelper`**: use the **Helper script** on the **Connection** page. It takes the path to a program, not a shell command. You still need to [install that program on each computer](https://claude.com/docs/third-party/claude-desktop/credential-helper.md#install-the-helper-for-claude-code-in-the-terminal). * **OpenTelemetry export (`CLAUDE_CODE_ENABLE_TELEMETRY` and the `OTEL_` variables)**: use **OTLP endpoint** and the other OTLP fields on the **Telemetry & updates** page. If you [keep managed settings beside the console](#keep-managed-settings-beside-the-console), leave these variables in them until each computer has Claude Code 2.1.331. Earlier versions export only where these variables say. -The fields on the **Desktop 3P** pages also apply to Claude Desktop, so check that each value works there too. +The fields on the **Desktop 3P** pages also apply to Claude Desktop, so check that each value also works in Claude Desktop. If an entry under `sandbox` or in `disabledMcpjsonServers` starts with `//`, remove one slash, because Claude Code ignores such an entry. Leave `//` in deny and ask rules. @@ -309,6 +309,6 @@ To require the sign-in, first turn on sign-in from Claude Code. If you removed y If you set a retention period under `HKCU` on Windows, add it to this file as `cleanupPeriodDays`. Claude Code ignores `HKCU` once the computer has managed settings. -To test it, ask a developer who isn't signed in to run `claude`. Claude Code prints a message, `This computer's managed settings require a sign-in to Anthropic`, and exits. If Claude Code starts instead, check that its version is 2.1.331 or later, and that developers' accounts can read the file. +To test the requirement, ask a developer who isn't signed in to run `claude`. Claude Code prints a message, `This computer's managed settings require a sign-in to Anthropic`, and exits. If Claude Code starts instead, check that its version is 2.1.331 or later, and that developers' accounts can read the file. For other ways around your settings, see [Security considerations](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code-reference.md#security-considerations). diff --git a/content/claude/third-party/claude-desktop/admin-console.md b/content/claude/third-party/claude-desktop/admin-console.md index 3752ce60ea..ed058c4e2b 100644 --- a/content/claude/third-party/claude-desktop/admin-console.md +++ b/content/claude/third-party/claude-desktop/admin-console.md @@ -409,7 +409,7 @@ Upload your current configuration, as described under [Start from an existing co **2. Finish the configuration before users sign in** -Set every setting you rely on in the console, because the console's configuration replaces the profile's. Add your [plugin marketplaces](#plugin-marketplaces) on the **Plugins** page. To migrate users' work, check that the **Automatically import earlier third-party sessions** switch under **Claude.ai data import** on the **Capabilities** page is on (the default). To skip the migration, turn it off. Devices that already migrated keep their items. +Set every setting you rely on in the console, because the console's configuration replaces the profile's configuration. Add your [plugin marketplaces](#plugin-marketplaces) on the **Plugins** page. To migrate users' work, check that the **Automatically import earlier third-party sessions** switch under **Claude.ai data import** on the **Capabilities** page is on (the default). To skip the migration, turn it off. Devices that already migrated keep their items. If users have designs or slide decks, also turn on [Design and Slides](https://claude.com/docs/third-party/claude-desktop/design-and-slides.md#turn-on-design-and-slides). Only [Claude Desktop 7.37095.0 or later](#what-is-migrated) migrates designs and decks. Users see them only where Design and Slides is turned on. @@ -467,7 +467,7 @@ With Claude Desktop 5.11492.0 or later, users set up these items again. [Earlier * **Project links**: add them again on each project's page * **Design systems that users added on the computer**: [add them again](https://claude.com/docs/third-party/claude-desktop/design-and-slides.md#add-a-design-system-on-one-computer) * **Project folders in Chat**: Claude can't read a migrated project's folder in Chat until the user [adds the folder to the project again](https://claude.com/docs/third-party/claude-desktop/import.md#make-an-imported-project-folder-readable-in-chat) -* **Model of scheduled tasks, and the approval mode of some**: each task arrives with **Default model**. A task that ran on **Automatically approve** or in bypass permissions mode arrives on **Automatically approve** if its tab offers that mode when the device migrates. Cowork offers it only where [`autoModeEnabled`](https://claude.com/docs/third-party/claude-desktop/configuration#automodeenabled) is `true`. Code offers it unless `autoModeEnabled` is `false` or a managed Claude Code setting turns Auto mode off. Any other task arrives without its approval mode. Until the user sets the mode again, a run that needs an approval waits for them. +* **Model of scheduled tasks, and the approval mode of some**: each task arrives with **Default model**. A task that ran on **Automatically approve** or in bypass permissions mode arrives on **Automatically approve** if its tab offers that mode when the device migrates. Cowork offers it only if [`autoModeEnabled`](https://claude.com/docs/third-party/claude-desktop/configuration#automodeenabled) is `true`. Code offers it unless `autoModeEnabled` is `false` or a managed Claude Code setting turns Auto mode off. Any other task arrives without its approval mode. Until the user sets the mode again, a run that needs an approval waits for them. * **Sidebar pins of sessions and scheduled tasks**: pin them again * **Optional organization plugins that the migration skipped**: install them again from **Customize → Plugins → Discover → Organization** * **Plugins from marketplaces the user added**: add the marketplace and install the plugins again diff --git a/content/claude/third-party/claude-desktop/bedrock.md b/content/claude/third-party/claude-desktop/bedrock.md index a6128b0620..95f9c53984 100644 --- a/content/claude/third-party/claude-desktop/bedrock.md +++ b/content/claude/third-party/claude-desktop/bedrock.md @@ -135,7 +135,7 @@ To run the login command, the app locates the AWS CLI by searching the launch en If your AWS configuration files are not at the default location, set `inferenceBedrockAwsDir` to the directory that contains them. -In [SSH remote sessions](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md#amazon-bedrock-with-a-named-profile), Claude Code signs in on the host, not on the device. Each host needs a profile of the same name, and users sign in to it there if it needs a sign-in. +In [SSH remote sessions](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md#amazon-bedrock-with-a-named-profile), Claude Code signs in on the host, not on the device. Each host needs a profile of the same name. If that profile needs a sign-in, users sign in to the profile on the host. ### Sign in with your identity provider @@ -172,18 +172,24 @@ With AWS set up and devices prepared, open the [in-app configuration window](htt | Field | Bearer token | In-app AWS sign-in | Named profile | | - | - | - | - | -| AWS region | e.g. `us-west-2` | e.g. `us-west-2` | e.g. `us-west-2` | -| AWS bearer token | your Amazon Bedrock API key | *leave empty* | *leave empty* | +| Credential kind | **Static API key** | **Interactive sign-in** | **Cloud vendor profile** | +| AWS region | for example, `us-west-2` | for example, `us-west-2` | for example, `us-west-2` | +| AWS bearer token | your Amazon Bedrock API key | *field hidden* | *field hidden* | | Bedrock base URL | *optional* | *optional* | *optional* | -| AWS profile name | *leave empty* | *leave empty* | `claude-cowork` | -| AWS config directory | *leave empty* | *leave empty* | *only if not `~/.aws`* | -| AWS CLI path | *leave empty* | *leave empty* | *optional* | -| AWS SSO start URL | *leave empty* | `https://d-xxxxxxxxxx.awsapps.com/start` | *leave empty* | -| AWS SSO region | *leave empty* | e.g. `us-east-1` | *leave empty* | -| AWS SSO account ID | *leave empty* | `123456789012` | *leave empty* | -| AWS SSO role name | *leave empty* | `BedrockInference` | *leave empty* | +| AWS profile name | *field hidden* | *field hidden* | `claude-cowork` | +| AWS config directory | *field hidden* | *field hidden* | *only if not `~/.aws`* | +| AWS CLI path | *field hidden* | *field hidden* | *optional* | +| AWS SSO start URL | *field hidden* | `https://d-xxxxxxxxxx.awsapps.com/start` | *field hidden* | +| AWS SSO region | *field hidden* | for example, `us-east-1` | *field hidden* | +| AWS SSO account ID | *field hidden* | `123456789012` | *field hidden* | +| AWS SSO role name | *field hidden* | `BedrockInference` | *field hidden* | | Bedrock service tier | *optional* | *optional* | *optional* | +For the other authentication approaches, select a different **Credential kind**: + +* **[Identity provider sign-in](#sign-in-with-your-identity-provider)**: select **Identity provider sign-in (OIDC)** +* **[Credential helper](https://claude.com/docs/third-party/claude-desktop/configuration.md#inferencecredentialhelper)**: select **Helper script** + Under **Models**, add a **Model list** entry using the Amazon Bedrock inference-profile ID (optional for bearer-token or credential-helper auth, which auto-discover models; required otherwise), for example `us.anthropic.claude-sonnet-5`. In an AWS GovCloud (US) region (`us-gov-*`), use inference-profile IDs that start with `us-gov.` in place of `us.`. To allow the app through your firewall in these regions, see the FIPS endpoints on the **Amazon Bedrock** tab under [Inference provider](https://claude.com/docs/third-party/claude-desktop/telemetry.md#inference-provider). diff --git a/content/claude/third-party/claude-desktop/configuration-format.md b/content/claude/third-party/claude-desktop/configuration-format.md index 05855fd3d8..5ea499e5b8 100644 --- a/content/claude/third-party/claude-desktop/configuration-format.md +++ b/content/claude/third-party/claude-desktop/configuration-format.md @@ -92,7 +92,7 @@ The managed source on Linux is a single JSON file, `/etc/claude-desktop/managed- ```json theme={null} { "inferenceProvider": "gateway", - "inferenceGatewayBaseUrl": "https://gateway.example.com/v1", + "inferenceGatewayBaseUrl": "https://gateway.example.com", "inferenceGatewayApiKey": "sk-example", "inferenceCustomHeaders": { "X-Tenant-Id": "acme" } } diff --git a/content/claude/third-party/claude-desktop/credential-helper.md b/content/claude/third-party/claude-desktop/credential-helper.md index b848617008..b0ebb58522 100644 --- a/content/claude/third-party/claude-desktop/credential-helper.md +++ b/content/claude/third-party/claude-desktop/credential-helper.md @@ -86,7 +86,7 @@ By default, when a running session's credential is rejected, Claude Desktop re-r ## Install the helper for Claude Code in the terminal -If you [manage Claude Code in the terminal from the Enterprise Admin Console](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code.md), Claude Code can also run the **Helper script** on your **Connection** page and the **OTLP headers helper script** on your **Telemetry & updates** page. Claude Code checks each script before it runs it: +If you [manage Claude Code in the terminal from the Enterprise Admin Console](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code.md), Claude Code can also run the **Helper script** on your **Connection** page and the **OTLP headers helper script** on your **Telemetry & updates** page. Claude Code checks each script before running it: * **On macOS and Linux**: the script runs only if the developer's account can't change any of these: the script, the interpreter on its `#!` line, any file that an argument names, and every folder above those files. For example, make them all owned by root with mode `755`. Start the script with the full path of its interpreter, such as `#!/bin/bash`, not `#!/usr/bin/env`. The script doesn't run when Claude Code runs as root. * **On Windows**: install the script, and any file that an argument names, under `C:\Program Files`, not `C:\Program Files (x86)`. Give the full path of each file. Claude Code checks only where the files are, so keep that folder's default permissions. diff --git a/content/claude/third-party/claude-desktop/data-storage.md b/content/claude/third-party/claude-desktop/data-storage.md index deb1d925d8..32815df51e 100644 --- a/content/claude/third-party/claude-desktop/data-storage.md +++ b/content/claude/third-party/claude-desktop/data-storage.md @@ -47,6 +47,7 @@ Within the application-data directory: | `claude-code-sessions/` | Code session records holding each session's working folder, settings, title, and sometimes a short summary. The conversation transcripts themselves are in Claude Code's own store at `~/.claude/projects/`, outside this directory. | | `scratch-workspaces/` | The private working folders of Code sessions that users start without choosing a folder. When a user deletes such a session, the app deletes its folder, with its files, about a week later. [Automatic deletion of idle sessions](#automatic-deletion-of-idle-sessions) deletes the folder when it deletes the session. A folder that another session still uses stays. | | `claude-code/`, `claude-code-vm/` | Claude Code binary and VM workspace data for Code sessions. | +| `import-bundles/` | The unzipped copy of a [Claude Desktop export](https://claude.com/docs/third-party/claude-desktop/import.md#move-your-data-to-another-device) that a user chose to import. | | `vm_bundles/` | Cached copy of the VM workspace bundle that Cowork uses, plus the data disk the app creates to hold Cowork sessions' home directories inside the VM. | | `local-agent-mode-sessions/.../cowork_plugins/` | User-installed and [org-provisioned](https://claude.com/docs/third-party/claude-desktop/extensions.md#organization-plugins-admin) plugins. Created on first plugin install. | | `plugin-mcp-auth/`, `connectors/*/plugin-mcp/` | On Windows and Linux, the `.credentials.json` file that holds the user's sign-ins to plugin servers, made outside **Code**. See [Credentials](#credentials). | @@ -58,7 +59,7 @@ The app doesn't encrypt conversations, settings, or the locally applied configur The logs directory contains `main.log` (application and configuration-validation events), `ssh.log` (SSH connection events), `cowork_vm_node.log` (sandbox VM activity), `claude.ai-web.log` (renderer events), and `mcp.log` / `mcp-server-.log` (MCP connection events). -Separately from the application-data directory, Claude Desktop writes live artifacts (interactive pages) and scheduled-task results to `~/Claude/` in your home directory, or `~/Documents/Claude/` on legacy installs. This folder is intended for you to browse directly and is not removed when you delete the application-data directory. To back up a user's data, copy every location listed under [Copy the data to the new device](#copy-the-data-to-the-new-device). +Separately from the application-data directory, Claude Desktop writes live artifacts (interactive pages) and scheduled-task results to `~/Claude/` in the user's home directory, or `~/Documents/Claude/` on legacy installs. This folder is intended for the user to browse directly and is not removed when you delete the application-data directory. To back up a user's data, copy every location listed under [Copy the data to the new device](#copy-the-data-to-the-new-device). ### Virtual desktops @@ -273,7 +274,7 @@ Copy the data if: * **Your policies don't let users save their conversations and files to a zip file** * **Claude Desktop doesn't open on the old device**, so the user can't start an export * **You set `allowedOrganizationUuids`** under [`claudeAiImport`](https://claude.com/docs/third-party/claude-desktop/configuration#claudeaiimport), which turns off import from a file -* **The export dialog says that the export is over the import limit of 20 GB or 5,000,000 files** +* **The user has more than 20 GB of data or 5,000,000 files to export.** An export leaves out some of their files, or stops with the message **This export is over the import limit of 20 GB or 5,000,000 files.** Versions before 6.6395.0 have a [100 MB limit](https://claude.com/docs/third-party/claude-desktop/import.md#what-a-claude-desktop-export-moves) on some files. Use an export and import if: @@ -297,7 +298,7 @@ For the user's steps and the full list of data that moves, see [Move your data t `exportEnabled` works only when `enabled` is on. -* **`exportEnabled`**: users can export their data to a zip file anywhere they can save files. The file contains sessions with attached and output files, projects, the files of each project whose folder is in the default location (`~/Claude/Projects`), memory, scheduled tasks, saved skills, uploaded plugins, some app preferences, and the commands, arguments, and environment variable names of local MCP servers. It also lists the paths of the other folders that projects use, and of the folders and files that scheduled tasks use. If you set `allowedOrganizationUuids`, it contains only sessions, their files, and project names and instructions. +* **`exportEnabled`**: users can export their data to a zip file anywhere they can save files. The file contains sessions with attached and output files, projects, the files of each project folder that's directly inside the **Projects** folder of the user's Cowork files folder (`~/Claude/Projects` by default), memory, scheduled tasks, saved skills, uploaded plugins, some app preferences, and the commands, arguments, and environment variable names of local MCP servers. It also lists the paths of the other folders that projects use, and of the folders and files that scheduled tasks use. If you set `allowedOrganizationUuids`, it contains only sessions, their files, and project names and instructions. * **`enabled`**: users can import an export file from another device, a claude.ai data export, and earlier sessions on the device. Claude Desktop can't verify who made an export file, so it asks the user to confirm that the file is their own. If the user doesn't confirm, only the sessions are imported, with the projects and attached files that they use. After the user confirms: @@ -316,6 +317,16 @@ After the user confirms: The old device keeps its data until you [remove it](#removing-data). +### Fix the `UNPACK_FOLDER_BLOCKED` error + +When a user chooses an export file to import, Claude Desktop unzips the file into the `import-bundles` folder of the user's [application-data directory](#where-data-lives). If the app can't use that folder, for example because the user's account can't open it, the import wizard shows **Couldn’t unpack this export** with the code `UNPACK_FOLDER_BLOCKED`. Take these steps on the user's device: + +1. Have the user quit Claude Desktop. Closing its window can leave the app running. +2. Delete `import-bundles`. The folder holds only unzipped copies of export files. The export files themselves stay where the user saved them. +3. Have the user open Claude Desktop and import the file again. The app creates the folder again. + +If the message comes back, send the code and a [diagnostic report](https://claude.com/docs/third-party/claude-desktop/installation.md#troubleshooting) to your Anthropic representative. + ### What a copy moves A [copy](#copy-the-data-to-the-new-device) moves: diff --git a/content/claude/third-party/claude-desktop/extensions.md b/content/claude/third-party/claude-desktop/extensions.md index cb1d659060..78775094b3 100644 --- a/content/claude/third-party/claude-desktop/extensions.md +++ b/content/claude/third-party/claude-desktop/extensions.md @@ -543,7 +543,7 @@ You can deliver a hook that has to run for every user, such as one that logs eac * **In a plugin**: add the plugin's marketplace to [`allowedPluginMarketplaces`](#configure-the-marketplace) with `installationPreference` set to [`"required"`](#marketplace-installation-preferences). Once Claude Desktop has fetched the marketplace, the plugin's hooks run from the first message of each Cowork session, Chat conversation, and local Code session. In a local Code session, a user can turn them off with [`disableAllHooks`](https://code.claude.com/docs/en/settings-reference#disableallhooks) in their own or a project's Claude Code settings. * **In Claude Code managed settings**: write the hooks under the [`hooks`](https://code.claude.com/docs/en/settings-reference#hooks) key of the Claude Code [managed settings](https://claude.com/docs/third-party/claude-desktop/code.md#interaction-with-claude-code%E2%80%99s-own-managed-settings) on each device, and put any script that they call on the device too, where users can't change it. These hooks run in Cowork sessions, Chat conversations, and local Code sessions with no plugin to install, and a user's `disableAllHooks` doesn't stop them. If these are the device's first Claude Code managed settings, also set `parentSettingsBehavior` to `"merge"` in them, or Claude Code ignores the [managed policy](https://claude.com/docs/third-party/claude-desktop/code.md#applied-as-managed-policy) values that Claude Desktop supplies. -In an SSH remote session, a plugin's hooks run where Claude Desktop copies them to the host (see [Plugin hooks on the remote host](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md#plugin-hooks-on-the-remote-host)), and Claude Code on the host doesn't read the device's managed settings. For a hook that has to run in every remote session, deploy Claude Code managed settings [on the host](https://code.claude.com/docs/en/managed-settings#where-each-mechanism-stores-the-policy) in the same way. To turn off users' own hooks there too, deploy the example under [Turn off user hooks](#turn-off-user-hooks). +In an SSH remote session, a plugin's hooks can run if Claude Desktop copies them to the host (see [Plugin hooks on the remote host](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md#plugin-hooks-on-the-remote-host)). Claude Code on the host doesn't read the device's managed settings. For a hook that has to run in every remote session, deploy Claude Code managed settings [on the host](https://code.claude.com/docs/en/managed-settings#where-each-mechanism-stores-the-policy) in the same way. To turn off users' own hooks there too, deploy the example under [Turn off user hooks](#turn-off-user-hooks). ### Turn off user hooks diff --git a/content/claude/third-party/claude-desktop/foundry.md b/content/claude/third-party/claude-desktop/foundry.md index ffaab99344..7c09af987c 100644 --- a/content/claude/third-party/claude-desktop/foundry.md +++ b/content/claude/third-party/claude-desktop/foundry.md @@ -97,13 +97,16 @@ Open the [in-app configuration window](https://claude.com/docs/third-party/claud | Field | API key | In-app Entra ID sign-in | | - | - | - | +| Credential kind | **Static API key** | **Interactive sign-in** | | Azure AI Foundry resource name | `your-foundry-resource` | `your-foundry-resource` | -| Azure AI Foundry API key | your resource key | *leave empty* | -| Entra ID tenant ID | *leave empty* | `00000000-0000-0000-0000-000000000000` | -| Entra ID client ID | *leave empty* | `11111111-1111-1111-1111-111111111111` | -| Entra ID sign-in flow | *leave empty* | `browser` or `broker`, or leave empty for the default device-code flow | +| Azure AI Foundry API key | your resource key | *field hidden* | +| Entra ID tenant ID | *field hidden* | `00000000-0000-0000-0000-000000000000` | +| Entra ID client ID | *field hidden* | `11111111-1111-1111-1111-111111111111` | +| Entra ID sign-in flow | *field hidden* | `browser` or `broker`, or leave empty for the default device-code flow | | Azure AI Foundry base URL | *optional*, see [Route requests through a gateway](#route-requests-through-a-gateway) | *optional* | +For a [credential helper](https://claude.com/docs/third-party/claude-desktop/configuration.md#inferencecredentialhelper), set **Credential kind** to **Helper script**. + Under **Models**, add at least one **Model list** entry using the Microsoft Foundry deployment name. Then click **Export** to produce a `.mobileconfig` (macOS) or `.reg` (Windows) file for your MDM. See [Deploy with MDM](https://claude.com/docs/third-party/claude-desktop/mdm.md) for the export and deployment workflow. diff --git a/content/claude/third-party/claude-desktop/gateway.md b/content/claude/third-party/claude-desktop/gateway.md index 615cc38ed6..0f096e3aa5 100644 --- a/content/claude/third-party/claude-desktop/gateway.md +++ b/content/claude/third-party/claude-desktop/gateway.md @@ -95,12 +95,12 @@ For Kong, Envoy, or Azure API Management, configure the equivalent JWT validatio **3. Configure in the app** -Open the [in-app configuration window](https://claude.com/docs/third-party/claude-desktop/in-app-configuration.md#open-the-configuration-window) (**Developer → Configure Third-Party Inference…**). In the **Connection** section, set **Inference provider** to **Gateway** and **Credential kind** to **Interactive sign-in**. This hides the API-key field and reveals **Gateway SSO IdP (OIDC)**: +Open the [in-app configuration window](https://claude.com/docs/third-party/claude-desktop/in-app-configuration.md#open-the-configuration-window) (**Developer → Configure Third-Party Inference…**). In the **Connection** section, set **Inference provider** to **Gateway** and **Credential kind** to **Interactive sign-in**. This reveals **Gateway SSO IdP (OIDC)**: | Field | Value | | - | - | -| Gateway base URL | `https://llm-gateway.example.corp` | | Credential kind | **Interactive sign-in** | +| Gateway base URL | `https://llm-gateway.example.corp`, without `/v1` at the end, because the app adds `/v1/messages` | | Gateway SSO IdP (OIDC) → Client ID | `YOUR_CLIENT_ID` | | Gateway SSO IdP (OIDC) → Issuer URL | `https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0` | | Gateway SSO IdP (OIDC) → Scopes | *leave empty for the default* | @@ -176,10 +176,12 @@ Open the [in-app configuration window](https://claude.com/docs/third-party/claud | Field | Value | | - | - | -| Gateway base URL | `https://llm-gateway.example.corp` | -| Gateway API key | your gateway key (or a placeholder if your gateway has none) | -| Credential kind | **Static API key** (default), or **Interactive sign-in** for [single sign-on](#single-sign-on-with-your-identity-provider) | -| Gateway auth scheme | **Bearer** (default) or **x-api-key** | +| Credential kind | **Static API key**, **Interactive sign-in** for [single sign-on](#single-sign-on-with-your-identity-provider), or **Helper script** for a [credential helper](https://claude.com/docs/third-party/claude-desktop/configuration.md#inferencecredentialhelper) | +| Gateway base URL | `https://llm-gateway.example.corp`, without `/v1` at the end, because the app adds `/v1/messages` | +| Gateway API key | when **Credential kind** is **Static API key**, enter your gateway key (or a placeholder if your gateway has none) | +| Gateway auth scheme | when **Credential kind** is **Static API key** or **Helper script**, select **Bearer** (default) or **x-api-key** | + +For the **Identity provider sign-in (OIDC)** credential kind (`external-idp`), see [Single sign-on configuration keys](#single-sign-on-configuration-keys). Then click **Export** to produce a `.mobileconfig` (macOS) or `.reg` (Windows) file for your MDM. See [Deploy with MDM](https://claude.com/docs/third-party/claude-desktop/mdm.md) for the export and deployment workflow. @@ -629,7 +631,7 @@ In sessions that ask the provider for the review, users see one of the following * **A card or notice, and the built-in safety check takes over**: no result comes back, or the provider answers that it doesn't run the review or has turned the review off. The same happens when the request gets one of these errors and then succeeds when the session sends it again without asking for the review: `400`, `403`, `422`, or a `500` or `502` whose response has no `request-id` header. Code shows a card titled **Auto mode switched to its built-in safety check for this session**, and Cowork shows the same words as a notice. In Code, the turn continues once the user selects **Continue**. If nobody answers the card within five minutes, the turn ends, and the action that waited reads `Stopped` and doesn't run. * **Nothing, and work continues**: the `tool_use` IDs are rewritten, or the provider answers that it couldn't run the review this time. The built-in safety check reviews actions. * **Actions don't run**: the `safeguard_results` field arrives in a form the session can't read. Actions that need a review show as `Blocked`. The turn can stop with a card titled `Auto mode’s safety check was unavailable` in Code, and with a notice that begins `Auto mode is unavailable` in Cowork. As a temporary measure, [turn off **Server-side Auto mode checks**](#turn-off-server-side-auto-mode-checks). -* **Every Auto mode turn fails**: each request that asks for the review gets an error, and the session doesn't send it again without asking for the review. This happens after every other error, such as `401`, `404`, or `413`. This includes a `500` or `502` whose response has a `request-id` header, which the session treats as the provider's own error. See [Troubleshoot](#troubleshoot). +* **Every Auto mode turn fails**: each request that asks for the review gets an error, and the session doesn't send it again without asking for the review. This happens after any error other than `400`, `403`, `422`, or a `500` or `502` whose response has no `request-id` header. Examples are `401`, `404`, `413`, and a `500` or `502` whose response has a `request-id` header, which the session treats as the provider's own error. See [Troubleshoot](#troubleshoot). To find out which of these a user saw, have the user go to **Help > Troubleshooting > Generate Diagnostic Report** and select **Export to file** right after it happens. If Code shows the card, the user selects **Continue** first. Read the report as described in [Test Auto mode checks on one device](#test-auto-mode-checks-on-one-device). A Code session on an SSH host doesn't write its Auto mode lines to this report. @@ -664,7 +666,7 @@ A `requested` line means that the session asked for the review. The lines after | `no_verdict`, `server_unsupported` | The provider doesn't run the review for this model or key. | Use a provider and model that run the review, or, as a temporary measure, [turn off **Server-side Auto mode checks**](#turn-off-server-side-auto-mode-checks). | | `no_verdict`, `other_tool_use_ids` | Verdicts came back under IDs that none of the response's actions has. | Return the provider's `tool_use` IDs unchanged. | | `no_verdict`, `server_unrecognized_result` | The session can't read the `safeguard_results` field. | As a temporary measure, [turn off **Server-side Auto mode checks**](#turn-off-server-side-auto-mode-checks), because actions that need a review don't run. Then compare what your gateway returned to the client with [the requirements](#gateway-requirements-for-auto-mode-checks). | -| `not_requested`, `beta_rejected` | Your gateway, or the provider behind it, returned a `400`, `403`, `422`, `500`, or `502` to an earlier request that asked for the review, so the session stopped asking. | Check your gateway's logs for which of the two refused the request. If your gateway refused the request, have your gateway accept [the `dangerous-tool-use-2026-09-03` value and the `safeguards` field](#gateway-requirements-for-auto-mode-checks). For the provider, follow the `server_unsupported` row. | +| `not_requested`, `beta_rejected` | Your gateway, or the provider behind it, returned a `400`, `403`, `422`, `500`, or `502` to an earlier request that asked for the review, so the session stopped asking. | Check your gateway's logs for which of the two refused the request. If your gateway refused the request, have your gateway accept [the `dangerous-tool-use-2026-09-03` value and the `safeguards` field](#gateway-requirements-for-auto-mode-checks). If the provider refused the request, follow the `server_unsupported` row. | | `not_requested`, `betas_disabled`, `switch` is `off` | **Server-side Auto mode checks** is off for this device, because you turned it off, because Claude Desktop can't read the key's value, or because the key isn't set and the device has an earlier version of Claude Desktop, where the setting is off by default. | [Turn the setting on for the device](#test-auto-mode-checks-on-one-device). On an earlier version, you can update Claude Desktop instead. | | `not_requested`, `betas_disabled`, `switch` is `on` | The device's own Claude Code managed settings or a compliance policy turn experimental betas off, which takes priority. | If a `requested` line follows, ignore this line. If none follows, check whether the device's [Claude Code managed settings](https://code.claude.com/docs/en/managed-settings) set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`. | | Only `requested`, and Claude's actions show as `Blocked` | The session couldn't read the verdicts, or the response ended before they arrived. | If the log also holds `cli_stream_failed` lines, see the streaming requirement in [Context window and compaction](#context-window-and-compaction). Otherwise, follow the `server_unrecognized_result` row. | diff --git a/content/claude/third-party/claude-desktop/import.md b/content/claude/third-party/claude-desktop/import.md index 283d69b60c..9612b618a9 100644 --- a/content/claude/third-party/claude-desktop/import.md +++ b/content/claude/third-party/claude-desktop/import.md @@ -29,7 +29,7 @@ Along with the sessions, the automatic copy brings over other things you had und * **Attached files**: the files you attached to Cowork and Chat sessions, except configuration files such as `CLAUDE.md`, `.mcp.json`, and `.env`. Some files can stay behind when the disk is nearly full. * **Imported data**: sessions you imported under the earlier configuration from a [Claude Desktop export](#move-your-data-to-another-device) or a folder. The projects and scheduled tasks of an export you imported with **Import as my own** come over too. -The copy runs once on each computer, in the background shortly after the app starts, and the sessions then appear in the sidebar. Your original sessions stay where they were, and sessions you already imported under the new configuration are skipped. The copy is listed under **Import history** in **Settings → Import & export**, where the **Remove** button deletes the copied sessions and the projects copied with them. The app doesn't copy them again later. +The copy runs once on each computer, in the background shortly after the app starts, and the sessions then appear in the sidebar. Your original sessions stay where they were, and sessions you already imported under the new configuration are skipped. The copy is listed under **Import history** in **Settings → Import & export**, where the **Remove** button deletes the copied sessions and the projects copied with them. The app doesn't copy them again later. Copied scheduled tasks stay. A Cowork scheduled task that belonged to a removed project keeps running without that project's description and memory, and the task's page has an **Unlink** button. Copied sessions go back into custom groups of the same name in the sidebar, and Cowork sessions keep their connected folders. Sessions and scheduled tasks arrive unpinned. The copy doesn't bring connector sign-ins, files you attached to Code sessions, or **Always allow** choices. It also doesn't bring app preferences such as the model, per-tool permissions, and notifications. Set them up again as you need them. [Design systems you added on the computer](https://claude.com/docs/third-party/claude-desktop/design-and-slides.md#add-a-design-system-on-one-computer) stay under the earlier configuration and aren't copied. Add them again. @@ -158,6 +158,8 @@ Click **Continue**, or **Skip this step** if you only want to bring in local ses The wizard scans this machine for Cowork and Claude Code sessions from an earlier Claude Desktop install and lists what it finds. Choose how far back to include, and add any other folder that holds sessions (for example, a backup or a folder copied from another machine). On Windows, the folder has to be on a local disk. The wizard can't import one from a network share or a mapped network drive, so copy it to the computer first. +From a folder that you add, the wizard imports only sessions, their output files, and project names. If you copy only the [application-data directory](https://claude.com/docs/third-party/claude-desktop/data-storage.md#where-data-lives) from another device, the wizard doesn't import that device's Code sessions. To move Code sessions, attached files, memory, project files, and your other data from another device, [export your data on that device](#move-your-data-to-another-device) instead. + ![Import from Claude wizard step 2, Cowork and Code, listing 5 local sessions with a time-range selector and an option to add another location.](https://mintcdn.com/claude-ai/RVrsc-fMoqOV1t9C/images/third-party/import/import-local-sessions.png?fit=max\&auto=format\&n=RVrsc-fMoqOV1t9C\&q=85\&s=24f96c7b665e4a82fa8f552c20c60312) Local sessions found on this machine. @@ -180,16 +182,24 @@ Import complete. Imported chats appear in the sidebar and imported projects appe ## If a project already exists -When an imported project has the same name as a project already in Claude Desktop, the wizard adds a **Duplicates** step after the import finishes. The step lists each match with two choices. +When an imported project has the same name as a project already in Claude Desktop, you have two choices for each duplicate. Make them in the wizard's **Duplicates** step, which comes after the import finishes, or [on the **Projects** page](#merge-or-keep-a-duplicate-on-the-projects-page). ![Import from Claude wizard step 4, Duplicates, headed These projects already exist, listing five Northwind projects each with Merge into existing and Keep separate buttons and a Continue button.](https://mintcdn.com/claude-ai/XDpDaIQ3J0Amhn8h/images/third-party/import/import-duplicates.png?fit=max\&auto=format\&n=XDpDaIQ3J0Amhn8h\&q=85\&s=798f75d5a508ebcb7082373b5cf95d84) The Duplicates step, listing imported projects that match ones you already have. -* **Merge into existing** moves the imported chats and sessions into your existing project and removes the duplicate. Folders you attached to the duplicate, and its memory, move with them. If your existing project has no instructions of its own, the imported project's instructions are shown there for you to review and accept. Later imports from the same source go into the existing project as well, except from a folder you added, where the wizard asks again. For a [Claude Desktop export](#move-your-data-to-another-device), the wizard also asks again unless you click **Import as my own** each time. +* **Merge into existing** moves the imported chats and sessions into your existing project and removes the duplicate. Folders that you attached to the duplicate move too, if they're outside the **Projects** folder of your [Cowork files folder](https://claude.com/docs/third-party/claude-desktop/data-storage.md#data-shared-with-standard-claude-desktop). If your existing project has no instructions of its own, the imported project's instructions are shown there for you to review and accept. Later imports from the same source go into the existing project as well, except from a folder you added, where Claude Desktop asks again. For a [Claude Desktop export](#move-your-data-to-another-device), Claude Desktop also asks again unless you click **Import as my own** each time. + * **Memory**: the merge copies the duplicate's [memory notes](https://claude.com/docs/third-party/claude-desktop/data-storage.md#project-memory) into your existing project, where new tasks and scheduled tasks use them right away. If both projects have a note with the same file name, your existing project keeps its own note. On Claude Desktop versions before 6.6395.0, or when the disk is nearly full, the merge doesn't copy the notes. Notes that the merge doesn't copy stay on the computer, but the app doesn't show them. Ask your administrator to restore them. + * **Files**: the files that the import brought for the duplicate stay in its folder, which is in `~/Claude/Projects` by default. The folder has the project's name. If a folder with that name already exists, the import adds a number such as `(1)`. The merge doesn't add that folder to your existing project. To use the files there, go to the **Projects** page and open your existing project. Next to **Context**, click **+**, select **Choose a folder**, and select the duplicate's folder. If the menu doesn't list it, select **Choose a different folder**. After a merge, later imports don't bring files for the duplicate. * **Keep separate** leaves both projects in place. The imported one keeps a numbered name, such as **Northwind (1)**, and Claude Desktop stops offering to merge it. -The **Projects** page offers the same two choices, in a row under the duplicate project's card and at the top of the duplicate project's own page. Decide there if your history was brought over automatically when you signed in, so you never saw the wizard, or if you closed the wizard before choosing. +### Merge or keep a duplicate on the Projects page + +The **Projects** page offers **Merge into existing** and **Keep separate** in a row under the duplicate project's card and at the top of the duplicate project's own page. Use them if you didn't choose in the wizard, for example: + +* You never saw the wizard, because Claude Desktop imported your history automatically when you signed in +* You closed the wizard before choosing +* You clicked [**Import sessions only**](#import-your-data-on-the-new-device) or imported from a folder that you added. The wizard doesn't show the **Duplicates** step after these imports. ## Continue an imported conversation @@ -235,6 +245,8 @@ For an export, both devices need Claude Desktop 4.23118.0 or later, the same ope ### What a Claude Desktop export moves +An export holds up to 20 GB of data and 5,000,000 files. Past either limit, it leaves out all of a project's files, all of a session's attached files, or all of a session's output files, starting with whichever is largest in total. Versions before 6.6395.0 leave out any of the three that totals more than 100 MB. Update the old device before you export. + **Moves:** * Chats and Cowork tasks @@ -245,7 +257,7 @@ For an export, both devices need Claude Desktop 4.23118.0 or later, the same ope **Moves, but needs a step from you:** * Projects. Accept each project's instructions on the project's page. -* The files of each project whose folder is in the default location, `~/Claude/Projects`, if that folder holds no more than 10,000 files and folders. To use them in Chat, [add the folder to the project again](#make-an-imported-project-folder-readable-in-chat). Hidden files and symbolic links don't move, and some files arrive under another name, such as `CLAUDE.md.txt`. +* Each project's files, if the project's folder is directly inside the **Projects** folder of your [Cowork files folder](https://claude.com/docs/third-party/claude-desktop/data-storage.md#data-shared-with-standard-claude-desktop) and holds no more than 10,000 files and folders. By default, the **Projects** folder is `~/Claude/Projects`. To use the files in Chat, [add the project's folder again](#make-an-imported-project-folder-readable-in-chat). Hidden files and symbolic links don't move, and some files arrive under another name, such as `CLAUDE.md.txt`. * Code sessions and Code scheduled tasks. [Copy and trust their folders](#import-your-data-on-the-new-device) before you import. * Skills you saved, plugins you uploaded, and scheduled tasks. [Turn on the ones you want](#turn-on-imported-plugins-skills-and-scheduled-tasks). * Local MCP servers that you added, if your organization allows them. [Enter the values of their environment variables again](#set-up-imported-local-mcp-servers). @@ -258,7 +270,9 @@ For an export, both devices need Claude Desktop 4.23118.0 or later, the same ope * Sign-ins, saved API keys, connectors, and tool permissions such as **Always allow** and **Blocked** * Desktop extensions, other plugins and marketplaces, plugin settings, other app preferences such as language, theme, and notifications, environment variables for Code sessions, and the values of environment variables for the local MCP servers that you added * Plugins that you uploaded in the **Code** tab on a version before 4.23118.0. Upload them again on the new device. +* Files that you attached to Code sessions. Attach them again on the new device. * On Windows, Code sessions and Code scheduled tasks whose folder is on a mapped network drive +* Code sessions on an [SSH host](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md) or in Windows Subsystem for Linux (WSL). The zip file can hold copies of their conversations. If the import brings a copy, that copy is a session on the new device and isn't connected to the host or to WSL. If your organization uses Amazon Bedrock, see [Resume a session that is saved on the host](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md#resume-a-session-that-is-saved-on-the-host) to continue an SSH session on the new device. * Claude Code sessions that you started in a terminal, and Claude Code's own settings and plugins ### Export your data from the old device @@ -281,7 +295,7 @@ If the export shows an error or leaves out something that you need, see [Problem ### Import your data on the new device -Set up Claude Desktop on the new device first. The import adds to the data there and replaces nothing. If you import the same file again, you don't get duplicates, unless the [automatic copy](#automatic-import-of-earlier-third-party-sessions) has since copied the imported data to a new configuration. If you export again, a session that changed on the old device since the last export arrives as a separate session. +Set up Claude Desktop on the new device first. The import adds to the data there and replaces nothing. If you import the same file again, you don't get duplicates, unless the first import [couldn't copy a session's attached files or output files](#problems-when-you-move-to-another-device) or the [automatic copy](#automatic-import-of-earlier-third-party-sessions) has since copied the imported data to a new configuration. If you export again, a session that changed on the old device since the last export arrives as a separate session. 1. If you use the **Code** tab, copy the folders of your Code sessions and Code scheduled tasks to the same paths on the new device, or to the same place under your new home folder if its path changed. Then open each folder in the **Code** tab and click **Trust workspace**. 2. Go to **Settings > Import & export**, click **Import…**, click **Choose file…**, and select the zip file. @@ -382,10 +396,45 @@ If a [move to another device](#move-your-data-to-another-device) goes wrong, fin * **Settings > Import & export has no Export… button.** Ask your administrator to [turn on export and import](https://claude.com/docs/third-party/claude-desktop/data-storage.md#turn-on-export-and-import). * **This export is over the import limit of 20 GB or 5,000,000 files.** If the dialog offers **Shorten date range**, click it, select a shorter range, and click **Export**. If it doesn't, delete sessions from the last 30 days that you no longer need and export again. To move all your sessions, ask your administrator to [copy your data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#copy-the-data-to-the-new-device). * **The export stopped before it finished, and no file was saved.** Click **Try again**. If it stops again, ask your administrator to [copy your data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#copy-the-data-to-the-new-device). -* **The export's last screen lists items that you need.** On Windows, close other programs and export again, because the export can leave out a file that another program has open. If the items are still listed, ask your administrator to [copy your data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#copy-the-data-to-the-new-device). +* **The export's last screen lists Code sessions resumed from an SSH host.** Each of these sessions continues a conversation that you selected with `/resume`. An export doesn't move these sessions, but their conversations are saved on the SSH host. To continue one of these sessions on the new device, see [Resume a session that is saved on the host](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md#resume-a-session-that-is-saved-on-the-host). Your other sessions on an SSH host [don't move](#what-a-claude-desktop-export-moves) either. +* **The export's last screen lists items that you need.** On Windows, close other programs and export again, because the export can leave out a file that another program has open. If the old device runs a version before 6.6395.0, update it and export again, because earlier versions have a [100 MB limit](#what-a-claude-desktop-export-moves) on some files. If the items are still listed, ask your administrator to [copy your data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#copy-the-data-to-the-new-device). +* **The export's last screen lists other items, and a project's folder has symbolic links.** An export doesn't move symbolic links. Copy the files that the links point to onto the new device yourself. * **Couldn’t read that file. Choose a different zip.** On Windows, if you chose the file from a network path such as `\\server\share`, copy the file to a local folder on the new device, or choose it from a mapped network drive such as `Z:\`. Otherwise, copy the file from the old device again, or export again. * **That export was made in another organization. Choose an export made in this organization.** Ask your administrator to check that both devices are in the same organization. -* **Only your sessions were imported.** Import the same file again, and click **Import as my own** when Claude Desktop asks. If it doesn't ask, update both devices to Claude Desktop 4.23118.0 or later and export again. -* **Sessions that you imported before are missing their attached files.** An export from a version before 4.23118.0 has no attached files, and a later import doesn't add files to a session that's already there. Under **Import history** in **Settings > Import & export**, remove the earlier import, then import the new file. This also deletes the projects that the earlier import made and anything that you added to those sessions since. A session that isn't in the new file doesn't come back. -* **A Code session is missing.** [Copy and trust its folder](#import-your-data-on-the-new-device), then import the same file again and click **Import as my own**. On the last screen, Claude Desktop 5.1231.0 and later list the folders that you still need to copy and trust, under **Folders with Code sessions not imported yet**. If the last screen lists the folder under **Folders with Code sessions that can’t be imported**, or on Windows the folder is on a mapped network drive, the session doesn't move. A Code session that you started without choosing a folder doesn't move either, and the last screen doesn't list a folder for that session. Ask your administrator to [copy your data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#copy-the-data-to-the-new-device). +* **Couldn’t unpack this export**, with the code `UNPACK_FOLDER_BLOCKED` under the message. Wait a moment, then choose the file again. If the message comes back, ask your administrator to [fix the `UNPACK_FOLDER_BLOCKED` error](https://claude.com/docs/third-party/claude-desktop/data-storage#fix-the-unpack_folder_blocked-error). +* **Only your sessions were imported**, or the import's last screen shows **Memory and project files weren’t imported**. If you imported a zip file, import the same file again. On the **Review** step, click **Import** even if it shows **Nothing new to import**. Then click **Import as my own** when Claude Desktop asks. If it doesn't ask, or you can't click **Continue** on the step before **Review**, update both devices to Claude Desktop 4.23118.0 or later and export again. If you imported a folder, this is expected. [A folder doesn't bring memory or project files](#step-2-local-cowork-and-code-sessions). +* **Chats or Cowork tasks are missing their attached files, and the export is from a version before 4.23118.0.** An export from a version before 4.23118.0 has no attached files, and a later import doesn't add files to a session that's already there. [Get the files with a new export](#get-files-that-an-earlier-export-left-out). +* **A chat or Cowork task is missing attached files or output files that total more than 100 MB, and the export is from a version before 6.6395.0.** An export from a version before 6.6395.0 leaves out a session's attached files if they total more than 100 MB. The same limit applies separately to the session's output files. A later import doesn't add files to a session that's already there. [Get the files with a new export](#get-files-that-an-earlier-export-left-out). +* **Chats or Cowork tasks are missing their attached files, and the new device had little free disk space.** Claude Desktop 5.11492.0 and later don't copy an attached file if free disk space would fall below 512 MB during the import. Until the import ends, the unzipped export also takes up space on the same disk. Free up disk space, then import the same file again and click **Import as my own**. The import adds a second copy of each of those sessions, with its attached files, and the first copy stays. Keep both imports under **Import history** in **Settings > Import & export**. **Remove** next to the first import deletes every session that it brought, not only the copies without files. **Remove** next to the newer import deletes the copies that have the files. +* **A project is missing files that total more than 100 MB, and the export is from a version before 6.6395.0.** An export from a version before 6.6395.0 leaves out a project's files if they total more than 100 MB. If you merged the project into another project, a later import doesn't bring its files. The project's folder is in `~/Claude/Projects` on the old device by default. Copy it to the new device yourself. Don't let it replace a folder with the same name. Then [add the copied folder](#if-a-project-already-exists) under **Context** in the project that you merged it into. If you didn't merge the project, update the old device and export again. If a chat or Cowork task is missing files too, [delete it before you import](#get-files-that-an-earlier-export-left-out). Then one import gets the files for both. On the new device, import the new file. On the **Review** step, click **Import** even if it shows **Nothing new to import**. Then click **Import as my own**. The import adds the missing files to the project's folder. You don't need to remove the earlier import. +* **On Windows, a project that was in a cloud drive on the old device is missing a file or folder, and the export is from a version before 6.28899.2.** This can happen if your Cowork files folder is in a cloud drive. To check, go to **Settings > Cowork** on the old device and read the path under **Cowork files**. The export can leave out an item that you moved into a new folder if the cloud drive hadn't synced that folder when you exported. The export's last screen doesn't list the item. If you merged the project into another project, a later import doesn't bring its files. Copy the item to a folder on the new device yourself. Then [add that folder](#if-a-project-already-exists) under **Context** in the project that you merged it into. If you didn't merge the project, update the old device and export again. On the new device, import the new file. On the **Review** step, click **Import** even if it shows **Nothing new to import**. Then click **Import as my own**. The import adds the missing files to the project's folder. +* **A Code session that was imported before the move is missing, and the export is from a version before 7.37095.0.** An export from a version before 7.37095.0 leaves out a Code session that the [import wizard](#open-the-import-wizard) or the [automatic copy](#automatic-import-of-earlier-third-party-sessions) added, unless you [sent a message in it](#continue-an-imported-conversation) afterward. The export's last screen doesn't list the session. Update the old device to 7.37095.0 or later and export again, with a date range that covers the session. Then [import the new file](#import-your-data-on-the-new-device). +* **A Code session is missing.** A session that ran on an SSH host or in WSL [doesn't move](#what-a-claude-desktop-export-moves). Otherwise, first [copy and trust its folder](#import-your-data-on-the-new-device), then import the same file again and click **Import as my own**. On the last screen, Claude Desktop 5.1231.0 and later list the folders that you still need to copy and trust, under **Folders with Code sessions not imported yet**. If the last screen lists the folder under **Folders with Code sessions that can’t be imported**, or on Windows the folder is on a mapped network drive, the session doesn't move. A Code session that you started without choosing a folder doesn't move either, and the last screen doesn't list a folder for that session. Ask your administrator to [copy your data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#copy-the-data-to-the-new-device). +* **Folders with Code sessions on an SSH host or in WSL that weren’t imported.** These sessions [don't move](#what-a-claude-desktop-export-moves). They stay on the old device, where you can still open them. An SSH session's conversation is also saved on the host. If your organization uses Amazon Bedrock, see [Resume a session that is saved on the host](https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions.md#resume-a-session-that-is-saved-on-the-host) to continue an SSH session on the new device. +* **A Code session is missing a file that you attached.** Files that you attached to Code sessions don't move. Attach them again on the new device. * **A Code scheduled task is missing.** On Windows, if its folder is on a mapped network drive, it doesn't move. Ask your administrator to [copy your data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#copy-the-data-to-the-new-device), or create the task again. Otherwise, [copy its folder and trust it](#import-your-data-on-the-new-device), then import the file again. If the task is still missing, create it again. + +### Get files that an earlier export left out + +Use these steps only if an earlier [Claude Desktop export](#move-your-data-to-another-device) left out the attached files or output files of chats or Cowork tasks. If the new device had little free disk space, [import the same file again](#problems-when-you-move-to-another-device) instead. To get a project's files, see [Problems when you move to another device](#problems-when-you-move-to-another-device). + +A later import doesn't add files to a session that's already there. To get the files, make a new export. Then delete the sessions that are missing files on the new device. When you import the new file, it brings them back with their files. If many sessions are missing files, read [Remove the whole earlier import instead](#remove-the-whole-earlier-import-instead) before you export. + +1. Update both devices to Claude Desktop 6.6395.0 or later. Then [export again](#export-your-data-from-the-old-device) on the old device. Select a date range that covers the sessions that are missing files. If the export's last screen lists items that you need, stop here and see [Problems when you move to another device](#problems-when-you-move-to-another-device). +2. On the new device, delete each chat or Cowork task that's missing files. This also deletes anything that you added to it since the import. +3. [Import the new file](#import-your-data-on-the-new-device) and click **Import as my own**. + +These steps don't delete your other sessions, your projects, or your scheduled tasks. + +### Remove the whole earlier import instead + +If many sessions are missing files, you can remove the whole earlier import. This replaces step 2 of [Get files that an earlier export left out](#get-files-that-an-earlier-export-left-out). + +**Remove** can't be undone. It deletes more than the sessions with missing files: + +* All the sessions that the earlier import brought, and anything that you added to those sessions since. +* The projects that the earlier import made. Their folders stay on the computer, and sessions that you started in these projects stay in the app, but no longer belong to a project. + +Scheduled tasks stay, but a Cowork scheduled task that belonged to one of those projects no longer has a project, even after the new import. Other imported data, such as memory that doesn't belong to a project, stays. Notes in those projects' memory that aren't in the new file stay on the computer, but the app doesn't show them. Ask your administrator to restore them. + +In step 1, select a date range that covers every session that you want to keep. A session that isn't in the new file doesn't come back. Instead of step 2, go to **Settings > Import & export** on the new device. Under **Import history**, click **Remove** next to the earlier import. Then do step 3. diff --git a/content/claude/third-party/claude-desktop/in-app-configuration.md b/content/claude/third-party/claude-desktop/in-app-configuration.md index d21fb3bc03..c7892e8079 100644 --- a/content/claude/third-party/claude-desktop/in-app-configuration.md +++ b/content/claude/third-party/claude-desktop/in-app-configuration.md @@ -6,7 +6,7 @@ > Build, test, and export a Claude Desktop on 3P configuration from inside the app, with validation and per-provider guidance -The in-app configuration window is the recommended way to configure Claude Desktop for third-party inference. It validates values as you enter them, shows exactly which fields your inference provider requires, tests the connection against your endpoint, and computes the network egress allowlist for your settings. +The in-app configuration window is the recommended way to configure Claude Desktop for third-party inference. It validates values as you enter them, shows exactly which fields your inference provider requires, and computes the network egress allowlist for your settings. The **Test connection** button sends a test request to your endpoint, except with the **Vertex AI** provider, where you [check the connection by sending a message](https://claude.com/docs/third-party/claude-desktop/vertex.md#check-the-connection-to-google-cloud). ## Open the configuration window diff --git a/content/claude/third-party/claude-desktop/mantle.md b/content/claude/third-party/claude-desktop/mantle.md index 9c8b5e8c7f..72a7b9cb86 100644 --- a/content/claude/third-party/claude-desktop/mantle.md +++ b/content/claude/third-party/claude-desktop/mantle.md @@ -35,8 +35,9 @@ Open the [in-app configuration window](https://claude.com/docs/third-party/claud | Field | Value | | - | - | -| AWS region | e.g. `us-east-1` | -| AWS bearer token | your Mantle bearer token | +| Credential kind | **Static API key**, or **Helper script** for a [credential helper](https://claude.com/docs/third-party/claude-desktop/configuration.md#inferencecredentialhelper) | +| AWS region | for example, `us-east-1` | +| AWS bearer token | when **Credential kind** is **Static API key**, enter your Mantle bearer token | | Bedrock base URL | *optional* | If you set **Bedrock base URL**, provide the full SDK base URL including the `/anthropic` path (for example `https://bedrock-mantle.us-east-1.api.aws/anthropic`); it replaces the default `bedrock-mantle..api.aws/anthropic` endpoint. diff --git a/content/claude/third-party/claude-desktop/ssh-remote-sessions.md b/content/claude/third-party/claude-desktop/ssh-remote-sessions.md index 2d2005690e..c10a0f4c55 100644 --- a/content/claude/third-party/claude-desktop/ssh-remote-sessions.md +++ b/content/claude/third-party/claude-desktop/ssh-remote-sessions.md @@ -118,7 +118,7 @@ Before you move a server, check the following: * **The last managed server**: if you remove your last server from `managedMcpServers`, Code sessions again load the MCP servers that users define in Claude Code's own configuration. * **Tool policy**: `toolPolicy` doesn't move with the server. To keep it, see [Plugin structure](https://claude.com/docs/third-party/claude-desktop/extensions.md#plugin-structure). * **Users**: with `installationPreference` set to `"required"`, users can't turn off the plugin in the app, but they can in their own Claude Code settings. -* **Secrets**: a secret in the plugin's `.mcp.json` file reaches every device that installs the plugin and every host where a user starts a remote session. So can one in its `hooks` directory (see [Plugin hooks on the remote host](#plugin-hooks-on-the-remote-host)). +* **Secrets**: a secret in the plugin's `.mcp.json` file reaches every device that installs the plugin and every host where a user starts a remote session. A secret in the plugin's `hooks` directory can reach the same devices and hosts (see [Plugin hooks on the remote host](#plugin-hooks-on-the-remote-host)). * **The host's policy**: a [`managed-mcp.json`](https://code.claude.com/docs/en/managed-mcp) file on the host, or `disableSideloadFlags`, `allowedMcpServers`, or `deniedMcpServers` in its Claude Code managed settings, or a setup in which your organization starts Claude Code on the host itself, can keep the server out. A copy of the server in Claude Code's own configuration on the host is no substitute. The engine never loads a server there that has a managed server's name, and the session shows no message about it. @@ -144,7 +144,7 @@ A saved session can be resumed on a Linux or macOS host where the device, the ho * **The device sends requests straight to Amazon Bedrock.** [`inferenceProvider`](https://claude.com/docs/third-party/claude-desktop/configuration#inferenceprovider) is `bedrock` or `mantle`, and [`inferenceBedrockBaseUrl`](https://claude.com/docs/third-party/claude-desktop/configuration#inferencebedrockbaseurl) is unset or names Amazon's own Bedrock endpoint. A VPC endpoint for `bedrock-runtime`, `bedrock-runtime-fips`, or `bedrock-mantle` counts. Before Claude Desktop 7.37095.0, a VPC endpoint counts only if it is for `bedrock-runtime`. Identity provider sign-in needs a proxy address in that key, so it doesn't qualify. With an address that doesn't count, such as a proxy or gateway, `/resume` is missing from the slash menu, and no message says why. The other conditions don't hide the command. * **The engine has a credential on the host.** The credential kind [works on a remote host](#inference-credentials-on-the-remote-host), or the host starts Claude Code through a launcher. The launcher then supplies the credential, and must be one that the host's managed settings name (see [Resume through a corporate launcher](#resume-through-a-corporate-launcher)). -* **The host's Claude Code managed settings hold the session to Amazon Bedrock.** A host without managed settings needs nothing. Where a host has them, they must hold an [`allowedProviders`](https://code.claude.com/docs/en/settings-reference#allowedproviders) list with only `bedrock` and `mantle`, or hold no such list and set `"parentSettingsBehavior": "merge"`. Otherwise the user sees `Sessions on this host can't be listed.` +* **The host's Claude Code managed settings hold the session to Amazon Bedrock.** A host without managed settings needs nothing. If a host has managed settings, they must contain an [`allowedProviders`](https://code.claude.com/docs/en/settings-reference#allowedproviders) list with only `bedrock` and `mantle`, or contain no such list and set `"parentSettingsBehavior": "merge"`. Otherwise the user sees `Sessions on this host can't be listed.` * **All of the session ran on Amazon Bedrock.** Claude Desktop leaves out a session that holds a reply from another provider, and one that was ever opened under a Claude sign-in. These keys refuse both the list and the selection: @@ -166,7 +166,7 @@ These keys refuse both the list and the selection: Resuming a session brings its conversation from the host to the user's device: -* **At the list**: Claude Desktop first runs `claude auth status` on the host, which opens no session. It then skips the sessions that it already has for this host, and checks up to 60 of the folder's other session files, from the newest, or fewer on a slow host. Of each one that passes its Amazon Bedrock check, it fetches the first and the last 64 KiB. Of the folder's other session files, up to its 200 newest (more where the folder's path on the host is over 200 characters long) and up to 20 for each of its worktrees, only the name, the project folder's name, the size, and the time reach the device. Before Claude Desktop 7.37095.0, it checks the folder's 30 newest, and the sessions that it already has count among them. +* **At the list**: Claude Desktop first runs `claude auth status` on the host, which opens no session. It then skips the sessions that it already has for this host, and checks up to 60 of the folder's other session files, from the newest, or fewer on a slow host. From each session file that passes its Amazon Bedrock check, Claude Desktop fetches the first and the last 64 KiB. For the folder's other session files, only the name, the project folder's name, the size, and the time reach the device. Those details reach the device for up to the folder's 200 newest session files (more where the folder's path on the host is over 200 characters long) and up to 20 for each of the folder's worktrees. Before Claude Desktop 7.37095.0, Claude Desktop checks the folder's 30 newest, and the sessions that it already has count among them. * **At the selection**: it copies the whole conversation to the user's device, before the user sends anything, with the conversation's subagent files and every `agent-*.jsonl` file in the same project folder, which it doesn't check. The copy goes to Claude Code's store on the device, as for every SSH session (see [Removing data](https://claude.com/docs/third-party/claude-desktop/data-storage.md#removing-data)). * **Afterward**: the copy follows the host's file. What someone later adds to that conversation in a terminal reaches the device too, unchecked. * **On the device**: other Claude Code sessions there can read the copy, in Claude Desktop or in a terminal, under whatever provider or sign-in they use. The conversation can leave Amazon Bedrock that way. @@ -236,12 +236,12 @@ Add each jump host, or bastion, that Claude Desktop checks to `sshHostAllowlist` > > The allowlist has one kind of entry, so users can also start a session on any host that you list, and that session receives your [inference credential](#inference-credentials-on-the-remote-host), where Claude Desktop passes one. List only jump hosts that you'd also let users run sessions on. -Claude Desktop checks jump hosts in the `ProxyJump` that the device's `~/.ssh/config` sets for the session's host, or in a `ProxyCommand` written as `ssh -W %h:%p `. If one that it checks isn't on the allowlist when the app connects or reconnects a session, the connection fails. When the user starts a session or sends a message, they see [Your organization doesn't allow this SSH connection](#your-organization-doesn%E2%80%99t-allow-this-ssh-connection), and the card's details give that jump host's `HostName`. +Claude Desktop checks jump hosts in the `ProxyJump` that the device's `~/.ssh/config` sets for the session's host, or in a `ProxyCommand` written as `ssh -W %h:%p `. If a jump host that Claude Desktop checks isn't on the allowlist when the app connects or reconnects a session, the connection fails. When the user starts a session or sends a message, they see [Your organization doesn't allow this SSH connection](#your-organization-doesn%E2%80%99t-allow-this-ssh-connection), and the card's details give that jump host's `HostName`. Find the names to add in a terminal on a user's device. Skip `proxyjump` lines only on devices where the built-in client makes every connection, for example with `sshTransport` set to `builtin`. The built-in client [refuses every `ProxyJump`](#ssh-configuration-on-the-device), listed or not. 1. Run `ssh -G` with a host that users connect to, for example `ssh -G build01`. Look for a `proxyjump` line, or a `proxycommand` line written as `ssh -W %h:%p `. The command still counts with any of `-l`, `-p`, `-J`, `-q`, `-v`, `-N`, `-T`, `-x`, or `-a`, and the hosts after `-J` are jump hosts too. If a `proxycommand` line runs a program other than `ssh`, add nothing for it. -2. Run `ssh -G` with each jump host on that line, without any `:port`, and note the `hostname` that it prints. If the output for the first jump host on that line has a line of either kind, repeat this step with it. Ignore such a line in a later jump host's output. +2. Run `ssh -G` with each jump host on that line, without any `:port`, and note the `hostname` that it prints. If the output for the first jump host on that line has a line of either kind, repeat this step with the jump hosts on the new line. Ignore a line of either kind in the output for a later jump host. 3. Add each hostname, or a wildcard that covers it, to the `sshHostAllowlist` that applies on the device. To tell which one applies, see [Interaction with Claude Code managed settings on the device](#interaction-with-claude-code-managed-settings-on-the-device). Then have users quit and reopen Claude Desktop, because when a [bootstrap server](https://claude.com/docs/third-party/claude-desktop/bootstrap.md#availability) or the [admin console](https://claude.com/docs/third-party/claude-desktop/admin-console.md#configuration-updates) delivers the list, an open app allows the hosts that you added only after the app restarts. ### Interaction with Claude Code managed settings on the device @@ -391,7 +391,7 @@ A profile or policy, even one that holds only this key, also changes how WSL ses > [!WARNING] > -> List only hosts you trust in `sshHostAllowlist`. Where Claude Desktop passes a credential, a remote session runs Claude Code on the SSH host with your organization's inference credential, for as long as that process runs, including while Claude Desktop is closed. The same user account on the host, or a root user, can get the credential, so prefer one that expires (single sign-on, or a credential helper that issues short-lived tokens) over a long-lived key. With [Amazon Bedrock and a named profile](#amazon-bedrock-with-a-named-profile), the engine uses AWS credentials that are kept on the host, also while Claude Desktop is closed, and the same accounts can get those. +> In `sshHostAllowlist`, list only hosts that you trust. Where Claude Desktop passes a credential, a remote session runs Claude Code on the SSH host with your organization's inference credential, for as long as that process runs, including while Claude Desktop is closed. The same user account on the host, or a root user, can get the credential, so prefer one that expires (single sign-on, or a credential helper that issues short-lived tokens) over a long-lived key. With [Amazon Bedrock and a named profile](#amazon-bedrock-with-a-named-profile), the engine uses AWS credentials that are kept on the host, also while Claude Desktop is closed, and the same accounts can get those. Unless the host's [launcher](https://claude.com/docs/third-party/claude-desktop/code.md#start-code-sessions-through-a-corporate-launcher) starts Claude Code or the deployment uses [Amazon Bedrock with a named profile](#amazon-bedrock-with-a-named-profile), Claude Desktop passes the session's credential to the remote engine. For model requests, the engine then doesn't use these on the host: an AWS profile, SSO cache, or instance or container role; an Azure CLI sign-in or managed identity; or Google application default credentials. Commands, hooks, and local MCP servers that run on the host run as the SSH user, and may be able to use them. Claude Desktop copies no AWS, Azure, or Google credential files to the host. Which credential kinds work on a remote host depends on the provider: @@ -418,7 +418,7 @@ Requires Claude Desktop 7.37095.0 or later, and a Linux or macOS host. Before Cl With a [named profile](https://claude.com/docs/third-party/claude-desktop/bedrock.md#named-profile), the device's AWS credentials stay on the device. Claude Desktop sends the host the profile's name and the folder that holds the AWS files, and nothing else from the profile. The engine signs in to AWS with the profile of that name on the host, in the AWS Region that your Claude Desktop configuration sets. Your `inferenceCustomHeaders` and your collector's endpoint and headers still go to the host. Session titles, Cowork, and the connection test still use the profile on the device. -This has no configuration key of its own. It applies to every Linux or macOS host that `sshHostAllowlist` allows, and sessions start where the host has the files as the steps here describe. A profile of that name that is already on a host is used as it is, so check existing hosts before you update Claude Desktop. Windows hosts aren't supported. You can keep new sessions from using the host's profile in three ways: +This behavior has no configuration key of its own. It applies to every Linux or macOS host that `sshHostAllowlist` allows, and sessions start if the host has the files set up as the steps in this section describe. A profile of that name that is already on a host is used as it is, so check existing hosts before you update Claude Desktop. Windows hosts aren't supported. You can keep new sessions from using the host's profile in three ways: * **On one host**: keep the host's name off `sshHostAllowlist` and outside its wildcards, which refuses new SSH sessions and connections under that name (see [Enable SSH remote sessions](#enable-ssh-remote-sessions)). * **On a host that names a launcher**: turn `claudeCodeProcessWrapperEnabled` on, and the launcher starts Claude Code there, as the last paragraph of this section describes. @@ -495,7 +495,7 @@ In a device's or a host's first Claude Code managed settings, also set `parentSe A plugin's hooks aren't guaranteed to run on a host: some sessions start without them, and by default a hook that can't start lets the action go ahead. Check these limits before you rely on hooks, or on your policy, in remote sessions: * **Policy that only devices have**: Claude Code on the host doesn't read the device's Claude Code managed settings. A [policy mod](https://code.claude.com/docs/en/plugins/mods/admin#enforce-a-policy-with-a-mod-of-your-own) that those settings install isn't copied, so copied hooks run without it. Install it through each host's managed settings too. -* **Policy on files and network**: `allowedWorkspaceFolders`, `blockReadsOutsideWorkingDirectories`, `coworkEgressAllowedHosts`, and permission rules don't bind a command that a hook runs. +* **Policy on files and network**: `allowedWorkspaceFolders`, `blockReadsOutsideWorkingDirectories`, `coworkEgressAllowedHosts`, and permission rules don't apply to a command that a hook runs. * **Marketplace lists on a host**: `strictKnownMarketplaces` and `blockedMarketplaces` in the host's managed settings don't stop a copied plugin's hooks. To stop them, set `disableSideloadFlags` there. * **A [launcher](https://claude.com/docs/third-party/claude-desktop/code.md#start-code-sessions-through-a-corporate-launcher) that the host's managed settings name**: hooks are copied to such a host too * **The host's environment**: hooks run with the host's environment, not the device's. A variable that only the device sets, and that Claude Desktop doesn't send, is empty on the host, so a hook that deletes or writes under it can hit other files. @@ -518,7 +518,7 @@ Where the rules apply, they cover the following: * **Claude's file tools**: they refuse to create or change a file under the path, even in bypass permissions mode. A writable entry listed inside a read-only one is read-only for them too. * **Shell commands that Claude runs with its Bash tool**: Claude Code's sandbox keeps them from writing under the path on a host where it runs, which on Linux needs Claude Code's [sandbox dependencies](https://code.claude.com/docs/en/sandboxing). The sandbox doesn't cover commands listed in Claude Code's `sandbox.excludedCommands`, or a path that contains one of `* ? [ ] ( ) { } | +` or a double quote. It may not stop commands in a folder that is listed through a symbolic link, so list each read-only folder by its real path, and keep it outside writable entries. On a host where the sandbox doesn't run, shell commands can still change the folder. For how the app reports that, see [Sandbox status on the remote host](#sandbox-status-on-the-remote-host). -The rules don't bind the SSH user, or other programs that run under that account. MCP servers on the host, hooks from Claude Code's configuration on the host, [mods](https://code.claude.com/docs/en/plugins/mods/overview) in plugins installed on the host, the [hooks of copied plugins](#plugin-hooks-on-the-remote-host), and the session's terminal (including commands that Claude runs there) can change the folder, and Claude Desktop and Claude Code can create git worktrees inside it. +The rules don't apply to the SSH user, or to other programs that run under that account. MCP servers on the host, hooks from Claude Code's configuration on the host, [mods](https://code.claude.com/docs/en/plugins/mods/overview) in plugins installed on the host, the [hooks of copied plugins](#plugin-hooks-on-the-remote-host), and the session's terminal (including commands that Claude runs there) can change the folder, and Claude Desktop and Claude Code can create git worktrees inside it. ### Sandbox status on the remote host @@ -592,13 +592,13 @@ Check your policy and your hosts for these cases: * **Your configuration asks for no sandbox**: it asks for none where `coworkEgressAllowedHosts` contains `*` and `allowedWorkspaceFolders` is unset. On a device whose only configuration is the local configuration file, [an unset `coworkEgressAllowedHosts` doesn't turn on the sandbox by itself](https://claude.com/docs/third-party/claude-desktop/web-tools#unset-allowlist-in-code-sessions) either. Both keys reach well beyond SSH, so read the entries for [`coworkEgressAllowedHosts`](https://claude.com/docs/third-party/claude-desktop/configuration#coworkegressallowedhosts) and [`allowedWorkspaceFolders`](https://claude.com/docs/third-party/claude-desktop/configuration#allowedworkspacefolders) before you change them. * **Claude Code managed settings on the host replace your policy**: they do so unless `parentSettingsBehavior` there is `"merge"`, and settings from a policy helper do so either way. `refuse` then applies only if settings on the host turn a sandbox on. Where none do, a Windows host starts sessions too. * **Server-managed or gateway settings replace your policy**: with the [Claude API](https://claude.com/docs/third-party/claude-desktop/claude-api.md) as the inference provider, Claude Code on the host fetches the [server-managed settings](https://claude.com/docs/third-party/claude-desktop/code.md#interaction-with-claude-code%E2%80%99s-own-managed-settings) of the organization that owns the credential. If that organization has any, they replace your policy on every host, even one with no managed settings of its own, unless `parentSettingsBehavior` in them is `"merge"`. While they apply, Claude Code by default ignores most keys in a file or profile on the host, `"merge"` among them. A [Claude apps gateway's `code` settings](https://claude.com/docs/third-party/claude-desktop/code#interaction-with-claude-code%E2%80%99s-own-managed-settings) rank the same way, but merge unless they set `"first-wins"`. -* **Managed settings loosen the sandbox**: even under `"merge"`, the values in the host's managed settings, the server-managed settings, or a gateway's `code` settings win over yours, for example `sandbox.enabled` or `sandbox.failIfUnavailable` set to `false`. +* **Managed settings loosen the sandbox**: even under `"merge"`, the values in the host's managed settings, the server-managed settings, or a gateway's `code` settings take priority over the values in your policy, for example `sandbox.enabled` or `sandbox.failIfUnavailable` set to `false`. * **A launcher on the host locates Claude Code itself**: with [`claudeCodeProcessWrapperEnabled`](https://claude.com/docs/third-party/claude-desktop/configuration#claudecodeprocesswrapperenabled) on, a session through such a launcher gets no sandbox settings from your policy, whatever `parentSettingsBehavior` says. A launcher that the host's managed settings name in `processWrapper` is different. `refuse` applies through it where those settings set `"merge"`, no server-managed or gateway settings apply, and the launcher passes its arguments on. * **The sandbox passes the check and fails later**: the session starts with no card, and each shell command that would run in the sandbox fails or is refused. Have the host's administrator repair the sandbox. -Where Claude Code's managed settings replace your policy, set `parentSettingsBehavior` to `"merge"` in them, as [Interaction with Claude Code's own managed settings](https://claude.com/docs/third-party/claude-desktop/code.md#interaction-with-claude-code%E2%80%99s-own-managed-settings) describes. `"merge"` counts for every application that starts Claude Code under those settings, Claude Desktop's local Code sessions included, and lets that application's allow rules and sandbox allowlists apply: see [Let an embedding host add policy](https://code.claude.com/docs/en/managed-settings#let-an-embedding-host-add-policy), which also says which source Claude Code reads the key from. If the same settings set `sandbox.failIfUnavailable` to `true`, the sessions for which your policy asks for a sandbox then [don't start on Windows](https://code.claude.com/docs/en/sandboxing#enforce-sandboxing-with-managed-settings), or on any machine where the sandbox can't start. +Where Claude Code's managed settings replace your policy, set `parentSettingsBehavior` to `"merge"` in them, as [Interaction with Claude Code's own managed settings](https://claude.com/docs/third-party/claude-desktop/code.md#interaction-with-claude-code%E2%80%99s-own-managed-settings) describes. `"merge"` applies to every application that starts Claude Code under those settings, Claude Desktop's local Code sessions included, and lets that application's allow rules and sandbox allowlists apply: see [Let an embedding host add policy](https://code.claude.com/docs/en/managed-settings#let-an-embedding-host-add-policy), which also says which source Claude Code reads the key from. If the same settings set `sandbox.failIfUnavailable` to `true`, the sessions for which your policy asks for a sandbox then [don't start on Windows](https://code.claude.com/docs/en/sandboxing#enforce-sandboxing-with-managed-settings), or on any machine where the sandbox can't start. -The rest is Claude Code's own policy, which binds every Claude Code that reads it, in a terminal too. To require a sandbox there, which is the only way behind a launcher that locates Claude Code, follow [Enforce sandboxing with managed settings](https://code.claude.com/docs/en/sandboxing#enforce-sandboxing-with-managed-settings) and [How Claude Code combines managed sources](https://code.claude.com/docs/en/managed-settings#how-claude-code-combines-managed-sources) in the Claude Code documentation. Settings that you create for this replace your policy too, unless they set `"merge"`. +The rest is Claude Code's own policy, which applies to every Claude Code that reads it, including Claude Code in a terminal. To require a sandbox in that policy, which is the only way for a session through a launcher that locates Claude Code, follow [Enforce sandboxing with managed settings](https://code.claude.com/docs/en/sandboxing#enforce-sandboxing-with-managed-settings) and [How Claude Code combines managed sources](https://code.claude.com/docs/en/managed-settings#how-claude-code-combines-managed-sources) in the Claude Code documentation. Settings that you create for this replace your policy too, unless they set `"merge"`. Where a sandbox starts that didn't run before, a `true` for [`sandbox.autoAllowBashIfSandboxed`](https://code.claude.com/docs/en/settings-reference#sandbox-autoallowbashifsandboxed) in a user's, a project's, or a local settings file on the host takes effect: sandboxed Bash commands then run without a prompt, even past an ask rule for all of Bash. @@ -964,7 +964,7 @@ The card's title is `Claude Code on couldn't sign in to AWS`. The host ha ### This session needs your organization's launcher -A launcher started this session, or the session that it was made from, and now the host names no launcher or `claudeCodeProcessWrapperEnabled` is off. The card shows only where a new session can use [the host's own AWS profile](#amazon-bedrock-with-a-named-profile). The user can select **New session**, and the new session signs in with the host's own AWS profile, if the host has one. To continue the old session, name the launcher on the host again and turn `claudeCodeProcessWrapperEnabled` on. +A launcher started this session, or the session that it was made from, and now the host names no launcher or `claudeCodeProcessWrapperEnabled` is off. Claude Desktop shows this card only if a new session can use [the host's own AWS profile](#amazon-bedrock-with-a-named-profile). The user can select **New session**, and the new session signs in with the host's own AWS profile, if the host has one. To continue the old session, name the launcher on the host again and turn `claudeCodeProcessWrapperEnabled` on. This card requires Claude Desktop 7.37095.0 or later. @@ -1097,7 +1097,7 @@ Find what the user sees, on the screen or under **View details** on an error car | `Your organization's settings don't allow resuming sessions from this host or folder.` | `sshHostAllowlist` refuses the host, `allowedWorkspaceFolders` refuses the folder, or the credential kind doesn't [work on a remote host](#inference-credentials-on-the-remote-host) | Change the key or the credential kind, or have the user pick a folder inside the list | | `Sessions on this host can't be listed.` | The host doesn't qualify. Check first whether its managed settings lack both `"merge"` and an `allowedProviders` list. Other causes include a Windows host, a launcher that locates Claude Code itself or sets another provider, and a wider `allowedProviders` list on the host | See [Where resuming a saved session is available](#where-resuming-a-saved-session-is-available). To tell the causes apart, see [Find why resume refuses a host](#find-why-resume-refuses-a-host) | | `Couldn't load sessions from the host.` | The connection to the host isn't up, or the host gave no usable answer. For example, a launcher was too slow to answer | Have the user select **Try again**. If the message returns and you have a launcher, see [Resume through a corporate launcher](#resume-through-a-corporate-launcher). To tell the causes apart, see [Find why resume refuses a host](#find-why-resume-refuses-a-host) | -| `Some sessions aren't listed.`, under the list or alone | The folder holds more session files than Claude Desktop goes through for one list, or some of them are too large (over 64 MiB) or too slow to check, or hold another provider's reply. The message stands alone where nothing is left to list | Have the user resume the session in a terminal on the host | +| `Some sessions aren't listed.`, under the list or alone | The folder holds more session files than Claude Desktop goes through for one list, or some of them are too large (over 64 MiB) or too slow to check, or hold another provider's reply. The message appears alone if nothing is left to list | Have the user resume the session in a terminal on the host | | `Couldn't resume that session.` | No reason is shown. For example, a key refuses the selection, the file is gone, or the host or the session no longer passes the checks | See [Where resuming a saved session is available](#where-resuming-a-saved-session-is-available) | | `The host says that another user owns or can change that session's file` | For example, `sudo claude` wrote the file as root, or its mode is `0664` | Check the owner and mode of the session's file, under `~/.claude/projects` on the host | | `Claude Code on has no working credentials` | At the first message, Claude Code on the host got no working credential for Amazon Bedrock. For example, a company sign-in behind the launcher's credential has lapsed | Have the user sign in again on the host, then select **Try again** | @@ -1112,7 +1112,7 @@ If the list is empty (`No Claude Code sessions found in this folder on the host. * **This Claude Desktop already has the session for this host**, in the sidebar or archived * **The folder has many newer session files**: Claude Desktop takes the folder's 200 newest session files, skips the sessions that it already has for this host, and goes through the rest from the newest. It stops once it has 30 sessions that began in a terminal, or at 60 files, or sooner on a slow host. The user then sees `Some sessions aren't listed.`, under the list or alone. Have the user resume such a session in a terminal on the host. Before Claude Desktop 7.37095.0, it goes through the 30 newest files, and the sessions that it already has count among them. -* **The session was saved for another folder**, a subfolder included: the list goes by the real path of the folder that the user picked, and takes in that folder's Claude Code worktrees +* **The session was saved for another folder**, a subfolder included: the list uses the real path of the folder that the user picked, and includes that folder's Claude Code worktrees * **A program started the session**: for example, `claude -p` #### Find why resume refuses a host diff --git a/content/claude/third-party/claude-desktop/vertex.md b/content/claude/third-party/claude-desktop/vertex.md index 31e8896fed..7687397082 100644 --- a/content/claude/third-party/claude-desktop/vertex.md +++ b/content/claude/third-party/claude-desktop/vertex.md @@ -136,18 +136,35 @@ With Google Cloud set up and devices prepared, open the [in-app configuration wi | Field | Service-account key | In-app Google sign-in | | - | - | - | +| Credential kind | **Cloud vendor profile** | **Interactive sign-in** | | GCP project ID | `your-gcp-project` | `your-gcp-project` | -| GCP region | e.g. `us-east5` | e.g. `us-east5` | -| GCP credentials file path | `/path/to/sa-key.json` | *leave empty* | -| Vertex OAuth client ID | *leave empty* | `1234567890-abc123.apps.googleusercontent.com` | -| Vertex OAuth client secret | *leave empty* | `GOCSPX-xxxxxxxxxxxxxxxxxxxx` | -| Vertex OAuth scopes | *leave empty* | *leave empty for the default* | +| GCP region | for example, `us-east5` | for example, `us-east5` | +| GCP credentials file path | `/path/to/sa-key.json` | *field hidden* | +| Vertex OAuth client ID | *field hidden* | `1234567890-abc123.apps.googleusercontent.com` | +| Vertex OAuth client secret | *field hidden* | `GOCSPX-xxxxxxxxxxxxxxxxxxxx` | +| Vertex OAuth scopes | *field hidden* | *leave empty for the default* | | Vertex AI base URL | *optional* | *optional* | +For the other authentication approaches, select a different **Credential kind**: + +* **[In-app Workforce Identity sign-in](#in-app-workforce-identity-sign-in)**: select **Workforce Identity** +* **[Credential helper](https://claude.com/docs/third-party/claude-desktop/configuration.md#inferencecredentialhelper)**: select **Helper script** + Under **Models**, add at least one **Model list** entry using the publisher model ID, for example `claude-sonnet-5`. Then click **Export** to produce a `.mobileconfig` (macOS) or `.reg` (Windows) file for your MDM. See [Deploy with MDM](https://claude.com/docs/third-party/claude-desktop/mdm.md) for the export and deployment workflow. +### Check the connection to Google Cloud + +With the **Vertex AI** provider selected in the [in-app configuration window](https://claude.com/docs/third-party/claude-desktop/in-app-configuration.md#open-the-configuration-window), the **Test connection** button doesn't send a test request to Google Cloud. If your credential helper fails, the result names the error. Otherwise, the result reads `Vertex auth cannot be probed from the main process.` + +To check the connection, send a message through it: + +1. In the in-app configuration window, click **Apply Changes**. +2. Click **Save & Restart**. If your changes are already saved, click **Relaunch now** instead. +3. If **Credential kind** is **Interactive sign-in** or **Workforce Identity**, click **Sign in with Google Cloud** after the app relaunches, and complete the sign-in. +4. Send a message. A reply from Claude confirms the connection. + ### Configuration keys Set `inferenceProvider` to `vertex`, supply a project and region, and provide exactly one credential source. diff --git a/content/en/about-claude/model-deprecations.md b/content/en/about-claude/model-deprecations.md index 93fc0e6837..ab73018e15 100644 --- a/content/en/about-claude/model-deprecations.md +++ b/content/en/about-claude/model-deprecations.md @@ -23,8 +23,6 @@ Anthropic uses the following terms to describe the model lifecycle: The dates on this page apply to Anthropic-operated platforms: the Claude API, [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws), [Claude Models on Google Cloud (Anthropic managed)](https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed), and [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry). Partner-operated platforms, Claude Models on Google Cloud (Google managed) and Amazon Bedrock, set their own retirement schedules, so a model’s lifecycle status and dates can differ. See the [Amazon Bedrock (`bedrock-mantle`)](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#supported-models), [Amazon Bedrock (`bedrock-runtime`)](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy#api-model-ids), and [Claude Models on Google Cloud (Google managed)](https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/google-managed#api-model-ids) model tables. -[Claude Code](https://code.claude.com/docs/en/overview) uses the Claude API, including when you sign in with a Claude plan, so this page’s dates apply. If Claude Code is set up for another platform or for a gateway, the dates are those of the platform that serves its requests. - ## Migrating to replacements Once a model is deprecated, migrate all usage to a suitable replacement before the retirement date. Once the model is retired, requests to it fail. @@ -33,8 +31,6 @@ To help measure the performance of replacement models on your tasks, consider th For specific instructions on migrating to the latest Claude models, see [Migration guides](https://platform.claude.com/docs/en/about-claude/models/migration-guide). -If you use Claude Code, update it first, because a newer model can need a newer version of Claude Code. Then, [check which model you’re using](https://code.claude.com/docs/en/model-config#checking-your-current-model), even if you set no model or use a [Claude Code alias](https://code.claude.com/docs/en/model-config#model-aliases) such as `sonnet`. If that model is deprecated or retired, set its [recommended replacement](https://platform.claude.com/docs/en/about-claude/model-deprecations#deprecation-history) as your model. Also, change the old model [everywhere you set a model](https://code.claude.com/docs/en/model-config#setting-your-model), including subagent definitions, and ask your administrator to change any model they set. - ## Notifications Anthropic notifies customers with active deployments for models with upcoming retirements, providing at least 60 days’ notice before model retirement for publicly released models. @@ -114,7 +110,7 @@ This retirement includes `claude-opus-4-5`, the same model’s ID without a date To migrate, see [Migrating from Claude Opus 4.5 or earlier](https://platform.claude.com/docs/en/models/opus-5-5/migration-guide#migrating-from-claude-opus-45) in the Claude Opus 5.5 migration guide. -If you use Claude Code or a platform other than the Claude API, see [Overview](https://platform.claude.com/docs/en/about-claude/model-deprecations#overview) for which dates apply. For what to change, see [Migrating to replacements](https://platform.claude.com/docs/en/about-claude/model-deprecations#migrating-to-replacements). +If you use a platform other than the Claude API, see [Overview](https://platform.claude.com/docs/en/about-claude/model-deprecations#overview) for which dates apply. For what to change, see [Migrating to replacements](https://platform.claude.com/docs/en/about-claude/model-deprecations#migrating-to-replacements). ### 2026-09-30: Claude Sonnet 4.5 model @@ -126,8 +122,6 @@ On September 30, 2026, Anthropic notified developers using Claude Sonnet 4.5 of This retirement includes `claude-sonnet-4-5`, the same model’s ID without a date. -If you use Claude Code, see [Overview](https://platform.claude.com/docs/en/about-claude/model-deprecations#overview) for which dates apply and [Migrating to replacements](https://platform.claude.com/docs/en/about-claude/model-deprecations#migrating-to-replacements) for what to change. Once this model is retired, Claude Code on the Claude API shows an error that begins [`There's an issue with the selected model`](https://code.claude.com/docs/en/errors#theres-an-issue-with-the-selected-model). If you set a [fallback model chain](https://code.claude.com/docs/en/model-config#fallback-model-chains), Claude Code switches to the next model in the chain instead. It tries Claude Sonnet 4.5 again on your next message. - ### 2026-06-05: Claude Opus 4.1 model diff --git a/content/en/agents-and-tools/agent-skills/quickstart.md b/content/en/agents-and-tools/agent-skills/quickstart.md index 938f45ab42..e17b85e0ef 100644 --- a/content/en/agents-and-tools/agent-skills/quickstart.md +++ b/content/en/agents-and-tools/agent-skills/quickstart.md @@ -37,7 +37,7 @@ You need a [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/o For Linux environments, download the release binary directly. ```bash - VERSION=2.13.0 + VERSION=2.14.0 OS=$(uname -s | tr '[:upper:]' '[:lower:]') case $(uname -m) in x86_64) ARCH=amd64 ;; @@ -106,7 +106,7 @@ To run the CLI examples, install the CLI: For Linux environments, download the release binary directly. ```bash - VERSION=2.13.0 + VERSION=2.14.0 OS=$(uname -s | tr '[:upper:]' '[:lower:]') case $(uname -m) in x86_64) ARCH=amd64 ;; diff --git a/content/en/agents-and-tools/mcp-connector.md b/content/en/agents-and-tools/mcp-connector.md index 02be8d2895..481b156502 100644 --- a/content/en/agents-and-tools/mcp-connector.md +++ b/content/en/agents-and-tools/mcp-connector.md @@ -1306,8 +1306,8 @@ Install both the Anthropic SDK and the MCP SDK: ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") - implementation("com.anthropic:anthropic-java-mcp:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") + implementation("com.anthropic:anthropic-java-mcp:3.14.0") ``` @@ -1316,12 +1316,12 @@ Install both the Anthropic SDK and the MCP SDK: com.anthropic anthropic-java - 3.13.0 + 3.14.0 com.anthropic anthropic-java-mcp - 3.13.0 + 3.14.0 ``` diff --git a/content/en/build-with-claude/claude-in-amazon-bedrock.md b/content/en/build-with-claude/claude-in-amazon-bedrock.md index 4b6abcf2bc..f240546c1a 100644 --- a/content/en/build-with-claude/claude-in-amazon-bedrock.md +++ b/content/en/build-with-claude/claude-in-amazon-bedrock.md @@ -133,8 +133,8 @@ The [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") - implementation("com.anthropic:anthropic-java-bedrock:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") + implementation("com.anthropic:anthropic-java-bedrock:3.14.0") ``` @@ -143,12 +143,12 @@ The [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview com.anthropic anthropic-java - 3.13.0 + 3.14.0 com.anthropic anthropic-java-bedrock - 3.13.0 + 3.14.0 ``` diff --git a/content/en/build-with-claude/claude-in-microsoft-foundry.md b/content/en/build-with-claude/claude-in-microsoft-foundry.md index 282c2ab10b..7c6576c0ac 100644 --- a/content/en/build-with-claude/claude-in-microsoft-foundry.md +++ b/content/en/build-with-claude/claude-in-microsoft-foundry.md @@ -76,8 +76,8 @@ Anthropic’s [client SDKs](https://platform.claude.com/docs/en/cli-sdks-librari ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") - implementation("com.anthropic:anthropic-java-foundry:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") + implementation("com.anthropic:anthropic-java-foundry:3.14.0") ``` @@ -86,12 +86,12 @@ Anthropic’s [client SDKs](https://platform.claude.com/docs/en/cli-sdks-librari com.anthropic anthropic-java - 3.13.0 + 3.14.0 com.anthropic anthropic-java-foundry - 3.13.0 + 3.14.0 ``` diff --git a/content/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed.md b/content/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed.md index 7eba7ab91b..9ec751e1d9 100644 --- a/content/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed.md +++ b/content/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed.md @@ -177,8 +177,8 @@ Install the package that provides the client: ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") - implementation("com.anthropic:anthropic-java-google-cloud:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") + implementation("com.anthropic:anthropic-java-google-cloud:3.14.0") ``` @@ -187,12 +187,12 @@ Install the package that provides the client: com.anthropic anthropic-java - 3.13.0 + 3.14.0 com.anthropic anthropic-java-google-cloud - 3.13.0 + 3.14.0 ``` @@ -699,7 +699,7 @@ The following aren’t supported on Claude Models on Google Cloud (Anthropic man * **MCP tunnels:** [MCP tunnels](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/overview) aren’t available on Claude Models on Google Cloud (Anthropic managed). * **[Memory stores in self-hosted sandboxes](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-memory):** On Claude Models on Google Cloud (Anthropic managed), memory stores aren’t supported in self-hosted sandboxes. To use them, run the session in a [cloud environment](https://platform.claude.com/docs/en/managed-agents/environments). * **Pre-built self-hosted sandbox workers:** The [self-hosted workers](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-workers) in the `ant` CLI and in the Python, TypeScript, and Go SDKs don’t support Claude Models on Google Cloud (Anthropic managed). Instead, implement your own worker that calls the [Environments Work endpoints](https://platform.claude.com/docs/en/api/beta/environments/work) directly. For the roles and permissions your worker needs, see [IAM permissions for environments](https://platform.claude.com/docs/en/api/claude-models-on-google-cloud-anthropic-managed-iam-permissions#environments). -* **Linked billing (beta):** [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/organization-billing-connections) isn’t available on Claude Models on Google Cloud (Anthropic managed). +* **Linked billing (beta):** [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing) isn’t available on Claude Models on Google Cloud (Anthropic managed). ### Context window diff --git a/content/en/build-with-claude/claude-models-on-google-cloud/google-managed.md b/content/en/build-with-claude/claude-models-on-google-cloud/google-managed.md index bd1f2ab051..51b002bc1c 100644 --- a/content/en/build-with-claude/claude-models-on-google-cloud/google-managed.md +++ b/content/en/build-with-claude/claude-models-on-google-cloud/google-managed.md @@ -49,8 +49,8 @@ The [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") - implementation("com.anthropic:anthropic-java-vertex:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") + implementation("com.anthropic:anthropic-java-vertex:3.14.0") ``` @@ -59,12 +59,12 @@ The [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview com.anthropic anthropic-java - 3.13.0 + 3.14.0 com.anthropic anthropic-java-vertex - 3.13.0 + 3.14.0 ``` diff --git a/content/en/build-with-claude/claude-platform-on-aws.md b/content/en/build-with-claude/claude-platform-on-aws.md index d8a367216a..2050177cdb 100644 --- a/content/en/build-with-claude/claude-platform-on-aws.md +++ b/content/en/build-with-claude/claude-platform-on-aws.md @@ -313,8 +313,8 @@ The [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") - implementation("com.anthropic:anthropic-java-aws:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") + implementation("com.anthropic:anthropic-java-aws:3.14.0") ``` @@ -323,12 +323,12 @@ The [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview com.anthropic anthropic-java - 3.13.0 + 3.14.0 com.anthropic anthropic-java-aws - 3.13.0 + 3.14.0 ``` @@ -613,7 +613,7 @@ The following capabilities are not currently available on Claude Platform on AWS * **Fast mode:** Not available on Claude Platform on AWS. * **OpenAI-compatible API endpoints:** Not available on Claude Platform on AWS. * **MCP tunnels:** Only MCP servers exposed over the public internet are supported. -* **Linked billing (beta):** [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/organization-billing-connections) is not available on Claude Platform on AWS. +* **Linked billing (beta):** [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing) is not available on Claude Platform on AWS. ## Data residency diff --git a/content/en/build-with-claude/overview.md b/content/en/build-with-claude/overview.md index f11d822e40..c0bb527b63 100644 --- a/content/en/build-with-claude/overview.md +++ b/content/en/build-with-claude/overview.md @@ -86,6 +86,7 @@ Features of the Claude Platform that work across its APIs. Each feature’s page | [Context editing](https://platform.claude.com/docs/en/build-with-claude/context-editing) | Clears selected content, such as old tool results or old thinking blocks, from the conversation history as it grows. | | [Enterprise Frontier Safeguards](https://platform.claude.com/docs/en/manage-claude/enterprise-frontier-safeguards/overview) | Zero Data Retention (ZDR) for eligible organizations that use Claude’s most capable models. Sealed Safety Data, the encrypted copies of your prompts and responses, is written to storage that you own. Anthropic Human Review is always off, so your own team reviews flagged cases that automated safety monitoring finds. | | [Forced tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use) | Makes Claude call a tool, or one specific tool, instead of answering directly. | +| [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing) | Lets your customers pay for the Claude usage in your product through their own Claude organization. | | [Memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool) | Lets Claude store and read information across conversations in a directory of memory files. | | ↳ [Memory tool helpers](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool#implement-the-memory-handler) | SDK helpers that handle the memory tool’s interface and tool-use loop, so your code supplies only the storage. | | [Message streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) | Receiving a Messages API response incrementally, as server-sent events, while it is generated. | diff --git a/content/en/cli-sdks-libraries/cli/quickstart.md b/content/en/cli-sdks-libraries/cli/quickstart.md index fa9c025289..b24c2912f4 100644 --- a/content/en/cli-sdks-libraries/cli/quickstart.md +++ b/content/en/cli-sdks-libraries/cli/quickstart.md @@ -32,7 +32,7 @@ Compared to `curl`, `ant` builds request bodies from typed flags or piped YAML i For Linux environments, download the release binary directly. ```bash - VERSION=2.13.0 + VERSION=2.14.0 OS=$(uname -s | tr '[:upper:]' '[:lower:]') case $(uname -m) in x86_64) ARCH=amd64 ;; diff --git a/content/en/cli-sdks-libraries/overview.md b/content/en/cli-sdks-libraries/overview.md index 4b10a3c8d4..1567b12eb6 100644 --- a/content/en/cli-sdks-libraries/overview.md +++ b/content/en/cli-sdks-libraries/overview.md @@ -60,14 +60,14 @@ Each major version of a client SDK sends one [API version](https://platform.clau | Tool | Latest version | Package | | ----- | ----- | ----- | -| ant CLI | `2.13.0` | [`github.com/anthropics/anthropic-cli`](https://github.com/anthropics/anthropic-cli/releases) | -| Python | `2.13.0` | [`anthropic` on PyPI](https://pypi.org/project/anthropic/) | -| TypeScript | `1.13.0` | [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) | -| C# | `13.13.0` | [`Anthropic`](https://www.nuget.org/packages/Anthropic) | -| Go | `2.14.0` | [`github.com/anthropics/anthropic-sdk-go/v2`](https://pkg.go.dev/github.com/anthropics/anthropic-sdk-go/v2) | -| Java | `3.13.0` | [`com.anthropic:anthropic-java`](https://central.sonatype.com/artifact/com.anthropic/anthropic-java) | -| PHP | `1.13.0` | [`anthropic-ai/sdk`](https://packagist.org/packages/anthropic-ai/sdk) | -| Ruby | `2.13.0` | [`anthropic` on RubyGems](https://rubygems.org/gems/anthropic) | +| ant CLI | `2.14.0` | [`github.com/anthropics/anthropic-cli`](https://github.com/anthropics/anthropic-cli/releases) | +| Python | `2.14.0` | [`anthropic` on PyPI](https://pypi.org/project/anthropic/) | +| TypeScript | `1.14.0` | [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) | +| C# | `13.14.0` | [`Anthropic`](https://www.nuget.org/packages/Anthropic) | +| Go | `2.15.0` | [`github.com/anthropics/anthropic-sdk-go/v2`](https://pkg.go.dev/github.com/anthropics/anthropic-sdk-go/v2) | +| Java | `3.14.0` | [`com.anthropic:anthropic-java`](https://central.sonatype.com/artifact/com.anthropic/anthropic-java) | +| PHP | `1.14.0` | [`anthropic-ai/sdk`](https://packagist.org/packages/anthropic-ai/sdk) | +| Ruby | `2.14.0` | [`anthropic` on RubyGems](https://rubygems.org/gems/anthropic) | The same versions are available as JSON at `https://platform.claude.com/docs/sdk-versions.json`. diff --git a/content/en/cli-sdks-libraries/sdks/java.md b/content/en/cli-sdks-libraries/sdks/java.md index 8868b59421..994a08e83f 100644 --- a/content/en/cli-sdks-libraries/sdks/java.md +++ b/content/en/cli-sdks-libraries/sdks/java.md @@ -15,7 +15,7 @@ The Anthropic Java SDK provides convenient access to the Claude API from applica ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") ``` @@ -24,7 +24,7 @@ The Anthropic Java SDK provides convenient access to the Claude API from applica com.anthropic anthropic-java - 3.13.0 + 3.14.0 ``` @@ -37,8 +37,8 @@ Cloud platform integrations and the client-side MCP helpers ship as separate add ```kotlin - implementation("com.anthropic:anthropic-java:3.13.0") - implementation("com.anthropic:anthropic-java-mcp:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") + implementation("com.anthropic:anthropic-java-mcp:3.14.0") ``` @@ -47,12 +47,12 @@ Cloud platform integrations and the client-side MCP helpers ship as separate add com.anthropic anthropic-java - 3.13.0 + 3.14.0 com.anthropic anthropic-java-mcp - 3.13.0 + 3.14.0 ``` diff --git a/content/en/docs/claude-code/agent-sdk/configuration.md b/content/en/docs/claude-code/agent-sdk/configuration.md index 28fc5e0822..271bac3eca 100644 --- a/content/en/docs/claude-code/agent-sdk/configuration.md +++ b/content/en/docs/claude-code/agent-sdk/configuration.md @@ -143,7 +143,7 @@ To let tools reach files outside the working directory, add paths with `addition Cap turns and spend with `maxTurns` / `max_turns` and `maxBudgetUsd` / `max_budget_usd`. Both caps are off when unset. When a session hits a cap, the run ends with a result message. The result's subtype is `error_max_turns` for the turn cap and `error_max_budget_usd` for the spend cap. Single-shot and streaming input handle a cap result differently: * **Single-shot `query()`**: the SDK yields the cap result and then raises, so wrap the loop in a try block to continue past the error -* **Streaming input**: the session stays alive past a cap result, and the max-turns count starts over for each queued message. The budget total accumulates across messages, and once spend reaches the cap, later messages in the same conversation end with the same budget result. A [`/clear`](https://code.claude.com/docs/en/agent-sdk/cost-tracking) starts the budget over. +* **Streaming input**: the session stays alive past a cap result, and the max-turns count starts over. The budget total accumulates across messages, and once spend reaches the cap, later messages in the same conversation end with the same budget result. A [`/clear`](https://code.claude.com/docs/en/agent-sdk/cost-tracking) starts the budget over. * **Streaming input in TypeScript**: the loop throws when the last response ends in an error result, such as `error_max_turns`. Wrap the loop in a try block to continue past it. The two caps treat `0` differently: diff --git a/content/en/docs/claude-code/agent-sdk/observability.md b/content/en/docs/claude-code/agent-sdk/observability.md index edba002b0a..7e136f3530 100644 --- a/content/en/docs/claude-code/agent-sdk/observability.md +++ b/content/en/docs/claude-code/agent-sdk/observability.md @@ -241,7 +241,7 @@ Telemetry is structural by default. Durations, model names, and tool names are r | `OTEL_LOG_USER_PROMPTS=1` | Prompt text on `claude_code.user_prompt` events and on the `claude_code.interaction` span | | `OTEL_LOG_TOOL_DETAILS=1` | Tool input arguments such as file paths, shell commands, and search patterns on `claude_code.tool_result` events, and real agent, skill, plugin, and MCP server names on the [cost and token metrics](https://code.claude.com/docs/en/monitoring-usage.md#cost-counter). The built-in rule the auto mode classifier named when it blocked a call, as [`classifier_category`](https://code.claude.com/docs/en/monitoring-usage#tool-decision-event) on `claude_code.tool_decision` events | | `OTEL_LOG_TOOL_CONTENT=1` | A [`tool.output` span event](https://code.claude.com/docs/en/monitoring-usage#tool-output-span-event) on `claude_code.tool` with file contents, Bash output, and what MCP tools, WebFetch, and WebSearch return, truncated at 60 KB by default, configurable via `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, which requires Claude Code v2.1.214 or later. Results from MCP tools, WebFetch, and WebSearch require Claude Code v2.1.283 or later. Requires [tracing](#read-agent-traces) to be enabled. Span attributes carry tool content under [their own gates](https://code.claude.com/docs/en/monitoring-usage.md#new-context-gates) | -| `OTEL_LOG_RAW_API_BODIES` | Full Anthropic Messages API request and response JSON as `claude_code.api_request_body` and `claude_code.api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB by default, or `file:` for untruncated bodies on disk with a `body_ref` path in the event. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the inline truncation limit, and requires Claude Code v2.1.214 or later. Bodies include the entire conversation history and have extended-thinking content redacted. Enabling this implies consent to everything the three variables above would reveal | +| `OTEL_LOG_RAW_API_BODIES` | Full Anthropic Messages API request and response JSON as `claude_code.api_request_body` and `claude_code.api_response_body` log events. Set to `1` for inline bodies truncated at [60 KB by default](https://code.claude.com/docs/en/monitoring-usage.md#common-configuration-variables), or `file:` for untruncated bodies on disk with a `body_ref` path in the event. Bodies can include the entire conversation history, with extended-thinking content redacted. Enabling this implies consent to everything the three variables above would reveal | Leave these unset unless your observability pipeline is approved to store the data your agent handles. See [Security and privacy](https://code.claude.com/docs/en/monitoring-usage.md#security-and-privacy) in the Monitoring reference for the full list of attributes and redaction behavior. diff --git a/content/en/docs/claude-code/agent-sdk/python.md b/content/en/docs/claude-code/agent-sdk/python.md index 1e827370e9..d0ed1c00d7 100644 --- a/content/en/docs/claude-code/agent-sdk/python.md +++ b/content/en/docs/claude-code/agent-sdk/python.md @@ -2809,6 +2809,7 @@ The `ws` source requires Claude Code v2.1.195 or later. When Monitor runs a comm "taskId": str, # ID of the background monitor task "timeoutMs": int, # The watch's effective deadline in milliseconds "persistent": bool | None, # False: every watch has a deadline + "keptInSandboxByCheck": bool | None, } ``` diff --git a/content/en/docs/claude-code/agent-sdk/typescript.md b/content/en/docs/claude-code/agent-sdk/typescript.md index a0003470f5..06500b9cb8 100644 --- a/content/en/docs/claude-code/agent-sdk/typescript.md +++ b/content/en/docs/claude-code/agent-sdk/typescript.md @@ -2088,7 +2088,8 @@ type SDKStartupFailureReason = | "org_config_required_unavailable" | "org_config_refused" | "sandbox_required_unavailable" - | "config_file_invalid"; + | "config_file_invalid" + | "sideload_flags_disabled"; ``` Each value names one refusal: @@ -2116,6 +2117,7 @@ Each value names one refusal: | `org_config_refused` | Anthropic refused to provide the organization's policies and managed settings for this sign-in, for example because the sign-in expired or was revoked, or the organization doesn't allow Claude Code for this account. Requires Agent SDK v0.3.293 or later | | `sandbox_required_unavailable` | [`failIfUnavailable`](#sandboxsettings) is on and the sandbox can't start. The text in `errors` ends with `Set sandbox.failIfUnavailable=false to allow unsandboxed execution.` Requires Agent SDK v0.3.314 or later | | `config_file_invalid` | `~/.claude.json` isn't valid JSON. Claude Code leaves the file unchanged, so a retry fails the same way until someone repairs it. `errors` names the file and says how to restore or repair it. See [Configuration error in \~/.claude.json](https://code.claude.com/docs/en/errors.md#configuration-error-in-claude-json). Requires TypeScript Agent SDK v0.3.318 or later and Claude Code v2.1.318 or later | +| `sideload_flags_disabled` | A flag or launch option violates managed [`disableSideloadFlags`](https://code.claude.com/docs/en/settings-reference#disablesideloadflags). Requires TypeScript Agent SDK v0.3.331 or later and Claude Code v2.1.331 or later | ### `SDKSystemMessage` diff --git a/content/en/docs/claude-code/agent-view.md b/content/en/docs/claude-code/agent-view.md index 4f39871f4d..0be9b16772 100644 --- a/content/en/docs/claude-code/agent-view.md +++ b/content/en/docs/claude-code/agent-view.md @@ -239,7 +239,7 @@ Use `↑` and `↓` to peek at adjacent sessions without closing the panel, or ` Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session. When you attach, Claude posts a short recap of what happened while you were away. -While attached, the session behaves like any other Claude Code session: [commands](https://code.claude.com/docs/en/commands.md), keyboard shortcuts, and features all work, with the exceptions below. +While you're attached, [commands](https://code.claude.com/docs/en/commands.md), keyboard shortcuts, and features all work, with the exceptions below. A [`/ship` or `/steward` watch](https://code.claude.com/docs/en/ship-command-troubleshooting#a-session-setting-blocks-a-watch) doesn't start in a background session. While you're attached, `/install-github-app` and the [`/mcp`](https://code.claude.com/docs/en/mcp) settings list work normally, since a human at the terminal can complete their dialogs. When nobody is attached, these commands can't open their dialogs, so the session appears under `Needs input` in agent view with a row such as `open this session to manage MCP servers`, and the transcript reply says the same. Attach and run the command again to continue; the needs-input row clears when you attach. `/mcp reconnect `, `/mcp enable`, and `/mcp disable` work without attaching either way. @@ -445,6 +445,10 @@ Two commands move work from the session you're in to the background: `/backgroun Run `/background` or its alias `/bg` to move the current conversation into a background session. Pass a prompt such as `/bg run the test suite and fix any failures` to give one more instruction first. If Claude is responding when you run `/bg`, the response continues in the background session. +> [!NOTE] +> +> While a [`/ship` or `/steward` watch](https://code.claude.com/docs/en/ship-command) is on, `/bg` leaves the session in the foreground and prints the reason. See [Messages during a watch](https://code.claude.com/docs/en/ship-command-troubleshooting.md#messages-during-a-watch). + If you exit a session while some kinds of background work are running, such as subagents or workflows, a `Background work is running` dialog warns that the work stops. Choose `Move to background and exit` to background the session the same way `/background` does and return to your shell. The option isn't shown when agent view is [turned off](#turn-off-agent-view). If a background session on the list already has the conversation's name, Claude Code numbers the new row's name, such as `my-session (2)`, and leaves the existing row's name alone. To rename the new row, select it in agent view and press `Ctrl+R`. @@ -1052,6 +1056,8 @@ Agent view has evolved quickly during research preview. If you are on an older C | Version | Change | | - | - | +| v2.1.331 | A [`/ship` or `/steward` watch](https://code.claude.com/docs/en/ship-command-troubleshooting#a-session-setting-blocks-a-watch) doesn't start in a background session. Before this release, one can start there. | +| v2.1.331 | [`/background`](#send-the-session-to-the-background) doesn't move a session to the background while a `/ship` or `/steward` watch is on. Before this release, the session moves and the watch ends. | | v2.1.323 | In agent view's input, [`Ctrl+Y`](#keyboard-shortcuts) restores cleared text. | | v2.1.299 | [`/effort` and `/fast` in the dispatch input](#set-the-model-effort-and-fast-mode) set the effort level and fast mode for the sessions you dispatch next. `/model`, `/effort`, or `/fast` typed with no value opens a picker. | | v2.1.299 | Claude Code [reads `--bg` and `--background` as the flag](#from-your-shell) only before any bare `--` separator and outside another flag's value, and refuses an ambiguous position instead of guessing. Before this release, a prompt or reply of `--bg` or `--background` to a background session could be taken for the flag. That could start new background sessions over and over instead of delivering the text. | diff --git a/content/en/docs/claude-code/amazon-bedrock.md b/content/en/docs/claude-code/amazon-bedrock.md index 2896329bf6..59c500b5bb 100644 --- a/content/en/docs/claude-code/amazon-bedrock.md +++ b/content/en/docs/claude-code/amazon-bedrock.md @@ -11,6 +11,15 @@ View plans Contact sales +This page covers setting up Amazon Bedrock for the Claude Code CLI and IDE extensions. + +> [!NOTE] +> +> To use Amazon Bedrock in the **Code** tab of the Claude Desktop app, you or your administrator configures the app: +> +> * **Your organization installed the app**: ask your administrator to [configure it for Amazon Bedrock](https://claude.com/docs/third-party/claude-desktop/bedrock) +> * **You install the app yourself**: follow the [single-machine setup steps](https://claude.com/docs/third-party/claude-desktop/installation#single-machine-setup) and enter the [connection and model values for Amazon Bedrock](https://claude.com/docs/third-party/claude-desktop/bedrock#configure-the-app) + ## Prerequisites Before configuring Claude Code with Amazon Bedrock, ensure you have: diff --git a/content/en/docs/claude-code/approvals-pull-requests.md b/content/en/docs/claude-code/approvals-pull-requests.md index 0b208f6ecb..448429bc78 100644 --- a/content/en/docs/claude-code/approvals-pull-requests.md +++ b/content/en/docs/claude-code/approvals-pull-requests.md @@ -26,7 +26,7 @@ To get to a passing check: The **Claude Approvals** check gives your pull request's approval status in its title, the text beside its name in the list of checks. Find your check's title in these tables to see what it means and what to do next. -For a title that isn't here, open the **Claude Approvals** check's summary, which gives the cause and the next step. To find who maintains the policy file, `.claude/approvals.yml`, see who last changed it on the default branch. +For any other title, open the **Claude Approvals** check's summary, which gives the cause and the next step. To find who maintains the policy file, `.claude/approvals.yml`, see who last changed it on the default branch. ### Approvals waits for people @@ -40,20 +40,20 @@ With these titles, Approvals is waiting for a person. Outside observe mode, GitH ### Approvals waits for Code Review or a classifier -With these titles, Approvals is waiting for an answer from [Code Review](https://code.claude.com/docs/en/code-review-pull-requests.md) or a [classifier](https://code.claude.com/docs/en/approvals-classifiers.md), or didn't get one: +With these titles, Approvals needs an answer from [Code Review](https://code.claude.com/docs/en/code-review-pull-requests.md) or a [classifier](https://code.claude.com/docs/en/approvals-classifiers.md): | Title | What to do | | :- | :- | -| **Waiting for Code Review**, **Waiting for repo/change\_risk**, **Waiting for classifiers** | Nothing yet | -| **A classifier had no result**, **A classifier has not run**, or a name in place of "A classifier", as in **repo/change\_risk has not run** | [Rerun the Claude Approvals check](#comment-commands-for-approvals). See [when a run gives no answer](https://code.claude.com/docs/en/approvals-classifiers.md#what-a-rule-sees-when-a-classifier-run-gives-no-answer) | +| **Waiting for Code Review**, **Waiting for repo/change\_risk**, **Waiting for classifiers** | Wait for the result | +| **A classifier had no result**, **A classifier has not run**, or a name in place of "A classifier", as in **repo/change\_risk has not run** | [Rerun the Claude Approvals check](#comment-commands-for-approvals). See [what a rule sees without an answer](https://code.claude.com/docs/en/approvals-classifiers.md#what-a-rule-sees-when-a-classifier-run-gives-no-answer) | ### A rule or a policy file keeps Approvals from passing -With these titles, a rule holds the pull request, no rule applies to a changed file, or a policy file can't be used: +With these titles, a rule holds the pull request or the policy needs a fix: | Title | What to do | | :- | :- | -| **Held by Code Review's findings** | Fix the findings that Code Review posted on the pull request, then push. If the policy's [`findings`](https://code.claude.com/docs/en/approvals-policy#findings) list names you, you can resolve the findings' threads. If the **Claude Approvals** check doesn't pass after you resolve them, push a fix | +| **Held by Code Review's findings** | Fix the findings that Code Review posted on the pull request, then push. If the policy's [`findings`](https://code.claude.com/docs/en/approvals-policy#findings) list names you, you can resolve the findings' threads. If the **Claude Approvals** check is still held after you resolve them, push a fix | | **Held by** and a rule's purpose in quotes, **Held by a policy rule** | Ask whoever maintains the policy file what the rule in the check's summary needs, then push a fix | | **No rule applies to** and a file's name in quotes, **No rule applies to a changed file** | Ask whoever maintains the policy file for a rule with no `if` that covers the file. Rerun the check once that rule merges | | **This change breaks a policy file**, **Default branch policy file cannot be used** | [Fix the policy file](https://code.claude.com/docs/en/approvals-troubleshooting.md#fix-a-policy-file-that-approvals-refuses) | @@ -67,10 +67,10 @@ With these titles, Approvals passed or didn't evaluate the pull request: | Title | What to do | | :- | :- | | **Passed; no approval from Claude** | If GitHub requires an approval, ask a person | -| **Nothing ran, not blocking: no file is covered** | Nothing. If someone should review the files that the pull request changes, ask whoever maintains the [policy file](https://code.claude.com/docs/en/approvals-policy.md) to cover them | +| **Nothing ran, not blocking: no file is covered** | If someone should review the files that the pull request changes, ask whoever maintains the [policy file](https://code.claude.com/docs/en/approvals-policy.md) to cover them | | **Observe mode ended: not evaluated yet** | Push a commit or [rerun the Claude Approvals check](#comment-commands-for-approvals). If it passes, a pull request with auto-merge on or in a merge queue can merge at once | -Under **Passed; no approval from Claude**, Claude posts no approval in cases such as these: +If you see **Passed; no approval from Claude**, check for causes such as these: * A rule says `claude: comments` * A changed file has no rule, or is a [symlink, submodule pointer, or `.gitattributes` file](https://code.claude.com/docs/en/approvals-policy#protected-files) @@ -80,13 +80,13 @@ Under **Passed; no approval from Claude**, Claude posts no approval in cases suc In observe mode, the **Claude Approvals** check ends neutral, which GitHub counts as passing, with a title that starts **(observe mode)**. -The check isn't neutral in cases such as these: +The check can wait, fail, be withheld, or be missing in cases such as these: | Case | What the check does | | :- | :- | | The pull request changes a policy or classifier file | It can wait for one person, who can be the author. It fails if the change breaks one of those files | | The default branch's policy file can't be used | It fails until you [fix the policy file](https://code.claude.com/docs/en/approvals-troubleshooting.md#fix-a-policy-file-that-approvals-refuses) | -| The title says Withheld | Approvals holds back a passing check, for example because another open pull request has the same latest commit. The check's summary says what clears it | +| The title says Withheld | Approvals holds back a passing check, for example because another open pull request has the same latest commit. Read the check's summary for what clears it | | The pull request targets another branch than the default | No check appears, unless the pull request changes a policy or classifier file | ## Comment commands for Approvals @@ -105,22 +105,22 @@ Comment `@claude approve` on your own pull request when the check's summary says ## Pull requests from Claude, forks, and outside contributors -A pull request that `claude[bot]` opened needs a second GitHub App before Claude can approve it. A pull request from a fork, or from a person without write access, can need a maintainer. +Before Claude can approve a pull request that `claude[bot]` opened, you need a second GitHub App. A pull request from a fork, or from a person without write access, can need a maintainer. ### Pull requests that Claude opens -GitHub doesn't let the account that opened a pull request approve it. Without a second app, Claude gives no approval on a pull request that `claude[bot]` opened, and the **Claude Approvals** check can pass with the title **Passed; no approval from Claude**. +Until you add a second GitHub App, the **Claude Approvals** check on a pull request that `claude[bot]` opened can pass with the title **Passed; no approval from Claude**. To get Claude's approval on those pull requests, add a second app: 1. **Install it**: ask an owner of your GitHub organization to install the [Claude Approvals GitHub App](https://github.com/apps/claude-approvals/installations/new) on the repository. -2. **Link it**: [link the app to your Claude organization](https://claude.ai/settings/claude-approvals/github/finish). That takes someone who is an owner of the GitHub organization and an Owner or Primary Owner of the Claude organization. If nobody is both, contact [Anthropic support](https://support.claude.com). +2. **Link it**: ask someone who is an owner of the GitHub organization and an Owner or Primary Owner of the Claude organization to [link the app to your Claude organization](https://claude.ai/settings/claude-approvals/github/finish). If they can't link it, contact [Anthropic support](https://support.claude.com). Then [rerun the check](#comment-commands-for-approvals) on an open pull request that `claude[bot]` opened. Leave the required check's source as it is, because the [Claude GitHub App](https://github.com/apps/claude) still reports the check. ### Pull requests from forks and outside contributors -Approvals can't confirm that someone with write access pushed a fork's commits. On a fork's pull request, Approvals can wait for a maintainer, meaning someone with write access: +On a fork's pull request, Approvals can wait for a maintainer, meaning someone with write access: * **Until a maintainer vouches for a commit**: no classifier's answer counts, Code Review's included. Where a rule depends on one, the **Claude Approvals** check's title can read **No classifier result counts on this commit**. * **To vouch for a commit**: outside observe mode, if you have write access, read the change. Then comment `@claude approvals rerun` followed by the latest commit's full SHA, as the comment's only text. Classifiers can then run for that commit. With no SHA, the command can cover the commit that was latest when you commented. diff --git a/content/en/docs/claude-code/approvals-setup.md b/content/en/docs/claude-code/approvals-setup.md index 1023a49560..ef53106576 100644 --- a/content/en/docs/claude-code/approvals-setup.md +++ b/content/en/docs/claude-code/approvals-setup.md @@ -16,22 +16,26 @@ Setting up and enforcing Approvals takes each of these: * The [Claude GitHub App](https://github.com/apps/claude), installed on the repository and [linked to your Claude organization](https://code.claude.com/docs/en/admin-setup.md#connected-github-accounts) * Permission to merge into the default branch * Admin access to the repository on GitHub, to require the **Claude Approvals** check. A private repository also needs a [paid GitHub plan](https://docs.github.com/en/get-started/learning-about-github/githubs-plans) -* Two people with write access, before you enforce either policy on this page. With only one, the check can't pass on a change under `.claude/`, or where Claude's review fails or gives no result. Under the policy that [keeps two people on each change](#keep-two-people-on-each-change), it can't pass on any change +* Two people with write access, before you enforce either policy on this page. Both policies require two people on a change under `.claude/`, which includes the policy file ## Plan your first policy -A [policy file](https://code.claude.com/docs/en/approvals-policy.md) tells Approvals who has to approve a pull request. For your first one, decide whether Claude can approve, then copy the starter policy that matches: +In a [policy file](https://code.claude.com/docs/en/approvals-policy.md), you set who has to approve a pull request. For your first one, decide whether Claude can approve, then copy the starter policy that matches: -* **[Let Claude approve when Code Review passes](#let-claude-approve-when-code-review-passes)**: a pull request that passes Claude's review usually needs no approval from another person -* **[Keep two people on each change](#keep-two-people-on-each-change)**: a pull request usually needs one person besides the author, and Claude doesn't approve +* **[Let Claude approve when Code Review passes](#let-claude-approve-when-code-review-passes)**: a pull request that passes Claude's review usually needs only its author +* **[Keep two people on each change](#keep-two-people-on-each-change)**: a pull request usually needs one person besides the author, and Claude only comments -Both policies start in observe mode, where the **Claude Approvals** check shows what the policy would decide, Claude doesn't approve, and the check [normally counts as passing](https://code.claude.com/docs/en/approvals-pull-requests.md#approvals-in-observe-mode). +Both policies start in observe mode, where the **Claude Approvals** check shows what the policy would decide and [normally counts as passing](https://code.claude.com/docs/en/approvals-pull-requests.md#approvals-in-observe-mode). -Both also name `claude/code_review`. Keep it in your policy file. Once the file is on the default branch, in observe mode or enforced, automatic Code Reviews normally stop where no matching rule names it. +Both also name `claude/code_review`. Keep it in a rule that matches the files you want reviewed, so that [automatic Code Reviews continue](https://code.claude.com/docs/en/approvals.md#keep-automatic-code-reviews) in observe mode and once you enforce. + +> [!TIP] +> +> To have Claude write or change a policy file for you, type [`/claude-approvals`](https://code.claude.com/docs/en/commands) at the Claude Code prompt in your repository, followed by what you want. Requires Claude Code v2.1.331 or later and [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching). ### Let Claude approve when Code Review passes -Once this starter policy is enforced, a pull request that passes Claude's review usually needs no approval from another person, except for changes under `.claude/`. Other pull requests usually need one person [besides the author](https://code.claude.com/docs/en/approvals-policy.md#whether-a-pull-request’s-author-counts). +Once you enforce this starter policy, a pull request that passes Claude's review usually needs only its author, except for changes under `.claude/`. Other pull requests usually need one person [besides the author](https://code.claude.com/docs/en/approvals-policy.md#whether-a-pull-request’s-author-counts). In this policy, the first rule asks for two people on a change. Its `override` lowers that to one and lets Claude approve when `claude/code_review` reads `pass`. The second rule asks for two people on a change under `.claude/`: @@ -55,7 +59,7 @@ This policy can start a billed Code Review at each push, and observe mode is bil ### Keep two people on each change -This starter policy asks for two people on each change. Once the policy is enforced, a pull request usually needs one person besides the author, and Claude doesn't approve. +Use this starter policy to ask for two people on each change. Once you enforce it, a pull request usually needs one person besides the author, and Claude only comments. In this policy, both rules ask for two people. The first rule lists `claude/code_review` under [`advisory`](https://code.claude.com/docs/en/approvals-policy#advisory), so reviews follow your Code Review settings: @@ -100,13 +104,13 @@ Enforce the policy once the **Claude Approvals** check titles that you see in ob Before you [switch your policy from observe mode to enforcement](#switch-from-observe-mode-to-enforcement), decide which files need a person, which branches the check gates, and when to change GitHub's required approvals: -* **Files**: decide which ones need a person's approval whatever Claude finds, then copy [this rule](https://code.claude.com/docs/en/approvals-github-rules.md#ask-for-a-person-who-isn’t-an-author) and narrow its `paths` +* **Files**: decide which ones need a person's approval whatever Claude finds, then copy [this rule](https://code.claude.com/docs/en/approvals-github-rules.md#ask-for-a-person-who-isn’t-an-author) and narrow its `paths` list * **Branches**: an enforced policy also covers pull requests into branches other than the default branch, so list each branch whose merges the **Claude Approvals** check should gate. On those branches, a pull request with no covered file gets no check, so a required check waits * **GitHub's required approvals**: [change the number of approvals that GitHub requires](https://code.claude.com/docs/en/approvals-github-rules.md#required-reviews-and-codeowners) only after the last step of the switch ### Switch from observe mode to enforcement -A policy file's [`mode`](https://code.claude.com/docs/en/approvals-policy#top-level-keys) is one of these: +A policy file's [`mode`](https://code.claude.com/docs/en/approvals-policy#top-level-keys) key is one of these: * **`observe`**: the **Claude Approvals** check shows what the policy would decide, Claude doesn't approve, and the check [normally counts as passing](https://code.claude.com/docs/en/approvals-pull-requests.md#approvals-in-observe-mode) * **`enforce`**: the check can block a merge, and Claude can approve where the policy allows it. This is the default, so a policy file with no `mode` line is enforced @@ -133,7 +137,7 @@ Approvals later evaluates some of the pull requests that you didn't rerun, which ### Set the source that GitHub accepts for Claude Approvals -Set the required check's source to the Claude app. With **any source**, GitHub accepts a check named **Claude Approvals** from elsewhere. To set the source through GitHub's API, put the Claude app's ID, `1236702`, in `integration_id` in a ruleset or `app_id` in a branch protection rule. +Set the required check's source to the Claude app. If you allow **any source**, GitHub accepts a check named **Claude Approvals** from elsewhere. To set the source through GitHub's API, put the Claude app's ID, `1236702`, in `integration_id` in a ruleset or `app_id` in a branch protection rule. ## Control what Approvals spends @@ -143,7 +147,7 @@ Approvals bills your organization's usage credits for the model runs that a poli A policy with `claude/code_review` in an `if` condition can start a [billed Code Review](https://code.claude.com/docs/en/code-review-costs.md) when a pull request opens and at each push. To stop those reviews, move it from the conditions to `advisory`. When `claude/code_review` is only under `advisory`, with no [`level`](https://code.claude.com/docs/en/approvals-classifiers#read-a-classifier’s-answer-from-a-rule), reviews follow your Code Review settings. -A rule can also read other [classifiers](https://code.claude.com/docs/en/approvals-classifiers.md). For `claude/diff` and custom classifiers, each [run that calls a model](https://code.claude.com/docs/en/approvals-classifiers.md#what-a-classifier-run-costs) is billed. To limit each run of a custom classifier, set its [`budget`](https://code.claude.com/docs/en/approvals-classifiers#budget). +A rule can also read other [classifiers](https://code.claude.com/docs/en/approvals-classifiers.md). For `claude/diff` and custom classifiers, each [run that calls a model](https://code.claude.com/docs/en/approvals-classifiers.md#what-a-classifier-run-costs) is billed. To limit each run of a custom classifier, set its [`budget`](https://code.claude.com/docs/en/approvals-classifiers#budget) key. ### Limit what a policy costs @@ -168,7 +172,7 @@ You can turn off Approvals for one repository, for a GitHub organization, or for > [!WARNING] > -> Suspend or uninstall the Claude GitHub App, or unlink your GitHub organization, only after you turn off Approvals. If you do it first, new commits get no check, so a required check can block merges. GitHub can also continue to count Claude's approving reviews that are left on open pull requests. +> Suspend or uninstall the Claude GitHub App, or unlink your GitHub organization, only after you turn off Approvals. If you take any of those steps first, a required **Claude Approvals** check can block merges. GitHub can also continue to count Claude's approving reviews that are left on open pull requests. Follow this order: @@ -177,7 +181,7 @@ Follow this order: 3. **Turn Approvals off**: [choose how](#ways-to-turn-off-approvals), by the scope that you want. 4. **Dismiss Claude's reviews**: on open pull requests that Claude approved, dismiss that review in GitHub. -To stop the check from blocking without turning Approvals off, first stop requiring it on branches other than the default branch. Then put `mode: observe` in every policy file. The check then normally stops blocking, and classifiers still run and bill. Pull requests into those other branches get no check unless they change a policy or classifier file. +To keep Approvals on and stop the check from blocking, first stop requiring it on branches other than the default branch. Then put `mode: observe` in every policy file. The check then [normally stops blocking](https://code.claude.com/docs/en/approvals-pull-requests.md#approvals-in-observe-mode), and classifiers still run and bill. ### Ways to turn off Approvals @@ -189,7 +193,7 @@ To turn off Approvals, find the scope that you want in this table: | A GitHub organization, or a repository whose **Edit** dialog shows **Claude Approvals** | With an [Owner role](https://code.claude.com/docs/en/server-managed-settings.md#access-control), go to [**Organization settings > Claude Ship**](https://claude.ai/admin-settings/claude-ship), click **Edit** on its row, and turn off **Claude Approvals** | | The whole Claude organization | With an Owner role, go to [**Organization settings > Claude Ship**](https://claude.ai/admin-settings/claude-ship) and click **Block globally** in the **Approve** row. To turn it back on, click **Allow policy files** in the same row | -What you turn off for the whole Claude organization stays off when a policy file merges later. If you're turning off Code Review too, turn off Approvals first, because a policy can start billed reviews where Code Review is off. +After you turn off Approvals for the whole Claude organization, it stays off when a policy file merges later. If you're turning off Code Review too, turn off Approvals first, because a policy can start billed reviews where Code Review is off. ## Related resources diff --git a/content/en/docs/claude-code/checkpointing.md b/content/en/docs/claude-code/checkpointing.md index ed870d1689..69af244f60 100644 --- a/content/en/docs/claude-code/checkpointing.md +++ b/content/en/docs/claude-code/checkpointing.md @@ -17,7 +17,7 @@ As you work with Claude, checkpointing automatically captures the state of your Claude Code tracks all changes made by its file editing tools: * Every prompt you send that starts a turn creates a new checkpoint -* Claude Code keeps file snapshots for the 100 most recent checkpoints in a session. Discarding an older checkpoint deletes the snapshot files that no remaining checkpoint references, except each file's first snapshot, which the VS Code extension uses as the baseline for its session diffs. +* Claude Code keeps file snapshots for the 100 most recent checkpoints in a session. Discarding an older checkpoint deletes the snapshot files that no remaining checkpoint references, except each file's first snapshot. * Claude Code saves checkpoints with the conversation, so you can still run `/rewind` after you resume a session * Claude Code deletes a session's file snapshots in the [retention sweep](https://code.claude.com/docs/en/claude-directory.md#cleaned-up-automatically), by default about 30 days after the session last saved one. Rewinding to a checkpoint whose snapshots are gone can fail with [`No files were restored`](https://code.claude.com/docs/en/errors#no-files-were-restored). To keep snapshots longer, set [`cleanupPeriodDays`](https://code.claude.com/docs/en/settings-reference#cleanupperioddays). diff --git a/content/en/docs/claude-code/claude-projects.md b/content/en/docs/claude-code/claude-projects.md index 05a1e862b8..46cd97da56 100644 --- a/content/en/docs/claude-code/claude-projects.md +++ b/content/en/docs/claude-code/claude-projects.md @@ -270,7 +270,7 @@ Claude answers with an **Allow Claude to work in a folder on your computer** car The thread runs in [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode), so Claude runs commands and edits files in that folder without asking you each time. If auto mode is unavailable or turned off in that computer's Claude Code, the thread runs without it, and any permission prompt it raises waits for your answer in the thread, as [Unblock a thread waiting on approval](#unblock-a-thread-waiting-on-approval) describes. -To run the thread in another mode, start `claude remote-control` with [`--settings`](https://code.claude.com/docs/en/remote-control#start-a-remote-control-session). Then [`permissions.defaultMode`](https://code.claude.com/docs/en/permission-modes#start-in-a-different-mode), in that file or in that computer's settings, can pick another mode. +To run the thread in another mode, start `claude remote-control` with [`--settings`](https://code.claude.com/docs/en/remote-control#start-a-remote-control-session) and a file that sets [`disableAutoMode`](https://code.claude.com/docs/en/settings-reference#disableautomode) to `"disable"`. Then [`permissions.defaultMode`](https://code.claude.com/docs/en/permission-modes#start-in-a-different-mode), in that file or in that computer's settings, can pick another mode, such as `default`, `plan`, or `dontAsk`. While the thread runs, a laptop icon in its header shows whether your computer is connected. Click it to see which folder the thread is using or to turn the connection off. The thread pauses while that computer is asleep, and stops if the desktop app or `claude remote-control` quits. diff --git a/content/en/docs/claude-code/claude-security.md b/content/en/docs/claude-code/claude-security.md index e89d52f0bb..35b8a5a6b5 100644 --- a/content/en/docs/claude-code/claude-security.md +++ b/content/en/docs/claude-code/claude-security.md @@ -6,28 +6,38 @@ > Install the Claude Security plugin to scan your codebase for vulnerabilities in a Claude Code session and turn findings into patches you review and apply. -The Claude Security plugin runs a multi-agent vulnerability scan of your codebase inside a Claude Code session. [By default](#choose-a-scan-effort), when you scan a whole repository, Claude agents map your architecture, build a threat model, hunt for vulnerabilities, and independently review every finding before writing the report. +The Claude Security plugin runs a multi-agent vulnerability scan of your codebase inside a Claude Code session. [By default](#choose-a-scan-effort), when you scan a whole repository, Claude agents map your architecture, hunt for vulnerabilities, and independently review every finding before writing the report. -Use the plugin to scan a whole repository or [only a set of changes](#scan-only-your-changes), such as a branch's diff, a pull request's diff, or a single commit, then turn the findings you choose into patches that you review and apply yourself. +Use the plugin to scan a whole repository or [only a set of changes](#scan-only-your-changes), such as a branch's diff, a pull request's diff, or a single commit. Then turn the findings you choose into patches that you review and apply yourself. Scan only code that you own or have permission to test. -The plugin runs locally in your session, uses [whichever models you have access to in Claude Code](#models-and-providers), and each scan counts toward your [usage](https://code.claude.com/docs/en/costs.md). If you want a managed service that monitors your repositories, or want to run scans on [Claude Mythos](https://platform.claude.com/docs/en/about-claude/models/introducing-claude-fable-5-and-claude-mythos-5), see the [Claude Security](https://claude.com/product/claude-security) product, available on the Enterprise plan. +Run a scan in your session, your shell, or GitHub Actions: -The plugin is also distinct from the review tools already in Claude Code: the [security guidance plugin](https://code.claude.com/docs/en/security-guidance.md) reviews code as Claude writes it, [`/security-review`](https://code.claude.com/docs/en/commands#all-commands) runs a single pass over your branch, and [Code Review](https://code.claude.com/docs/en/code-review.md) reviews pull requests. For how the layers stack, see [How the plugin fits with other security tools](#how-the-plugin-fits-with-other-security-tools). +* **In your session**: [scan and fix your codebase](#scan-and-fix-your-codebase) with [whichever models you have access to in Claude Code](#models-and-providers) +* **From your shell**: use the [`claude-security` command](#scan-from-your-shell) +* **In GitHub Actions**: add the plugin's job to [scan pull requests](#scan-pull-requests-in-github-actions) + +A scan in your session or shell counts toward your [usage](https://code.claude.com/docs/en/costs.md), and a scan in GitHub Actions counts toward the account that owns the job's model credential. + +> [!NOTE] +> +> If you want a managed service that monitors your repositories, or want to run scans on [Claude Mythos](https://platform.claude.com/docs/en/about-claude/models/introducing-claude-fable-5-and-claude-mythos-5), see the [Claude Security](https://claude.com/product/claude-security) product, available on the Enterprise plan. + +The plugin is also distinct from review tools already in Claude Code: the [security guidance plugin](https://code.claude.com/docs/en/security-guidance.md) reviews code as Claude writes it, and [Code Review](https://code.claude.com/docs/en/code-review.md) reviews pull requests. For how the layers stack, see [How the plugin fits with other security tools](#how-the-plugin-fits-with-other-security-tools). ## Prerequisites To run the plugin, you need: * A paid plan, Anthropic API access, or a [third-party provider](#models-and-providers), for the [dynamic workflows](https://code.claude.com/docs/en/workflows.md) the scan uses to orchestrate its agents. On Pro, turn them on from the Dynamic workflows row in `/config`. -* Python 3.9 or later available on your `PATH` as `python3`. Check with `python3 --version`. The plugin's tooling uses only the Python standard library, so nothing is installed. +* Python 3.9 or later available on your `PATH` as `python3`. Check with `python3 --version`. The plugin's tooling uses only the Python standard library. * Linux, macOS, or Windows. * Git, for change scans and for turning findings into patches; those jobs don't support other version control systems. A full scan works in any directory, with or without version control. ## Models and providers -A scan runs inside your Claude Code session. The plugin makes no model calls of its own, so there's no separate API key or provider setting to configure. +The plugin makes no model calls of its own, so a scan in your session needs no separate API key or provider setting. -* **Model**: the agents that hunt for vulnerabilities, verify findings, and write and review patches run on [your session's model](https://code.claude.com/docs/en/sub-agents.md#choose-a-model). To change it, run [`/model`](https://code.claude.com/docs/en/model-config#setting-your-model) in your session before you start a scan. A few supporting steps, such as mapping the repository, use the [`sonnet` alias](https://code.claude.com/docs/en/model-config#model-aliases) instead. +* **Model**: the agents that hunt for vulnerabilities, verify findings, and write and review patches run on [your session's model](https://code.claude.com/docs/en/sub-agents.md#choose-a-model). To change it, run [`/model`](https://code.claude.com/docs/en/model-config#setting-your-model) in your session before you start a scan. A few supporting steps use the [`sonnet` alias](https://code.claude.com/docs/en/model-config#model-aliases) instead. * **Provider**: scans run on a paid plan, with Anthropic API access, or on a [third-party provider](https://code.claude.com/docs/en/third-party-integrations.md) such as [Amazon Bedrock](https://code.claude.com/docs/en/amazon-bedrock.md), [Google Cloud's Agent Platform](https://code.claude.com/docs/en/google-vertex-ai.md), or [Microsoft Foundry](https://code.claude.com/docs/en/microsoft-foundry.md). On a third-party provider, the `sonnet` alias can resolve to a different version than it does on the Anthropic API. If your account can't use that version, [pin your model versions](https://code.claude.com/docs/en/model-config.md#pin-models-for-third-party-deployments), including `ANTHROPIC_DEFAULT_SONNET_MODEL`. @@ -36,13 +46,15 @@ On a third-party provider, the `sonnet` alias can resolve to a different version ## Install the plugin -In the VS Code extension or the desktop app, install it by following [Install a plugin](https://code.claude.com/docs/en/plugins/install.md#install-a-plugin). In a terminal, start Claude Code by running `claude`, then enter this at its prompt to install from the [official Anthropic marketplace](https://code.claude.com/docs/en/plugins/anthropic-marketplaces.md): +In the VS Code extension or the desktop app, install it by following [Install a plugin](https://code.claude.com/docs/en/plugins/install.md#install-a-plugin). + +In a terminal, start Claude Code by running `claude`, then enter this at its prompt to install from the [official Anthropic marketplace](https://code.claude.com/docs/en/plugins/anthropic-marketplaces.md): ```text theme={null} /plugin install claude-security@claude-plugins-official ``` -The command opens the plugin's details, where you choose an [installation scope](https://code.claude.com/docs/en/plugins/install.md#install-a-plugin) to start the install. +The command opens the plugin's details, where you choose an [installation scope](https://code.claude.com/docs/en/plugins/install.md#install-a-plugin) to start the install. Choose user scope to have the plugin in every project. If the install fails, match the message Claude Code reports: @@ -55,6 +67,8 @@ Once the plugin is active, you're ready to [scan and fix your codebase](#scan-an ### Update the plugin +If a command or option doesn't work, [check](https://code.claude.com/docs/en/plugins/install.md#install-a-plugin) that you have version 0.13.0 or later of the plugin. + To update the plugin yourself, see [Update plugins now](https://code.claude.com/docs/en/plugins/install.md#update-plugins-now). Claude Code also [updates the plugin automatically](https://code.claude.com/docs/en/plugins/install.md#keep-plugins-updated) unless auto-update is turned off. ### Uninstall the plugin @@ -63,39 +77,60 @@ To remove the plugin, uninstall it from the `/plugin` menu, or run `claude plugi ## Scan and fix your codebase -The plugin adds one command, `/claude-security`, which opens a menu of its three jobs: scanning the codebase, scanning a set of changes, and suggesting patches. The happy path runs a full scan, then turns its findings into patches: +At the Claude Code prompt, `/claude-security` opens a menu of jobs, such as scanning the codebase, scanning a set of changes, and suggesting patches. The happy path runs a full scan, then turns its findings into patches: -**1. Open the Claude Security menu** +**1. Start from a clean working tree** -Run `/claude-security` and pick **Scan codebase**. +If you want patches later, commit all your changes and untracked files, or stash them with `git stash -u` from your shell until the scan ends. -**2. Choose what to scan** +**2. Open the Claude Security menu** + +Start Claude Code in your repository, run `/claude-security`, and pick **Scan codebase**. + +**3. Choose what to scan** The plugin reads your repository first, then offers the whole repository or a focused area. Pick the whole repository, or answer "I don't know" and the plugin picks a sensible default for your repository's size. -**3. Confirm the run** +**4. Confirm the run** A scan may take a while, may use a significant number of tokens, and needs Claude Code left open while it completes. Nothing runs until you confirm. -**4. Read the report** +**5. Read the report** + +When the scan starts in a terminal session, the plugin's [live view](#watch-a-running-scan), on by default, opens with a live map of the code. You can also follow each stage with [`/workflows`](https://code.claude.com/docs/en/workflows#watch-the-run) in the terminal. Results are written to a timestamped directory in the folder where you started Claude Code, described in [Read the scan results](#read-the-scan-results). + +**6. Turn findings into patches** + +Run `/claude-security` again and pick **Suggest patches**, then choose which findings to address. Reviewed patches are written to the report's `patches/` folder; [Fix findings](#fix-findings) covers how each patch is built and reviewed, and what to check afterward. -While the scan runs, it reports each stage as it starts, with the detail available under [`/workflows`](https://code.claude.com/docs/en/workflows). Results are written to a timestamped directory in your repository, described in [Read the scan results](#read-the-scan-results). +**7. Apply the patches you accept** -**5. Turn findings into patches** +Read each patch's [note](#patches-are-never-applied-automatically), then apply the patch from your shell at the root of your repository with `git apply`, in its own pull request. Patches aren't applied automatically. -Run `/claude-security` again and pick **Suggest patches**, then choose which findings to address. Reviewed patches are written to the report's `patches/` folder; [Fix findings](#fix-findings) covers how each patch is built and reviewed. +You can also ask for a job directly, as arguments to the command, such as `/claude-security scan my branch`. Or ask in plain language, such as "scan the whole repo with the Claude Security plugin". The plugin works best in [auto mode](https://code.claude.com/docs/en/permission-modes.md), which lets the scan proceed without a permission prompt at each step. -**6. Apply the patches you accept** +### Watch a running scan -Apply each patch from your shell with `git apply`, in its own pull request. Patches are never applied automatically. +When you start a scan in a terminal session, the plugin's [mod](https://code.claude.com/docs/en/plugins/mods/overview.md) opens a live view of the scan in a pane or a band above the prompt. You need Claude Code v2.1.292 or later. -You don't have to start from the menu: ask for a job directly, as arguments to the command, such as `/claude-security scan my branch`, or in plain language, such as "scan commit abc1234". The plugin works best in [auto mode](https://code.claude.com/docs/en/permission-modes.md), which lets the scan's agents proceed without a permission prompt at each step. +* **Close it**: press `Ctrl+X X` to shrink the pane to a band, and again to hide the band +* **Reopen it**: enter `/claude-security-view` while the scan runs +* **Turn it off**: enter `/plugin configure claude-security` and change **Live scan view** + +### Continue a stopped scan + +If a scan in your session stops before it writes its report, you can continue it, unless the session says that safeguards stopped one of the scan's agents. In that case, start a new scan instead. + +To continue, leave your checkout and the scan's `CLAUDE-SECURITY-/` directory unchanged, and enter `/claude-security continue the scan` in the session that ran it. If you closed that session, [resume it](https://code.claude.com/docs/en/sessions.md#resume-a-session) first. ### Scan only your changes -When your branch has commits its base doesn't, the `/claude-security` menu offers to scan only that diff, so you can check a branch before merging. You can also scan one of your open pull requests, or a single commit by asking for it, such as "scan commit abc1234". Only committed changes are scanned: commit or stash in-progress edits first, or run a full scan, which reads the working tree. +When your branch has commits its base doesn't, the `/claude-security` menu offers to scan only that diff, so you can check a branch before merging. Before a change scan, commit the edits you want scanned and stash the rest with `git stash -u`, or run a [full scan](#scan-and-fix-your-codebase), which reads the working tree. -Change scans need a git repository; full scans of an unversioned directory still work. Finding your open pull requests is offered only when your session already has permission to run the GitHub CLI and `gh` is signed in. +To scan one of your open pull requests or a single commit, check it out from your shell first, then ask at the Claude Code prompt: + +* **Pull request**: run `git checkout feature-auth`, naming the pull request's branch, then `/claude-security scan my branch` +* **Single commit**: run `git checkout abc1234`, then `/claude-security scan commit abc1234` ### Scope large repositories @@ -105,63 +140,201 @@ On a large repository, scan one area at a time instead of the whole tree. Pick o Scan effort sets how deep a scan goes. Your findings go through the same independent verification at `low`, `medium`, and `high`. -* **`low`**: a quick first look. It skips the architecture map and the threat model when you scan your codebase. +* **`low`**: a quick first look. It skips the architecture map when you scan your codebase. * **`medium`**: the default. * **`high`**: what `medium` does, plus more hunting for vulnerabilities in the same code. -Name the scan effort in your request at the Claude Code prompt, such as `/claude-security scan my public API code at high` or `/claude-security scan my branch at high`. +Name the scan effort in your request at the Claude Code prompt, such as for a part of your codebase or for your changes: + +* **Part of your codebase**: `/claude-security scan my public API code at high` +* **Your changes**: `/claude-security scan my branch at high` If a scan of a large repository finds less than you expect, choose `high` scan effort, scan a second time, or do both. Each can report findings that one `medium` scan doesn't. +A codebase scan can cost a lot of tokens, and the cost grows with the size of the repository, the scan effort, and the model. To spend less, scan a [smaller area](#scope-large-repositories), choose `low`, or [change the model](#models-and-providers) before you start. + +### Run a more thorough change scan + +Replace the [scan effort](#choose-a-scan-effort) with `--change-scan-effort high`, such as `/claude-security scan my branch --change-scan-effort high`. More agents read the change than at `high` scan effort, so the scan takes longer and costs several times as much. Its report also lists vulnerabilities older than the change. + +### Tell a scan about your system + +To give a scan facts about your system, name up to 10 files in the folder that you scan or type your own notes. + +Give them in your request, or when the scan asks: + +```text theme={null} +/claude-security scan this repository, and read docs/arch.md first +``` + +Give only notes and files that are up to date and that you trust, because a wrong statement can hide a vulnerability. Keep your README and `SECURITY.md` up to date too, because the scan weighs what they say about trusted users and intended behavior. + +To [get patches](#scan-and-fix-your-codebase) from this scan, commit the files that you name instead of stashing them. + ### Read the scan results -Every scan writes its results into a timestamped `CLAUDE-SECURITY-/` directory in your repository: +After a scan in your session, find its results in a timestamped `CLAUDE-SECURITY-/` directory in the folder where you started Claude Code: * **`CLAUDE-SECURITY-RESULTS.md`**: the report, with each finding's ID, such as `F1`, plus its impact, exploit scenario, severity, confidence, and recommendation * **`CLAUDE-SECURITY-RESULTS.jsonl`**: the same findings in machine-readable form, one JSON object per line * **`CLAUDE-SECURITY-RESULTS.sarif`**: the same findings as a [SARIF 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html) log for GitHub code scanning and any other tool that reads the standard. The scan classifies findings under their [CWE](https://cwe.mitre.org/) weakness categories * **`CLAUDE-SECURITY-REVISION-.json`**: the revision stamp, recording which commit was scanned, at what [scan effort](#choose-a-scan-effort), whether uncommitted changes were part of the scanned tree, and how thoroughly the run was verified. A scan outside version control stamps `UNVERSIONED` in place of the commit -That directory is the only change a scan makes to your checkout, and it carries its own `.gitignore`, so a stray `git add` never sweeps a report into a commit. To keep a report in history for an audit trail, delete that one `.gitignore` file and commit the directory like any other. +That directory is the only change a scan makes to your checkout, and it carries its own `.gitignore`, so a stray `git add` doesn't sweep a report into a commit. Some packaging and deploy tools don't read that file, so move report directories out while you package or deploy. To keep a report in history for an audit trail, delete that one `.gitignore` file and commit the directory. Findings only appear in the report after independent verifier agents analyze them, which keeps reports short and worth reading. Scans are nondeterministic: two scans of the same code can surface different findings. Run scans regularly. ## Fix findings -Start the fix flow by picking **Suggest patches** from the `/claude-security` menu, or ask in plain language, such as "fix finding F3", then pick which findings from the report to address. Patches are built against committed code, and the report has to still describe the code you have: findings whose code has since changed are skipped with a note, and the plugin offers a fresh scan instead of patching from a stale report. Each patch is drafted in a scratch copy of your repository, so your source files stay untouched until you apply a patch yourself. +Start the fix flow by picking **Suggest patches** from the `/claude-security` menu, or ask in plain language, such as "fix finding F3", then pick which findings from the report to address. Each patch is drafted in a scratch copy of your repository. An agent can still edit your own files by mistake, so run `git status` when the job ends. + +Before delivery, an agent independent of the one that wrote the patch reviews it. It runs your project's tests when it can, and reads the diff on its own terms for anything new it might introduce. + +That review has to vouch that the patch: + +* Addresses its one finding +* Introduces no new vulnerability +* Leaves behavior otherwise unchanged + +When the review can't vouch for all three, the plugin writes a short note explaining why instead of a patch. -Before delivery, each patch is reviewed by an agent independent of the one that wrote it, which runs your project's tests against the change when the code has them and reads the diff on its own terms for anything new it might introduce. A patch is written only when that review can vouch that the change addresses the one finding, introduces no new vulnerability, and leaves behavior otherwise unchanged. When it can't vouch for all three, you get a short note explaining why instead of a patch. +### Patch from an older report + +You can still use a scan's report after new commits, but only if the scanned commit is in your current history. If it isn't, take the fresh scan that the plugin offers. ### Patches are never applied automatically -Applying a patch is always your decision. Patches are written to the report's `patches/` folder, one `F.patch` per finding with a note beside it explaining the change. Apply one from your shell, or ask Claude to apply it and open a pull request: +Applying a patch is your decision. Patches are written to the report's `patches/` folder, one `F.patch` per patched finding with a note beside it explaining the change. Ask Claude to apply one and open a pull request, or apply it from your shell at the root of your repository. + +Read the patch's note, `F.md`, first, because it has the exact command, such as: ```bash theme={null} -git apply CLAUDE-SECURITY-/patches/F1.patch +git -C "$(git rev-parse --show-toplevel)" apply CLAUDE-SECURITY-/patches/F1.patch ``` -When the patched code has no tests, the patch's note says so, so you know its review ran without a test pass. Apply each patch in its own pull request so it can be reviewed and tested on its own. +Apply each patch in its own pull request so it can be reviewed and tested on its own. If `git apply` refuses a patch, read its note. + +## Triage findings you already have + +Vulnerability Triage checks whether the findings in a list hold up against your code. The list can be a SARIF 2.1.0 file from another scanner, or the `CLAUDE-SECURITY-/` directory of an earlier scan. Triage only a list from a source that you trust. + +If you want patches later, leave nothing uncommitted or untracked but the list itself. Start Claude Code in the directory that the findings' file paths are relative to, usually your repository's root. + +Then enter the command with the list's path: + +```text theme={null} +/claude-security triage results.sarif +``` + +The report is `FINDINGS-TRIAGE.md`, in a new `CLAUDE-SECURITY-/` directory. Findings that the triage rejects are under **Not validated**. Check that section yourself, because the triage is more likely to reject a real finding that your list describes in only a few words. `FINDINGS-TRIAGE.sarif` beside the report is your list with the verdicts added. + +To turn the report's valid findings into patches, accept the offer at the end of the triage. If you commit, pull, or switch branches first, start a new triage. See [Fix findings](#fix-findings) for what to check after a patch job. + +## Create a threat model + +The `/claude-security:threat-model` command drafts a threat model, a file that you can give to later scans. + +Start Claude Code at the root of your repository and enter: + +```text theme={null} +/claude-security:threat-model +``` + +Claude reads your code and any scan report, then asks about your system and what else it may read: folders, your [connectors](https://code.claude.com/docs/en/mcp.md), or text that you paste. + +> [!WARNING] +> +> If you let Claude read your connectors, its search terms leave your machine, and they can include words from that report. Claude can be misled by what it reads there, or by text that you paste. + +When Claude shows a draft: + +1. Check it before you choose **Yes** to save it as `.claude-security/threat-model.md`, because a wrong statement can hide a vulnerability from a later scan. +2. If there's a scan report, choose whether Claude writes `CLAUDE-SECURITY-PRECONDITIONS.md` in the report's folder. That file says whether each finding's preconditions are `met`, `not met`, or `not shown` in the sources that Claude read. +3. When Claude finishes, enter [`/clear`](https://code.claude.com/docs/en/commands#all-commands) before you run another command of the plugin. + +To be sure that a scan reads the threat model, [name it in your request](#tell-a-scan-about-your-system). + +## Analyze your attack surface + +An attack surface analysis examines the parts of your project that an attacker can reach, and proposes changes to shrink that attack surface. + +Start Claude Code at the root of your repository, in [auto mode](https://code.claude.com/docs/en/permission-modes.md#switch-permission-modes) where it's [available](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode), and enter: + +```text theme={null} +/claude-security:attack-surface-analysis +``` + +An analysis may take a long time and use a significant number of tokens. Until it ends, leave Claude Code open, and don't commit, switch branches, or edit files. + +An analysis doesn't replace a [scan](#scan-and-fix-your-codebase), which looks for vulnerabilities. The analysis looks for: + +* Code that the default configuration reaches but no default feature uses +* Sensitive code reachable before login or without any user action +* Combinations of options that silently turn off a security feature + +The report is `CLAUDE-SECURITY-/CLAUDE-SECURITY-RESULTS.md`, in the folder where you started Claude Code. If the analysis wrote patches, `attack-surface-patches/PATCHES.md` beside it describes them. Treat findings and patches as untested until you check them yourself. + +## Scan from your shell + +The `claude-security` command scans the folder that you run it in, and writes the [same report](#read-the-scan-results) there. The scan runs inside the [plugin's sandbox](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/README.md#running-in-a-sandbox). It signs in with your Claude Code login or your provider's environment variables. + +The sandbox runs only on Linux: + +* **Linux**: you need kernel 5.19 or later on x86-64 or arm64, Python 3.10 or later, and a user other than root. On Ubuntu 24.04 or later, add `--sudo`, which sets up the sandbox with `sudo`. If your system doesn't meet these requirements, [scan in a session](#scan-and-fix-your-codebase). +* **Windows**: add `--no-sandbox`, or the command stops +* **macOS and WSL 2**: the command isn't supported, so [scan in a session](#scan-and-fix-your-codebase) + +> [!WARNING] +> +> The command doesn't load your repository's `.claude/` settings or hooks, so the deny rules there don't apply. In the sandbox, your organization's [server-managed settings](https://code.claude.com/docs/en/server-managed-settings.md#security-considerations) don't apply either. If you add `--no-sandbox`, the scan runs in [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) with your user's access. See the plugin's [trust model](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/SECURITY.md#trust-model). + +The plugin includes the command. To add it to your `PATH`, enter `/claude-security:install-cli` in Claude Code and follow what it prints. + +Then run it in your repository, with `--sudo` or `--no-sandbox` if your system needs it: + +* **Scan the codebase**: `claude-security` +* **Scan this branch's changes**: `claude-security --changes` +* **Scan with a full-screen view**: `claude-security --tui`, which needs Node.js 18 or later +* **List the other options**: `claude-security --help` + +The command runs in [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode), and stops if auto mode isn't available. If your Claude Code model doesn't support it, add `--model` with one that does. For any other cause, [scan in a session](#scan-and-fix-your-codebase). + +## Scan pull requests in GitHub Actions + +On a pull request, the plugin's GitHub Actions job scans the change, posts a review and suggested fixes, and can block the merge. It can also scan the whole repository on a schedule. + +> [!WARNING] +> +> Use the job only in a repository where you trust everyone who can push. Anyone who adds text or code to a pull request's branch can steer the scan, have it run that code, and make it send model requests on the job's credential. By default, the job fails for a pull request from a fork. +> +> In a public repository, the review, the job summary, or the job's report artifact can disclose a live vulnerability. To keep findings private, [scan in your session](#scan-only-your-changes) instead. + +The job needs a GitHub-hosted Linux runner on GitHub.com, and [Anthropic API access](https://platform.claude.com/docs/en/get-api-key) or a [third-party provider](https://code.claude.com/docs/en/third-party-integrations.md), because it can't sign in with a paid plan. Follow the plugin's [GitHub Actions guide](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/CI.md) to add the workflow and create a credential for this job alone. To move to version 0.13.0, put its commit after the `@` in each workflow: `d0d514288960e7a78e1a76e4a3ec694416458726`. + +With the guide's sample workflow, a draft pull request from a branch of your repository passes with no scan until you mark it ready for review. A pull request from Dependabot passes with no scan too, so review its changes yourself. ## How the plugin fits with other security tools -The Claude Security plugin is the on-demand deep-scan layer in a defense-in-depth stack, alongside the [security guidance plugin](https://code.claude.com/docs/en/security-guidance.md), [`/security-review`](https://code.claude.com/docs/en/commands#all-commands), [Code Review](https://code.claude.com/docs/en/code-review.md), the managed [Claude Security](https://claude.com/product/claude-security) product, and your existing scanners: +The Claude Security plugin is the deep-scan layer in a defense-in-depth stack, alongside the [security guidance plugin](https://code.claude.com/docs/en/security-guidance.md), [Code Review](https://code.claude.com/docs/en/code-review.md), the managed [Claude Security](https://claude.com/product/claude-security) product, and your existing scanners: | Stage | Tool | What it covers | | :- | :- | :- | | In session | [Security guidance plugin](https://code.claude.com/docs/en/security-guidance.md) | Common vulnerabilities in code Claude writes, fixed in the same session | -| On demand, single pass | [`/security-review`](https://code.claude.com/docs/en/commands#all-commands) | One-time security pass on the current branch | | On demand, deep scan | Claude Security plugin | Multi-agent scan of a repository or diff, with independently reviewed findings and patches | | On pull request | [Code Review](https://code.claude.com/docs/en/code-review.md), Team and Enterprise plans | Multi-agent correctness and security review with full codebase context | +| On pull request, deep scan | [Claude Security plugin in GitHub Actions](#scan-pull-requests-in-github-actions) | Multi-agent scan of the pull request's changes | | Managed | [Claude Security](https://claude.com/product/claude-security), Enterprise plan | Hosted scanning that monitors connected repositories | | In CI | Your existing static analysis and dependency scanners | Language-specific rules, supply-chain checks, and policy enforcement | The plugin doesn't replace your existing source-code security tools. Run it alongside static analysis, dependency scanning, and code review: it reasons about your code the way a human security researcher would, which complements the deterministic checks those tools provide. +If your organization uses the managed Claude Security product, `/claude-security:hosted` shows its findings in your session. Before you use it, read the [requirements](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/README.md#findings-from-hosted-claude-security) and the [risks](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/SECURITY.md#findings-from-hosted-claude-security). + ## Troubleshooting **The `/claude-security` menu opens with a Python warning.** The plugin needs `python3` 3.9 or later on your `PATH`. When it can't find `python3` at all, the menu warns that Claude Security won't work until one is installed; when the first `python3` on your `PATH` is older, the warning names the version it found. Install Python 3, or put a newer `python3` first on your `PATH`, then start a new session. -**You may see a "safeguards flagged this message" notice when scanning on a Fable model.** The message names the model you're running. Fable's cybersecurity safety classifiers flag certain requests, and Claude Code re-runs a flagged request on an Opus model through [automatic model fallback](https://code.claude.com/docs/en/model-config.md#automatic-model-fallback). This is expected. When the request re-runs, the scan should still complete successfully. +**You may see a "safeguards flagged this message" notice when scanning on a Fable model.** The message names the model you're running. Fable's cybersecurity safety classifiers flag certain requests, and Claude Code re-runs a flagged request on an Opus model through [automatic model fallback](https://code.claude.com/docs/en/model-config.md#automatic-model-fallback). This is expected. When the request re-runs, the scan should still complete successfully. If the scan stops, see [Continue a stopped scan](#continue-a-stopped-scan). ## Related resources diff --git a/content/en/docs/claude-code/code-mode.md b/content/en/docs/claude-code/code-mode.md index 52df4f0d22..371f5a86ba 100644 --- a/content/en/docs/claude-code/code-mode.md +++ b/content/en/docs/claude-code/code-mode.md @@ -126,6 +126,14 @@ Press `Ctrl+O` and expand a **Code** row to see the JavaScript behind the tool c > > To resume a Code Mode session later, keep `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` set to `1` when you run `claude --continue` or `claude --resume`. With Code Mode off, Claude Code refuses to resume the session. Sessions that you started without Code Mode resume without Code Mode, even with the variable set. +### Use Code Mode in subagents + +If your [subagent](https://code.claude.com/docs/en/sub-agents.md) has a `tools` list, add [`REPL`](https://code.claude.com/docs/en/tools-reference) to the list so that the subagent uses Code Mode: + +```yaml theme={null} +tools: Read, Bash, REPL +``` + ### Turn off Code Mode Remove `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` from your shell, `~/.claude/settings.json`, and any `--settings` file, then start a new session. You can also keep the variable and change its value to `0` in any of them. With a `0` in one place, Code Mode stays off even if you set `1` in another. diff --git a/content/en/docs/claude-code/commands.md b/content/en/docs/claude-code/commands.md index 29f57acb80..654ee00878 100644 --- a/content/en/docs/claude-code/commands.md +++ b/content/en/docs/claude-code/commands.md @@ -56,7 +56,7 @@ In the table below, `` indicates a required argument and `[arg]` indicates | `/auto-mode-setup` | [Draft `autoMode.environment` entries](https://code.claude.com/docs/en/auto-mode-config#generate-environment-entries) from your project and recent sessions, then review the draft and save it to your user settings. On a Pro, Max, Ultra, or Team plan, requires Claude Code v2.1.228 or later, or v2.1.233 or later on native Windows. On an Enterprise plan or with a Claude Console API key, requires v2.1.283 or later. If the command is missing, see [`/auto-mode-setup` returns "Unknown command"](https://code.claude.com/docs/en/auto-mode-config#auto-mode-setup-returns-unknown-command) | | `/autocompact [auto\|]` | Set the auto-compact window: how full the context window gets before Claude Code compacts automatically. Pass a size such as `500k`, or `auto` to return to the window tuned for your model. Claude Code saves the value to user settings and applies it to the current session. See [Set the auto-compact window](https://code.claude.com/docs/en/model-config.md#set-the-auto-compact-window) for accepted values and what overrides it. Without an argument, opens a dialog that shows the current window. Requires Claude Code v2.1.221 or later | | `/autofix-pr [prompt]` | Spawn a [cloud session](https://code.claude.com/docs/en/claude-code-on-the-web.md#auto-fix-pull-requests) that watches the current branch's PR and pushes fixes when CI fails or reviewers leave comments. Detects the open PR from your checked-out branch with `gh pr view`; to watch a different PR, check out its branch first. By default the cloud session is told to fix every CI failure and review comment; pass a prompt to give it different instructions, for example `/autofix-pr only fix lint and type errors`. Requires the `gh` CLI and access to [cloud sessions](https://code.claude.com/docs/en/claude-code-on-the-web.md) | -| `/background [prompt]` | Detach the current session to run as a [background agent](https://code.claude.com/docs/en/agent-view.md) and free this terminal. Pass a prompt to send one more instruction before detaching. Monitor the session with `claude agents`. To copy the conversation into a new background session while this one keeps running, use `/fork`. Alias: `/bg` | +| `/background [prompt]` | Detach the current session to run as a [background agent](https://code.claude.com/docs/en/agent-view.md) and free this terminal. Pass a prompt to send one more instruction before detaching. Monitor the session with `claude agents`. To copy the conversation into a new background session while this one keeps running, use `/fork`. While a `/ship` or `/steward` watch is on, see [Messages during a watch](https://code.claude.com/docs/en/ship-command-troubleshooting.md#messages-during-a-watch). Alias: `/bg` | | `/batch ` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Orchestrate large-scale changes across a codebase in parallel. Researches the codebase, decomposes the work into 5 to 30 independent units, and presents a plan. Once approved, spawns one [background subagent](https://code.claude.com/docs/en/sub-agents.md#run-subagents-in-foreground-or-background) per unit in an isolated [worktree](https://code.claude.com/docs/en/worktrees.md). Each subagent implements its unit, runs tests, and opens a PR or reports what happened. Requires a git repository or a [`WorktreeCreate` hook](https://code.claude.com/docs/en/worktrees#non-git-version-control) that creates the worktrees. Outside a git repository, `/batch` requires Claude Code v2.1.281 or later. Example: `/batch migrate src/ from JavaScript to TypeScript` | | `/branch [name]` | Create a branch of the current conversation at this point, so you can try a different direction without losing the conversation as it stands. Switches you into the branch and preserves the original, which you can return to with `/resume`. To run a copy as a separate [background session](https://code.claude.com/docs/en/agent-view.md) instead of switching into it, use `/fork`; to hand a side task to a [subagent](https://code.claude.com/docs/en/sub-agents.md) that reports back into this conversation, use `/subtask` | | `/btw [question]` | Ask a [side question](https://code.claude.com/docs/en/interactive-mode.md#side-questions-with-%2Fbtw) about the current session without adding to the conversation. If you run `/btw` without a question, Claude Code shows your most recent side question so you can browse earlier answers; if you haven't asked one yet, Claude Code prints a usage line | @@ -64,6 +64,7 @@ In the table below, `` indicates a required argument and `[arg]` indicates | `/cd ` | Move this session to a new working directory, keeping the conversation. Type a partial path to see matching directory suggestions; press `Tab` to accept one. For what Claude Code applies from the new directory as soon as you move, and how `/cd` differs from `/add-dir`, see [Move the session to another directory](https://code.claude.com/docs/en/permissions.md#move-the-session-to-another-directory) | | `/chrome` | Configure [Claude in Chrome](https://code.claude.com/docs/en/chrome.md) settings | | `/claude-api [migrate\|upgrade\|api-version\|managed-agents-onboard\|managed-agents-secure\|prompt-audit\|cost-optimize\|latency-optimize\|build-eval\|hillclimb\|preserved-thinking-migration]` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Load [Claude API](https://platform.claude.com/docs/en/api/overview) and [Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) reference material for your project's language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. For what each subcommand does and the version it requires, see [Work on Claude API projects](https://code.claude.com/docs/en/skills.md#work-on-claude-api-projects) | +| `/claude-approvals [what to change or explain]` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Edit, explain, or tune a [Claude Approvals](https://code.claude.com/docs/en/approvals.md) policy file or classifier. Requires Claude Code v2.1.331 or later and [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) | | `/claude-in-chrome [task]` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Have Claude carry out a task in your browser, such as testing a page, filling a form, or reading console logs, through [Claude in Chrome](https://code.claude.com/docs/en/chrome.md). Available when Chrome integration is enabled for the session, for example with `claude --chrome`, or when Claude Code can offer to [install the extension](https://code.claude.com/docs/en/chrome.md#install-the-extension-when-claude-asks) | | `/clear [name]` | Start a new conversation with empty context. Pass a name to label the previous conversation in the `/resume` picker. To free up context while continuing the same conversation, use `/compact` instead. Resume the previous conversation with `/resume`, or, in the same Claude Code process, restore it from [the rewind menu's previous-session entry](https://code.claude.com/docs/en/checkpointing.md#rewind-past-a-cleared-conversation). Aliases: `/reset`, `/new` | | `/code-review [low\|medium\|high\|xhigh\|max\|ultra] [--fix] [--comment] [--max-findings n\|all\|default] [pr#\|branch\|path]` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Review the current diff, or a PR number, branch, or path you pass, for correctness bugs. Depending on your model and effort level, the review also covers cleanup opportunities. Pass `--fix` to have Claude apply the findings, `--comment` to post them on the GitHub PR or GitLab merge request, or `ultra` to run a deep [cloud review](https://code.claude.com/docs/en/ultrareview.md). Posting to a GitLab merge request requires Claude Code v2.1.257 or later. With `ultra` on a `github.com` PR target, pass `--post` to preselect [posting the finished findings to the PR](https://code.claude.com/docs/en/ultrareview.md#post-findings-to-the-pull-request) in the launch dialog; `--post` requires Claude Code v2.1.227 or later. See [Review locally with `/code-review`](https://code.claude.com/docs/en/code-review-local) for the effort levels, targeting, and how it relates to `/simplify`. Alias: `/review` | @@ -119,7 +120,7 @@ In the table below, `` indicates a required argument and `[arg]` indicates | `/plugin-authoring` | Load the reference Claude works from to [write a mod](https://code.claude.com/docs/en/plugins/mods/create.md#ask-claude-for-a-mod). Claude can load it on its own when you ask for a mod. This is a skill from a [built-in plugin](https://code.claude.com/docs/en/plugins/mods/overview.md#mods-built-into-claude-code), which you can turn off in `/plugin`. Requires Claude Code v2.1.287 or later | | `/powerup` | Discover Claude Code features through quick interactive lessons with animated demos | | `/pr-comments [PR]` | Removed in v2.1.91. Ask Claude directly to view pull request comments instead. On earlier versions, fetches and displays comments from a GitHub pull request; automatically detects the PR for the current branch, or pass a PR URL or number. Requires the `gh` CLI | -| `/privacy-settings` | View and update your privacy settings. Only available for Pro, Max, and Ultra plan subscribers | +| `/privacy-settings` | View and update your privacy settings or get a link to them on claude.ai. Only available for Pro, Max, and Ultra plan subscribers | | `/radio` | Open Claude FM lo-fi radio in your browser. Prints the stream URL when no browser is available | | `/rate-limit-options` | Show ways to keep working when a claude.ai usage limit blocks a request: wait and [continue automatically when the limit resets](https://code.claude.com/docs/en/interactive-mode.md#wait-for-a-usage-limit-to-reset), add [usage credits](https://code.claude.com/docs/en/costs.md#add-usage-credits-to-your-subscription), or upgrade your plan. Claude Code can also open this menu on its own when you hit a limit at your own terminal. See [Turn automatic continue off](https://code.claude.com/docs/en/interactive-mode.md#turn-automatic-continue-off). Requires a claude.ai subscription. The wait-and-continue rows require Claude Code v2.1.234 or later | | `/recap` | Generate a one-line summary of the current session on demand. See [Session recap](https://code.claude.com/docs/en/interactive-mode.md#session-recap) for the automatic recap that appears after you've been away | @@ -141,7 +142,7 @@ In the table below, `` indicates a required argument and `[arg]` indicates | `/security-review` | Analyze the changes on your current branch for security vulnerabilities. Reviews the diff between your branch and origin's default branch, identifying risks like injection, auth issues, and data exposure. Needs an `origin` remote; if the review fails with an `ambiguous argument` error, see the [error reference](https://code.claude.com/docs/en/errors.md#security-review-fails-without-origin-head) | | `/setup-bedrock` | Configure [Amazon Bedrock](https://code.claude.com/docs/en/amazon-bedrock.md) authentication, region, and model pins through an interactive wizard. [Hidden from the command menu](#how-the-command-menu-matches-what-you-type) until `CLAUDE_CODE_USE_BEDROCK=1` is set; type it in full. First-time Amazon Bedrock users can also access this wizard from the login screen | | `/setup-vertex` | Configure [Google Cloud's Agent Platform](https://code.claude.com/docs/en/google-vertex-ai.md) authentication, project, region, and model pins through an interactive wizard. [Hidden from the command menu](#how-the-command-menu-matches-what-you-type) until `CLAUDE_CODE_USE_VERTEX=1` is set; type it in full. First-time Google Cloud's Agent Platform users can also access this wizard from the login screen | -| `/ship [level] [pr] [+bot]` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Commit and push your work and open a GitHub pull request, if your branch has none. Then review the change. Claude then watches the pull request in this session and pushes fixes for review feedback and failing checks. `/ship stop` ends the watch. See [Get a pull request ready with `/ship`](https://code.claude.com/docs/en/ship-command). If the command is missing, see [Troubleshooting](https://code.claude.com/docs/en/ship-command-troubleshooting.md) | +| `/ship [level] [pr] [+bot]` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Commit and push your work [where `/ship` can](https://code.claude.com/docs/en/ship-command#what-%2Fship-commits-and-pushes), open a GitHub pull request for your branch if it has none, then review the change. Claude then watches the pull request in this session and pushes fixes for review feedback and failing checks. `/ship stop` ends the watch. See [Get a pull request ready with `/ship`](https://code.claude.com/docs/en/ship-command). If the command is missing, see [Troubleshooting](https://code.claude.com/docs/en/ship-command-troubleshooting.md) | | `/ship:review` | Alias for [`/code-review`](https://code.claude.com/docs/en/code-review-local) | | `/simplify [target]` | **[Skill](https://code.claude.com/docs/en/skills.md#bundled-skills).** Review the changed code for cleanup opportunities and apply the fixes. Four review [agents](https://code.claude.com/docs/en/sub-agents.md) run in parallel, covering reuse of existing helpers, simplification, efficiency, and whether the change is at the right level of abstraction. The review doesn't look for correctness bugs. Use `/code-review` to find bugs. Pass a path or PR reference to review a specific target | | `/skill-doctor` | Show what each of your [skills](https://code.claude.com/docs/en/skills.md) costs in context and how often it gets used, so you can [find skills to turn off](https://code.claude.com/docs/en/skills.md#find-unused-skills). Requires Claude Code v2.1.252 or later and [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) | diff --git a/content/en/docs/claude-code/desktop.md b/content/en/docs/claude-code/desktop.md index 39f8a2a436..18cae3f1dd 100644 --- a/content/en/docs/claude-code/desktop.md +++ b/content/en/docs/claude-code/desktop.md @@ -2320,6 +2320,7 @@ The following features aren't available in Desktop, except where noted: * **Linux (beta)**: Computer Use isn't yet available in the Linux desktop app. See [Claude Desktop on Linux](https://code.claude.com/docs/en/desktop-linux.md). * **Inline code suggestions**: Desktop doesn't offer autocomplete-style code completions. It works through conversational prompts and explicit code changes, and can [suggest your next prompt](#accept-a-suggested-prompt) after Claude replies. * **Agent teams**: coordinated teams, where Claude as the team lead assigns tasks to teammates from a shared task list, are available in the [CLI](https://code.claude.com/docs/en/agent-teams.md), not in Desktop. For multi-agent work inside one session, use [dynamic workflows](https://code.claude.com/docs/en/workflows.md), which run in Desktop; Claude can also [message and manage your other sessions](#work-across-sessions) directly. +* **Code Mode**: Desktop sessions start without the experimental [Code Mode](https://code.claude.com/docs/en/code-mode.md), even if you turn it on in your settings. To use it, run the CLI in a terminal. * **Terminal-dialog commands**: built-in commands that open an interactive panel in the terminal behave differently in the Code tab. Edit [settings files](https://code.claude.com/docs/en/settings.md) directly to manage permission rules and configuration, or run the commands from the standalone CLI. * Commands with no argument form, such as `/permissions`, reply with `isn't available in this environment`. * `/config` opens **Settings > Code** or **Settings > Claude Code**. diff --git a/content/en/docs/claude-code/env-vars.md b/content/en/docs/claude-code/env-vars.md index 43f64c4121..856b287ea2 100644 --- a/content/en/docs/claude-code/env-vars.md +++ b/content/en/docs/claude-code/env-vars.md @@ -276,7 +276,9 @@ Numeric variables such as timeouts, token budgets, and retry counts accept scien | `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY` | Set to `1` to turn off the [PowerShell tool](https://code.claude.com/docs/en/tools-reference.md#powershell-tool) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](https://code.claude.com/docs/en/permission-modes.md#remove-item-in-powershell), such as a drive root or your home directory. Claude Code ignores this variable in a settings file's `env` block. Requires Claude Code v2.1.283 or later | | `CLAUDE_CODE_DISABLE_PROXY_SCHEME_REPAIR` | Set to `1` to have Claude Code stop at startup on a plain `host:port` in `HTTPS_PROXY` or `https_proxy` even when it starts with no terminal. Claude Code ignores it in project and local settings. Requires Claude Code v2.1.327 or later | | `CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK` | Set to `1` to turn off the [automatic model switch when a safety classifier flags a request](https://code.claude.com/docs/en/model-config.md#automatic-model-fallback), the behavior the [`switchModelsOnFlag`](https://code.claude.com/docs/en/settings-reference#switchmodelsonflag) setting controls | +| `CLAUDE_CODE_DISABLE_RESPONSE_COMPRESSION` | Set to `1` to request uncompressed model responses if your [proxy](https://code.claude.com/docs/en/network-config.md#proxy-configuration) leaves compressed ones unfinished. Not recommended for self-hosted runners or Remote Control. Ignored in project and local settings. Requires Claude Code v2.1.331 or later | | `CLAUDE_CODE_DISABLE_SHELL_HEAD_START` | Set to `1` to turn off the head start that can run your shell startup files while Claude writes the session's first Bash command, before that command's permission prompt. Requires Claude Code v2.1.327 or later | +| `CLAUDE_CODE_DISABLE_SHIP` | Set to `1` to turn off [`/ship` and `/steward`](https://code.claude.com/docs/en/ship-command#turn-off-%2Fship-and-%2Fsteward-for-your-organization). Requires Claude Code v2.1.331 or later | | `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS` | Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](https://code.claude.com/docs/en/llm-gateway-protocol.md#feature-pass-through) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](https://code.claude.com/docs/en/llm-gateway-protocol#disable-pre-release-capabilities) turns off. Requires Claude Code v2.1.288 or later | | `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT` | Set to `1` to turn off the [critical-path](https://code.claude.com/docs/en/permission-modes.md#critical-paths) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later | | `CLAUDE_CODE_DISABLE_TERMINAL_TITLE` | Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](https://code.claude.com/docs/en/sessions.md#name-your-sessions), and turns off [status reports to your terminal](https://code.claude.com/docs/en/terminal-config.md#see-session-status-in-your-terminal) | @@ -517,7 +519,7 @@ Numeric variables such as timeouts, token budgets, and retry counts accept scien | `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` | Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md#common-configuration-variables) | | `OTEL_LOG_ASSISTANT_RESPONSES` | Set to `1` to include the model's response text on `assistant_response` OpenTelemetry log events. When unset, Claude Code uses the value of `OTEL_LOG_USER_PROMPTS` instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env). Requires Claude Code v2.1.193 or later. See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md#assistant-response-event) | | `OTEL_LOG_MANAGED_SETTINGS` | Set to `1` to add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to `managed_settings_resolved` OpenTelemetry log events. Disabled by default. Set it in your shell, user settings, or managed settings; a value in project or local settings doesn't turn it on. Requires Claude Code v2.1.274 or later. See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md#managed-settings-resolved-event) | -| `OTEL_LOG_RAW_API_BODIES` | Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env). See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md#api-request-body-event) | +| `OTEL_LOG_RAW_API_BODIES` | Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the [content limit](https://code.claude.com/docs/en/monitoring-usage.md#common-configuration-variables), or `file:` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies can include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env). See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md#api-request-body-event) | | `OTEL_LOG_TOOL_CONTENT` | Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](https://code.claude.com/docs/en/monitoring-usage.md#new-context-gates). Requires [tracing](https://code.claude.com/docs/en/monitoring-usage.md#traces-beta). Disabled by default to protect sensitive data. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env), apart from the off values that section describes. See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md#tool-output-span-event) | | `OTEL_LOG_TOOL_DETAILS` | Set to `1` to include tool input arguments; MCP server names; user-authored workflow names; raw error strings on tool failures; the refusal `category` on `api_refusal` events; real agent, skill, plugin, and MCP server names on [cost and token metrics](https://code.claude.com/docs/en/monitoring-usage.md#cost-counter); and other tool details in OpenTelemetry metrics, traces, and logs. Disabled by default to protect PII. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env), apart from the off values that section describes. See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md) | | `OTEL_LOG_USER_PROMPTS` | Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env), apart from the off values that section describes. See [Monitoring](https://code.claude.com/docs/en/monitoring-usage.md) | @@ -600,7 +602,8 @@ With fetching off, you can't: * Run [`claude import` or the `/import` command](https://code.claude.com/docs/en/cli-reference#cli-commands) * Run [`/skill-doctor`](https://code.claude.com/docs/en/skills#find-unused-skills) or open its report in the `/plugin` **Stats** tab * Run [`/restart`](https://code.claude.com/docs/en/commands) on Pro, Max, and Ultra plans -* Run [`/ship` or `/steward`](https://code.claude.com/docs/en/ship-command) +* Run [`/ship` or `/steward`](https://code.claude.com/docs/en/ship-command), except with Claude Code v2.1.331 or later on a third-party provider or in a Claude apps gateway session +* Run [`/claude-approvals`](https://code.claude.com/docs/en/commands) * Sync the [skills](https://code.claude.com/docs/en/skills.md#where-synced-skills-load) and [plugins](https://code.claude.com/docs/en/plugins/loading.md#synced-plugins) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](https://code.claude.com/docs/en/interactive-mode.md#you-should-know-suggestions) * Use [the advisor tool](https://code.claude.com/docs/en/advisor.md#requirements), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](https://code.claude.com/docs/en/feature-availability.md#availability-by-model-provider) diff --git a/content/en/docs/claude-code/errors.md b/content/en/docs/claude-code/errors.md index 4d7d5c2c04..e5f43122b4 100644 --- a/content/en/docs/claude-code/errors.md +++ b/content/en/docs/claude-code/errors.md @@ -99,19 +99,22 @@ Match the message you see to a section below. | `Your account does not have access to Claude. Please login again or contact your administrator.` | [Authentication](#oauth-token-revoked-or-expired) | | `API Error: 401 Invalid authentication credentials` | [Authentication](#api-error-401-invalid-authentication-credentials) | | `Login expired · Please run /login` | [Authentication](#login-expired) | +| `Authentication error · This may be a temporary network issue` in a cloud session | Send your message again. | +| `login required — run /login` in agent view | If a message listed in this table follows it, use that row. Otherwise run `/login`. | | `Warning: this sign-in` | [Check when a stored login ends](https://code.claude.com/docs/en/authentication.md#check-when-a-stored-login-ends) | | `The browser can't return the sign-in to Claude Code automatically` | [Authentication](#couldnt-start-the-local-sign-in-listener) | | `Couldn't start the local listener that receives the browser sign-in. Try again.` | [Authentication](#couldnt-start-the-local-sign-in-listener) | | `Failed to start OAuth callback server` | [Authentication](#failed-to-start-oauth-callback-server) | | `Claude login not accepted · Run /login, then try again` | [Authentication](#claude-login-not-accepted) | | `Artifacts need a claude.ai login` | [Authentication](#artifacts-need-a-claude-ai-login) | +| `Your authentication token belongs to organization` | [Restrict login to your organization](https://code.claude.com/docs/en/authentication.md#restrict-login-to-your-organization) | | `Not signed in to the Cloud gateway — run /login.` | [Authentication](#administrator-policy-requires-a-cloud-gateway-sign-in) | | `Administrator policy requires a Cloud gateway sign-in on this machine` | [Authentication](#administrator-policy-requires-a-cloud-gateway-sign-in) | | `Managed settings on this machine configure a Cloud gateway sign-in; run interactive /login to authenticate.` | [`claude auth login`](https://code.claude.com/docs/en/cli-reference#cli-commands) | | `You chose an organization that is managed in Anthropic's Enterprise Admin Console` | [Turn on sign-in from Claude Code](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#turn-on-sign-in-from-claude-code) | | `The organization's settings won't apply on this computer` | [Which settings take priority](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#which-settings-take-priority) | | `no usable organization sign-in` / `no readable organization sign-in` | [When a sign-in ends](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#when-a-sign-in-ends) | -| `the session no longer runs under that sign-in` / `This Claude Code process ran under your organization` / `After a sign-in to your organization, only a new session sends requests` | [Log in to Claude Code](https://code.claude.com/docs/en/authentication.md#log-in-to-claude-code) | +| `the session no longer runs under that sign-in` / `This Claude Code process ran under your organization` / `After a sign-in to your organization, only a new session sends requests` / `Claude Code needs to restart to use it` | [Log in to Claude Code](https://code.claude.com/docs/en/authentication.md#log-in-to-claude-code) | | `This conversation ran under organization` / `This conversation ran under more than one organization` | [Log in to Claude Code](https://code.claude.com/docs/en/authentication.md#log-in-to-claude-code) | | `Claude Code could not read the managed settings that apply to this computer, which may require a sign-in to Anthropic` | [`enforceAnthropicSignIn`](https://code.claude.com/docs/en/settings-reference#enforceanthropicsignin) | | `This computer's managed settings require a sign-in to Anthropic` / `This computer's settings require a sign-in to Anthropic that this app cannot use` | [Require the sign-in](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#require-the-sign-in-with-managed-settings) | @@ -375,6 +378,8 @@ Match the message you see to a section below. | `commands path not found: ` | [Plugin troubleshooting](https://code.claude.com/docs/en/plugins/troubleshooting.md#commands-path-not-found) | | `Plugin not loaded: its manifest was not read` | [Plugin errors](#plugin-not-loaded-its-manifest-was-not-read) | | `path couldn't be checked` / `path could not be checked` | [Plugin errors](#path-could-not-be-checked) | +| `Couldn't load hooks from ` / `Failed to load hooks from ` / `Hook load failed` | [Plugin troubleshooting](https://code.claude.com/docs/en/plugins/troubleshooting.md#failed-to-load-hooks-from-and-hooks-that-dont-fire) | +| `hooks.json declares PreToolUse/PermissionRequest` | Put the events under a `hooks` key, as in the [plugin hooks example](https://code.claude.com/docs/en/plugins/components.md#hooks). | | `its marketplace entry path does not stay inside the marketplace directory` | [Plugin errors](#marketplace-entry-path-does-not-stay-inside-the-marketplace-directory) | | `Plugin source path refused` | [Plugin errors](#marketplace-entry-path-does-not-stay-inside-the-marketplace-directory) | | `Failed to load marketplace configuration` | [Plugin errors](#failed-to-load-marketplace-configuration) | @@ -392,6 +397,7 @@ Match the message you see to a section below. | `MCP server "" connection closed before the tool call was answered` | [Tool errors](#connection-closed-before-the-tool-call-was-answered) | | `MCP server "" is disabled — re-enable it via /mcp to use its tools` | [Tool errors](#mcp-server-is-disabled) | | `MCP server "" tool "" timed out after s. The server asked the user a question, and no answer came before the time limit.` | [Tool errors](#mcp-tool-call-timed-out-with-the-servers-question-unanswered) | +| `The server's response is not a valid MCP response, so it was not read` | Before retrying, check whether the request ran. Report the error to the MCP server's author. | | `Permission prompt tool returned an invalid result` | [Tool errors](#permission-prompt-tool-returned-an-invalid-result) | | `would be spawned with zero tools — refusing` | [Tool errors](#agent-would-be-spawned-with-zero-tools) | | `File is covered by a Read deny rule in your permission settings` | [Tool errors](#file-is-covered-by-a-read-deny-rule) | @@ -437,6 +443,7 @@ Match the message you see to a section below. | `Disk full: this computer's volume holding (Claude Code's temporary directory) has MB free` / `Nearly out of inodes: this computer's volume holding ` | [Tool errors](#disk-quota-or-temp-filesystem-is-full) | | `Disk full: a test write beside this command's output file` / `Disk quota used up: a test write beside this command's output file` | [Tool errors](#disk-quota-or-temp-filesystem-is-full) | | `The command was not started: this computer's disk is full (ENOSPC)` / `the user's disk quota is used up (EDQUOT)` | [Tool errors](#disk-quota-or-temp-filesystem-is-full) | +| `The sandbox could not create , a folder it must protect from the command, because the temp disk is full` | Free space on the temp disk or repair it, then have Claude run the command again. | | `Your disk quota is full on the filesystem with Claude Code's temp directory (EDQUOT)` / `The filesystem with Claude Code's temp directory , or your disk quota on it, is full (ENOSPC)` | [Tool errors](#disk-quota-or-temp-filesystem-is-full) | | `Command output was lost: the temp filesystem at is full` / `is out of inodes` | [Tool errors](#disk-quota-or-temp-filesystem-is-full) | | `File is not valid UTF-8. It may use a legacy encoding such as Windows-1252, Shift-JIS or GBK, or be binary` | [Tool errors](#file-is-not-valid-utf-8) | @@ -489,12 +496,19 @@ Match the message you see to a section below. | `Subprocess initialization did not complete within 60000ms` | [Wrapper and IDE errors](#subprocess-initialization-did-not-complete-within-60000ms) | | `Claude Code did not finish starting` | [Wrapper and IDE errors](#subprocess-initialization-did-not-complete-within-60000ms) | | `The connection to Claude Code ended before this message completed` | [Wrapper and IDE errors](#the-connection-to-claude-code-ended-before-this-message-completed) | +| `Dictation error: The speech service refused the connection` / `Dictation error: The connection to the speech service was lost` / `Dictation error: Couldn’t connect to the speech service`, in VS Code | Run **Claude Code: Show Logs** from the Command Palette and search for `Speech-to-text`. | +| `The last request was refused`, on the VS Code sign-in screen | Select **Cancel**, then look up the conversation's error in this table. | +| `Plan not copied: The new session starts without a plan file.`, in VS Code | If you need the plan, ask Claude to write it again in the new session. | +| `A message is still queued` / `A /clear is still queued`, when you rewind code in VS Code | Stop Claude, then follow the rest of the message. | +| `Couldn’t load the diff view or code colors`, in VS Code | Click a diff to try again, or reload the window. | +| `Settings file is empty, and another program may still be writing it: `, in VS Code | Try again in a minute. If the message repeats, put `{}` in the file. | | `Could not locate the Claude CLI on PATH` | [Wrapper and IDE errors](#could-not-locate-the-claude-cli-on-path) | | `Claude Code could not be started from : it is the build, and this computer needs the build` | If you set [`claudeCode.claudeProcessWrapper`](https://code.claude.com/docs/en/vs-code#extension-settings), point it at a program built for ``. Otherwise, install the VS Code extension package for ``. | | `The Claude Code program for this computer, the build, could not be found` | [Wrapper and IDE errors](#the-claude-code-program-for-this-computer-could-not-be-found) | | `Restored the code, but skipped N files` | [Rewind warnings and errors](#restored-the-code-but-skipped-files) | | `No files were restored: N files failed (backup missing, or the file could not be updated)` | [Rewind warnings and errors](#no-files-were-restored) | | `Couldn't restore N files: the backup is missing or the file can't be written` | Make the files that failed writable, then restore them from version control. | +| `Kept N files created since then, because a restore failed` | If you don't want the files Claude created after the checkpoint, delete them. | | `The file backups are still being copied. Nothing was changed. Try again in a moment.` | Select the same point in [`/rewind`](https://code.claude.com/docs/en/checkpointing) again. When you restore code soon after [`/branch`](https://code.claude.com/docs/en/sessions#branch-a-session), Claude Code can still be copying the file backups to the new session. | | `Transcript writes are failing (...)` | [Session saving warnings](#transcript-writes-are-failing) | | `Transcript saving is off — CLAUDE_CODE_SKIP_PROMPT_HISTORY is set` | [Session saving warnings](#transcript-saving-is-off-skip-prompt-history) | @@ -5999,7 +6013,7 @@ Restored the code, but skipped 2 files: the tracked path is (or became) a link o ### No files were restored -Claude Code shows this message when you restore code with [`/rewind`](https://code.claude.com/docs/en/checkpointing) and it can't restore any of the files in that checkpoint. For each file, either the backup Claude Code saved before editing it is missing, or Claude Code couldn't write to or delete the file. +You see this message when a [`/rewind`](https://code.claude.com/docs/en/checkpointing) code restore fails on at least one file and restores no files. ```text theme={null} Failed to restore the code: diff --git a/content/en/docs/claude-code/google-vertex-ai.md b/content/en/docs/claude-code/google-vertex-ai.md index e6d7e1d62a..2e0b84ef41 100644 --- a/content/en/docs/claude-code/google-vertex-ai.md +++ b/content/en/docs/claude-code/google-vertex-ai.md @@ -11,9 +11,16 @@ View plans Contact sales +This page covers one of the two ways to use Claude through your Google Cloud project: Google Cloud's Agent Platform, formerly Vertex AI, which Google manages. + > [!NOTE] > -> This page covers one of the two ways to use Claude through your Google Cloud project: Google Cloud's Agent Platform, formerly Vertex AI, which Google manages. If you use Claude Models on Google Cloud (Anthropic managed), follow [its Claude Code setup page](https://code.claude.com/docs/en/claude-models-on-google-cloud-anthropic-managed.md) instead. To find out which one you use, see [Which offering are you using?](https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using) +> Use a different page in these cases: +> +> * **Claude Models on Google Cloud (Anthropic managed)**: follow [its Claude Code setup page](https://code.claude.com/docs/en/claude-models-on-google-cloud-anthropic-managed.md) +> * **Not sure which Google Cloud offering you use**: see [Which offering are you using?](https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using) +> * **Code tab, when your organization installed the Claude Desktop app**: ask your administrator to [configure the app for Agent Platform](https://claude.com/docs/third-party/claude-desktop/vertex) +> * **Code tab, when you install the Claude Desktop app yourself**: follow the [single-machine setup steps](https://claude.com/docs/third-party/claude-desktop/installation#single-machine-setup) and enter the [connection and model values for Agent Platform](https://claude.com/docs/third-party/claude-desktop/vertex#configure-the-app) ## Prerequisites diff --git a/content/en/docs/claude-code/managed-settings.md b/content/en/docs/claude-code/managed-settings.md index 027028f039..eb2be355b1 100644 --- a/content/en/docs/claude-code/managed-settings.md +++ b/content/en/docs/claude-code/managed-settings.md @@ -333,7 +333,7 @@ Three source states don't cause this refusal: * An empty managed settings file counts as `{}`. * A malformed value in the user-writable HKCU registry key never blocks launch. Claude Code reports it as a notice in `/status` and `claude doctor` instead. -When a managed settings file, drop-in file, `managed-settings.d/` directory, MDM profile, or HKLM registry value exists but can't be read, and no admin source supplies a policy, what happens depends on why the read failed: +If a managed settings file, drop-in file, `managed-settings.d/` directory, or MDM profile exists but can't be read and no admin source supplies a policy, sessions exit unless access was denied: * If the operating system denied the read, for example on a root-only file, every session starts without that source's policies. `/status` and `claude doctor` record the failure, and a run with `-p` also prints it to stderr. * For any other read failure, such as an I/O error, every session exits at startup with [a message to contact an administrator](https://code.claude.com/docs/en/errors.md#unable-to-read-managed-policy-settings). diff --git a/content/en/docs/claude-code/microsoft-foundry.md b/content/en/docs/claude-code/microsoft-foundry.md index 68e831d4f5..e0143192ec 100644 --- a/content/en/docs/claude-code/microsoft-foundry.md +++ b/content/en/docs/claude-code/microsoft-foundry.md @@ -11,6 +11,15 @@ View plans Contact sales +This page covers setting up Microsoft Foundry for the Claude Code CLI. + +> [!NOTE] +> +> To use Microsoft Foundry in the **Code** tab of the Claude Desktop app, you or your administrator configures the app: +> +> * **Your organization installed the app**: ask your administrator to [configure it for Microsoft Foundry](https://claude.com/docs/third-party/claude-desktop/foundry) +> * **You install the app yourself**: follow the [single-machine setup steps](https://claude.com/docs/third-party/claude-desktop/installation#single-machine-setup) and enter the [connection and model values for Microsoft Foundry](https://claude.com/docs/third-party/claude-desktop/foundry#configure-the-app) + ## Prerequisites Before configuring Claude Code with Microsoft Foundry, ensure you have: diff --git a/content/en/docs/claude-code/monitoring-usage.md b/content/en/docs/claude-code/monitoring-usage.md index 19a9264dd4..9e433ad80f 100644 --- a/content/en/docs/claude-code/monitoring-usage.md +++ b/content/en/docs/claude-code/monitoring-usage.md @@ -126,7 +126,7 @@ On machines with managed settings, see [How managed settings lock the OTLP desti | `OTEL_LOG_TOOL_DETAILS` | Enable logging of tool parameters and input arguments in tool events and trace span attributes: Bash commands, MCP server and tool names, skill names, user-authored workflow names, and tool input. Also enables custom, plugin, and MCP command names on `user_prompt` events, and real agent, skill, plugin, and MCP server and tool names on the [cost and token counters](#cost-counter) (default: disabled). For Claude Desktop's built-in servers, in sessions Claude Desktop owns, `mcp_server_name`/`mcp_tool_name` emit on `tool_decision`/`tool_result` even with the flag off. The exception requires Claude Code v2.1.214 or later | `1` to enable | | `OTEL_LOG_TOOL_CONTENT` | Enable logging of tool content in the [`tool.output` span event](#tool-output-span-event) (default: disabled). Span attributes carry tool content under [their own gates](#new-context-gates). Requires [tracing](#traces-beta). Content is truncated at the content limit (60 KB by default) | `1` to enable | | `OTEL_LOG_MANAGED_SETTINGS` | Add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to [managed settings resolved](#managed-settings-resolved-event) events (default: disabled). A value in project or local settings doesn't turn it on. Requires Claude Code v2.1.274 or later | `1` to enable | -| `OTEL_LOG_RAW_API_BODIES` | Emit the full Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events (default: disabled). Bodies include the entire conversation history. Enabling this implies consent to everything `OTEL_LOG_USER_PROMPTS`, `OTEL_LOG_TOOL_DETAILS`, and `OTEL_LOG_TOOL_CONTENT` would reveal | `1` for inline bodies truncated at the content limit (60 KB by default), or `file:` for untruncated bodies on disk with a `body_ref` pointer in the event | +| `OTEL_LOG_RAW_API_BODIES` | Emit the full Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events (default: disabled). Bodies can include the entire conversation history. Enabling this implies consent to everything `OTEL_LOG_USER_PROMPTS`, `OTEL_LOG_TOOL_DETAILS`, and `OTEL_LOG_TOOL_CONTENT` would reveal | `1` for inline bodies truncated at the content limit (60 KB by default), or `file:` for untruncated bodies on disk with a `body_ref` pointer in the event | | `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` | Content limit: the maximum length of content-bearing attributes such as model responses, tool content, system prompts, and raw API bodies, truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). The default is sized for backends that cap attribute values at 64 KB; raise it only if your backend accepts larger values, or lower it to cut telemetry volume. When an OpenTelemetry SDK attribute limit, `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` or one of its logrecord and span variants, is set lower, Claude Code truncates at that smaller value so the `[TRUNCATED ...]` marker stays within the SDK limit | `262144` | | `OTEL_RESOURCE_INCLUDE_HOST` | Add the machine's name and ID to the resource attributes of metrics, events, and traces (default: disabled). See [Identify the machine a session ran on](#identify-the-machine-a-session-ran-on). Requires Claude Code v2.1.326 or later | `1` to enable | | `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` | Metrics temporality preference (default: `delta`). Set to `cumulative` if your backend expects cumulative temporality | `delta`, `cumulative` | @@ -1572,7 +1572,7 @@ In an interactive session in a folder you haven't [trusted](https://code.claude. * `"force_refresh_failed"`: the settings fetch that [`forceRemoteSettingsRefresh`](https://code.claude.com/docs/en/settings-reference#forceremotesettingsrefresh) requires failed * `"gateway_rejected"`: a [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway) answered the managed settings load with HTTP 403 * `"version_below_minimum"`: this version of Claude Code is below [`requiredMinimumVersion`](https://code.claude.com/docs/en/settings-reference#requiredminimumversion) or above [`requiredMaximumVersion`](https://code.claude.com/docs/en/settings-reference#requiredmaximumversion) - * `"_OTHER"`: the Claude apps gateway managed settings load failed for another reason + * `"_OTHER"`: a cause that has no dedicated value, such as a gateway settings load that failed for another reason * `managed_settings.sources`: every managed source that delivers at least one [policy key](https://code.claude.com/docs/en/managed-settings.md#how-claude-code-combines-managed-sources), highest priority first, including sources whose keys don't take effect under `first-wins`. Values are `"remote"`, `"plist"` or `"hklm"` for the MDM or OS-level policy, `"file"` for managed settings files and drop-ins, `"parent"` when an [embedding host](https://code.claude.com/docs/en/managed-settings.md#let-an-embedding-host-add-policy) supplies settings, and `"hkcu"` for the [Windows HKCU registry value](https://code.claude.com/docs/en/managed-settings.md#where-each-mechanism-stores-the-policy) when Claude Code [reads it](https://code.claude.com/docs/en/managed-settings.md#how-claude-code-combines-managed-sources). A source that carries only control keys, or that Claude Code couldn't read, isn't listed. Emitted as an array of strings, empty when no managed source delivers a policy key * `managed_settings.source_behavior`: the [`managedSourcesBehavior`](https://code.claude.com/docs/en/settings-reference#managedsourcesbehavior) value Claude Code read, `"first-wins"` or `"merge"`. `"first-wins"` when no source sets the key * `managed_settings.helper.state`: state of the policy helper that the selected MDM or file source configures: @@ -1876,7 +1876,10 @@ For a comprehensive guide on measuring return on investment for Claude Code, inc * The [cost and token counters](#cost-counter) and the `api_request`, `api_error`, and `api_refusal` events carry real agent, skill, plugin, and MCP server and tool names in their attribution attributes * The `claude_code.tool` span carries input-derived attributes such as `file_path`. Under detailed beta tracing it also carries a [`tool_input`](#new-context-gates) attribute * Tool content is not logged in trace spans by default. To include it, set `OTEL_LOG_TOOL_CONTENT=1`. The `claude_code.tool` span then carries a [`tool.output` span event](#tool-output-span-event) with raw file contents, Bash command output, and what MCP tools, WebFetch, and WebSearch return, truncated at the content limit (60 KB by default) per attribute. Results from MCP tools, WebFetch, and WebSearch require Claude Code v2.1.283 or later. Tool content also reaches spans through [`new_context`, whose gate differs per span](#new-context-gates). Configure your telemetry backend to filter or redact these attributes as needed -* Raw Anthropic Messages API request and response bodies are not logged by default. To include them, set `OTEL_LOG_RAW_API_BODIES` in your shell, user settings, or managed settings. It's ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env). The bodies contain the full conversation history, including the system prompt, every prior user and assistant turn, and tool results, so enabling this implies consent to everything the other `OTEL_LOG_*` content flags would reveal. Claude Code always redacts Claude's extended-thinking content from these bodies, regardless of other settings. The value you set determines how Claude Code delivers the bodies: +* Raw Anthropic Messages API request and response bodies aren't logged by default. To include them, set `OTEL_LOG_RAW_API_BODIES` in your shell, user settings, or managed settings. It's ignored in [project and local settings](https://code.claude.com/docs/en/settings-reference.md#variables-claude-code-ignores-in-env). + + The bodies can contain the full conversation history, including the system prompt, every prior user and assistant turn, and tool results. Enabling this implies consent to everything the other `OTEL_LOG_*` content flags would reveal. Claude Code always redacts Claude's extended-thinking content from these bodies, regardless of other settings. The value you set determines how Claude Code delivers the bodies: + * With `=1`, Claude Code emits `api_request_body` and `api_response_body` log events for each API call. The events' `body` attribute carries the JSON-serialized payload, truncated at the content limit (60 KB by default) * With `=file:`, Claude Code writes untruncated bodies to `.request.json` and `.response.json` files under that directory, and the events carry a `body_ref` path instead of the inline body. Ship the directory with a log collector or sidecar rather than through the telemetry stream. diff --git a/content/en/docs/claude-code/plugins/mods/interface.md b/content/en/docs/claude-code/plugins/mods/interface.md index 2dc107f6da..2d537a7837 100644 --- a/content/en/docs/claude-code/plugins/mods/interface.md +++ b/content/en/docs/claude-code/plugins/mods/interface.md @@ -213,7 +213,7 @@ Claude Code draws most of its interface itself: messages, tool call rows, the sp | `InfoNotice`, `SessionMode`, `PromptHint` | Status lines under the logo, the mode labels in the footer, and the hint line under the prompt | | `AgentRow` | A subagent's or teammate's row in the agent panel | -`Pane`, `AskUserQuestion`, `Spinner`, `UserMessage`, `AssistantMessage`, and the tool call sites work in the terminal, the Desktop app, and the VS Code extension. The [render sites table](https://code.claude.com/docs/en/plugins/mods/reference.md#render-sites) lists where each of the others is raised. +`Pane`, `AbovePrompt`, `AskUserQuestion`, `Spinner`, `UserMessage`, `AssistantMessage`, and the tool call sites work in the terminal, the Desktop app, and the VS Code extension. The [render sites table](https://code.claude.com/docs/en/plugins/mods/reference.md#render-sites) lists where each of the others is raised. At a site Claude Code already draws, your hook can change a detail, replace the drawing, or leave it alone. Select a tab to see each one applied to the spinner. The examples read a `calls` variable that another hook counts, as in the [tutorial mod](https://code.claude.com/docs/en/plugins/mods/create.md#write-a-mod-yourself). diff --git a/content/en/docs/claude-code/plugins/mods/reference.md b/content/en/docs/claude-code/plugins/mods/reference.md index 07aa753ee4..bdeea3d1ac 100644 --- a/content/en/docs/claude-code/plugins/mods/reference.md +++ b/content/en/docs/claude-code/plugins/mods/reference.md @@ -59,6 +59,7 @@ Tool events fire around each tool call Claude makes, from the description Claude | `tool.judge` | [Auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) is about to ask its classifier about a call. Requires Claude Code v2.1.326 or later. | `next(e)` or `{ decision }` | | `tool.run` | An allowed call is about to run. Requires Claude Code v2.1.326 or later. | `next(e)`, `{ deny: reason }`, or `{ result }` | | `tool.describe` | Once for each tool, when its description is first sent to Claude. A second time for an MCP tool when Claude loads it through [tool search](https://code.claude.com/docs/en/mcp.md#scale-with-mcp-tool-search), with `e.description` set to the text Claude reads for the loaded tool. | `{ description }`, optionally with `isDeferred` set to `true` to put the tool behind tool search or `false` to load it upfront. Add [`breakPromptCache: true`](#break-prompt-cache) to send a changed description on the next turn. | +| `tool.offer` | Claude Code builds Claude's tool list, and again when Claude calls a tool. Requires Claude Code v2.1.328 or later. | `next(e)`, or `{ isOffered: false }` to withhold the tool from Claude. See [Send a changed tool list](#send-a-changed-tool-list). | #### Agent and organization fields on `tool.check` @@ -115,6 +116,10 @@ To change a section or a tool description in a running conversation, call `$.ui. The changed text reaches Claude on the next turn, and the [prompt cache](https://code.claude.com/docs/en/prompt-caching.md) starts over, so that turn is slower and more expensive. The field requires Claude Code v2.1.321 or later. From v2.1.299 until v2.1.321, a running conversation got the changed text on the next turn. +#### Send a changed tool list + +To change the main conversation's tool list, call `$.ui.invalidate('tool.offer')` and return `{ isOffered, breakPromptCache: true }` from your `tool.offer` hook. The [prompt cache](https://code.claude.com/docs/en/prompt-caching.md) then starts over. Requires Claude Code v2.1.331 or later. + ### Commands and configuration | Event | Fires when | A hook can return | @@ -243,7 +248,7 @@ The mods API is the `$` argument every hook receives. Its methods are grouped in | [`$.model`](https://code.claude.com/docs/en/plugins/mods/api#call-a-model) | `complete`, `fork`, `classify` | | [`$.prompt`](https://code.claude.com/docs/en/plugins/mods/api#start-a-turn-from-a-background-job) | `submit`, `read`, `fill`, `suggest`, `compose`. Claude reads text from `submit({ text })` after a sentence that names your mod as the sender. `submit({ text, asUser: true })` sends the text as the user's own words, without that sentence. | | `$.turn` | `abort` | -| [`$.session`](https://code.claude.com/docs/en/plugins/mods/api#send-and-receive-messages-between-sessions) | `messages`, `cwd`, `root`, `model`, `turns`, `id`, `repo`, `surfaces`, `usage`, `version`, `info`, `compact`, `send`, `append`, `authorize`. `info` requires Claude Code v2.1.326 or later. `usage()` returns `{ startedAt, context, rateLimits, cost }`: `context` has `tokens`, `window`, and `percent`, and `rateLimits` is a list of `{ kind, percentUsed, resetsAt }`. | +| [`$.session`](https://code.claude.com/docs/en/plugins/mods/api#send-and-receive-messages-between-sessions) | `messages`, `cwd`, `root`, `model`, `turns`, `id`, `repo`, `surfaces`, `usage`, `version`, `info`, `compact`, `send`, `append`, `authorize`, `redact`. `info` requires Claude Code v2.1.326 or later. `redact`, a best-effort mask for credentials only, requires v2.1.331 or later. `usage()` returns `{ startedAt, context, rateLimits, cost }`: `context` has `tokens`, `window`, and `percent`, and `rateLimits` is a list of `{ kind, percentUsed, resetsAt }`. | | `$.config` | `list`, `set` | | [`$.settings`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `read` | | [`$.env`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `get`, `set` | @@ -267,8 +272,11 @@ Rendering in the VS Code extension requires extension version 2.1.299 or later. | Site | `e.props` | `e.requestId` | Rendered on | | :- | :- | :- | :- | | [`Pane`](https://code.claude.com/docs/en/plugins/mods/interface#pick-where-to-draw) | `title`, `isFocused`, `bodyColumns`, `placement`, `scroll`, `view` | The pane's `id` | Terminal, Desktop, VS Code | -| [`AbovePrompt`](https://code.claude.com/docs/en/plugins/mods/interface#pick-where-to-draw) | `hasSurvey`, [`isCollapsed`](https://code.claude.com/docs/en/plugins/mods/interface#when-the-user-collapses-the-band), `isWorking`, `maxRows`, `bodyColumns`, `scroll`, `view` | One instance | Terminal, Desktop | -| `AbovePromptList`, the stack of `AbovePrompt` rows | `rows`, a list with one `{ plugin, tree }` for each mod's row, plus the `AbovePrompt` props | One instance | Terminal, Desktop. Requires Claude Code v2.1.323 or later. | +| [`AbovePrompt`](https://code.claude.com/docs/en/plugins/mods/interface#pick-where-to-draw) | `hasSurvey`, [`isCollapsed`](https://code.claude.com/docs/en/plugins/mods/interface#when-the-user-collapses-the-band), `isWorking`, `maxRows`, `bodyColumns`, `scroll`, `view` | One instance | Terminal, Desktop, VS Code | +| `AbovePromptList`, the stack of `AbovePrompt` rows | `rows`, a list with one `{ plugin, tree }` for each mod's row, plus the `AbovePrompt` props | One instance | Terminal, Desktop, VS Code. Requires Claude Code v2.1.323 or later. | +| `BesidePrompt`, a cell to the right of the prompt | `maxColumns`, `floatRows`, `floatColumns`, `isWorking`, `view` | One instance | Terminal in [fullscreen rendering](https://code.claude.com/docs/en/fullscreen.md), Desktop. Requires Claude Code v2.1.331 or later. | +| `Underlay`, a layer visible only where the interface is blank | `columns`, `rows`, `isWorking`, `view` | `site:underlay` | Terminal in fullscreen rendering. Requires Claude Code v2.1.331 or later. | +| `BesidePromptList` and `UnderlayList`, the order of the `BesidePrompt` cells and `Underlay` layers | `plugins` | One instance | The same apps as the site it orders. Requires Claude Code v2.1.331 or later. | | [`Placed`](https://code.claude.com/docs/en/plugins/mods/interface#place-a-row-in-the-transcript) | `id`, `plugin`, `onScreen` | The `requestId` that `$.ui.place` returned | Terminal | | [`Backdrop`](https://code.claude.com/docs/en/plugins/mods/interface#put-a-backdrop-behind-the-conversation) | `scene`, `plugin`, `glass`, `overrideColorScheme`. Before v2.1.323, `scene` was `id` and `overrideColorScheme` was `colorScheme`. | `backdrop` | `desktop` and `mobile` surfaces. Your hook runs when the Desktop or mobile app asks to draw a backdrop. | | `UserMessage` | `text`, `origin`, `isExpanded`, and `task` or `from` by origin | The drawn row's id | Terminal, Desktop, VS Code | @@ -428,6 +436,7 @@ Hooks and mods API calls run under time and size limits. Claude Code skips a hoo | PNG or RGBA bytes of all the `Image`s in one tree | 2 MiB | | `$.store` | 4 MiB of JSON in total | | `$.session.messages()` | The newest 4,096 entries | +| Text passed to `$.session.redact` | 100,000 characters. A call with longer text rejects. | | `$.ui.invalidate('ui.render')` redraws | Throttled to 10 a second, or 30 in the terminal for the visible pane, the expanded band, and the hint line under the prompt. Calls that come sooner are coalesced. | | `$.ui.toast` | Shown for 4 seconds unless you pass `{ timeoutMs }`. In the [classic renderer](https://code.claude.com/docs/en/fullscreen.md#enable-fullscreen-rendering), a mod's newer toast can [take the place of its older one](https://code.claude.com/docs/en/plugins/mods/troubleshoot.md#a-toast-doesn’t-appear) that's showing or waiting to show. | | A pane opened without the user asking | Placed from 144 terminal columns, 110 after they've opened it once | diff --git a/content/en/docs/claude-code/plugins/mods/troubleshoot.md b/content/en/docs/claude-code/plugins/mods/troubleshoot.md index 685eaa59fb..aa782cab85 100644 --- a/content/en/docs/claude-code/plugins/mods/troubleshoot.md +++ b/content/en/docs/claude-code/plugins/mods/troubleshoot.md @@ -12,7 +12,7 @@ When a mod's module or one of its hooks fails, Claude Code skips it and the sess When a mod does nothing, check what Claude Code reads from the mod's files, and the line it writes when it skips something. For the first, in your shell run [`claude plugin validate`](https://code.claude.com/docs/en/plugins/mods/create#check-what-claude-code-reads-from-your-mod) with the mod's directory, as in `claude plugin validate ./first-mod`. It catches a misspelled event, a bad manifest, and a module Claude Code can't read, without starting a session. -When a module doesn't load, a hook is skipped, or another mod refuses yours, Claude Code writes one line that names your mod. Where you read that line depends on the session: +Claude Code writes one line naming your mod in cases such as a code error that stops it from loading, a skipped hook, or a refusal by another mod. Look for that line in the transcript, the debug log, or stderr, by session type: * **A session that hot-reloads a plugin directory**: a dim line in the transcript. That's an interactive session you started with `--plugin-dir`, or one where [hot reloading is on](https://code.claude.com/docs/en/plugins/mods/create.md#ask-claude-for-a-mod) for mods Claude wrote. * **Any other interactive session, such as one that runs a mod you installed from a marketplace**: the [debug log](#read-the-debug-log). To get one, start the session with `claude --debug`. diff --git a/content/en/docs/claude-code/plugins/troubleshooting.md b/content/en/docs/claude-code/plugins/troubleshooting.md index 2a422ab2fc..be778b864f 100644 --- a/content/en/docs/claude-code/plugins/troubleshooting.md +++ b/content/en/docs/claude-code/plugins/troubleshooting.md @@ -856,10 +856,10 @@ A plugin's hooks don't run, or one blocks an action. Either the **Errors** tab s #### Hooks fail to load -The **Errors** tab shows one of these messages: +The **Errors** tab or `claude plugin list` shows messages such as these: -* **`Couldn't load hooks from : `** or **`Failed to load hooks from : `**: fix the problem that `` names, such as invalid JSON or a missing top-level `hooks` key. To catch a JSON syntax problem in `hooks/hooks.json` before you publish the plugin, run `claude plugin validate ` in your shell -* **`hooks path not found: `**: the manifest's `hooks` field names a file that doesn't exist at that path relative to the plugin root. Fix the path or add the file +* **`Couldn't load hooks from `**, **`Failed to load hooks from `**, or **`Hook load failed`**: fix the named problem, such as invalid JSON or a missing top-level `hooks` key. To catch a JSON syntax problem in `hooks/hooks.json` before you publish the plugin, run `claude plugin validate ` in your shell +* **`hooks path not found: `** or **`Path not found: (hooks)`**: no file exists at ``. Fix the path or add the file * **`hooks path escapes plugin directory: `**: see [Path escapes plugin directory](https://code.claude.com/docs/en/errors.md#path-escapes-plugin-directory) #### `hook error` notices in the transcript @@ -1184,6 +1184,11 @@ An install was refused with this line, an enable with the same line ending `cann Managed settings block this plugin, its marketplace, or a dependency it needs. Ask your administrator which entry applies. A blocked dependency means the plugin can't install until the dependency's marketplace is allowed. +When you install from `/plugin`, ask your administrator about other forms of the message too, such as: + +* `Plugin "" is blocked by your organization's policy and can't be installed` +* `Can't install "": dependency "" is blocked by your organization's policy` + ### `--plugin-dir is disabled by your organization's managed settings (disableSideloadFlags)` You started `claude` with `--plugin-dir`, `--plugin-url`, `--agents`, or `--mcp-config`. Claude Code exited with this message and `Plugins, custom agents, and MCP servers can only be loaded from sources your administrator has approved.` diff --git a/content/en/docs/claude-code/pr-steward-setup.md b/content/en/docs/claude-code/pr-steward-setup.md index dad53dc629..41f003ffe0 100644 --- a/content/en/docs/claude-code/pr-steward-setup.md +++ b/content/en/docs/claude-code/pr-steward-setup.md @@ -147,11 +147,11 @@ Choose an environment for PR Steward when it needs more to build and test your c To add a setup script, environment variables, or different network access, use an [organization-shared environment](https://code.claude.com/docs/en/cloud-environments.md#organization-shared-environments). On the **Claude Ship** page, select a **Default environment** under **Where it runs**. To override it for one repository, click **Change** beside **Environment** in the **Edit** dialog. -With neither set, PR Steward can use your organization's [default environment](https://code.claude.com/docs/en/cloud-environments.md#the-default-environment). Without one, it runs in an Anthropic-hosted environment with no setup script and no environment variables. +With neither set, PR Steward can use your organization's [default environment](https://code.claude.com/docs/en/cloud-environments.md#the-default-environment). If that default is [self-hosted](#run-pr-steward-in-a-self-hosted-environment), select it or another environment for PR Steward under **Where it runs**. Until you do, pull requests can get a [comment that PR Steward hasn't started](https://code.claude.com/docs/en/pr-steward-troubleshooting.md#pr-steward-posted-a-comment-that-says-why). If your organization has no default, PR Steward runs in an Anthropic-hosted environment with no setup script and no environment variables. ### Run PR Steward in a self-hosted environment -For the environment that PR Steward runs in, you can select a [self-hosted environment](https://code.claude.com/docs/en/self-hosted-environments). The [limits on approvals and merges](https://code.claude.com/docs/en/pr-steward-security.md#limits-on-approvals-and-merges) are described for Anthropic-hosted sessions only. On a runner without [Anthropic-managed git](https://code.claude.com/docs/en/self-hosted-environments-deploy.md#use-the-anthropic-git-proxy), PR Steward pushes with the runner's own git credentials. +For the environment that PR Steward runs in, you can select a [self-hosted environment](https://code.claude.com/docs/en/self-hosted-environments). Its runners need Claude Code v2.1.317 or later. The [limits on approvals and merges](https://code.claude.com/docs/en/pr-steward-security.md#limits-on-approvals-and-merges) are described for Anthropic-hosted sessions only. On a runner without [Anthropic-managed git](https://code.claude.com/docs/en/self-hosted-environments-deploy.md#use-the-anthropic-git-proxy), PR Steward pushes with the runner's own git credentials. > [!WARNING] > diff --git a/content/en/docs/claude-code/pr-steward-troubleshooting.md b/content/en/docs/claude-code/pr-steward-troubleshooting.md index a4a0482038..8bd3beea6c 100644 --- a/content/en/docs/claude-code/pr-steward-troubleshooting.md +++ b/content/en/docs/claude-code/pr-steward-troubleshooting.md @@ -61,6 +61,9 @@ If PR Steward commented and didn't start, find the comment's words here: | `PR Steward didn't start: only someone with write access` | Have a person with write access add the `claude-pr-steward-watching` label or comment `@claude steward` | | `PR Steward hasn't started: your organization has no extra usage available` | Ask an Owner to add usage credits or raise the spend limit in [**Organization settings > Usage**](https://claude.ai/admin-settings/usage). If you asked PR Steward to start, it then starts when you ask again. Otherwise, it starts at the next push | | `PR Steward hasn't started: billing for PR Steward isn't set up` | Ask an Owner to pick a repository where PR Steward is on and [change its **Steward** setting](https://code.claude.com/docs/en/pr-steward-setup.md#choose-when-pr-steward-starts-in-each-repository) to another option than **Off**. They can change it back straight away | +| `PR Steward hasn't started: your Claude organization hasn't picked where it runs yet` | Ask an Owner to [select an environment for PR Steward](https://code.claude.com/docs/en/pr-steward-setup.md#choose-the-environment-pr-steward-runs-in), then comment `@claude steward` | +| `PR Steward hasn't started: it can't use the environment that your Claude organization picked for it` | Ask an Owner to [select another environment for PR Steward](https://code.claude.com/docs/en/pr-steward-setup.md#choose-the-environment-pr-steward-runs-in), then comment `@claude steward` | +| `PR Steward hasn't started: the self-hosted runners it would run on need Claude Code 2.1.317 or newer` | Ask whoever runs your [self-hosted environment](https://code.claude.com/docs/en/pr-steward-setup.md#run-pr-steward-in-a-self-hosted-environment) to [update its runners](https://code.claude.com/docs/en/self-hosted-environments-deploy.md#pin-the-version), then comment `@claude steward` | | `Claude PR Steward couldn't start, so it isn't watching this pull request` | Add the label or comment `@claude steward` to try again | | `Claude PR Steward couldn't start on this pull request because the setup script` | Ask someone who can edit the [environment that PR Steward runs in](https://code.claude.com/docs/en/pr-steward-setup.md#choose-the-environment-pr-steward-runs-in) to fix its setup script, then start PR Steward again | | `this repository has PR Steward enabled in more than one Claude workspace` | Ask the Owners to keep the repository in one Claude organization and remove it from the others | diff --git a/content/en/docs/claude-code/prompt-caching.md b/content/en/docs/claude-code/prompt-caching.md index c4959b9287..b6a0c5849d 100644 --- a/content/en/docs/claude-code/prompt-caching.md +++ b/content/en/docs/claude-code/prompt-caching.md @@ -88,7 +88,9 @@ The [`opusplan` model setting](https://code.claude.com/docs/en/model-config#opus [Automatic model fallback](https://code.claude.com/docs/en/model-config.md#automatic-model-fallback) on Fable models, Opus 5.5, Sonnet 5.5, and Opus 5 is also a model switch. When a safety classifier flags a request in a category that has a fallback model and Claude Code re-runs the request on that model, the session continues there. -When a skill or command's frontmatter names a [`model`](https://code.claude.com/docs/en/skills#frontmatter-reference) other than the session's current model, that turn is also a model switch: the next request reads the entire conversation history with no cache hits. The session model resumes on your next prompt. A `context: fork` skill sets the [forked subagent's model](https://code.claude.com/docs/en/skills.md#run-skills-in-a-subagent) instead. +#### Skills and commands that set a model + +When a skill or command's [`model` value applies](https://code.claude.com/docs/en/skills#frontmatter-reference) and differs from the session's current model, that turn is a model switch. The next request reads the entire conversation history with no cache hits. The session model resumes on your next prompt. With `context: fork`, the value goes to a [subagent](https://code.claude.com/docs/en/skills.md#run-skills-in-a-subagent) with [its own cache](#subagents-and-the-cache) instead. ### Changing effort level @@ -240,7 +242,7 @@ Before v2.1.251, a mid-session style switch kept the cache but didn't apply unti ### Invoking skills and commands -[Skills](https://code.claude.com/docs/en/skills.md) and [commands](https://code.claude.com/docs/en/commands.md) inject their instructions as user messages at the point of invocation. Nothing earlier in the conversation changes. A skill or command whose frontmatter names a `model` can be a [model switch](#switching-models) for that turn. +[Skills](https://code.claude.com/docs/en/skills.md) and [commands](https://code.claude.com/docs/en/commands.md) inject their instructions as user messages at the point of invocation. Nothing earlier in the conversation changes. A skill or command whose [`model` value applies](https://code.claude.com/docs/en/skills#frontmatter-reference) can be a [model switch](#switching-models) for that turn. ### Running `/recap` diff --git a/content/en/docs/claude-code/ship-command-troubleshooting.md b/content/en/docs/claude-code/ship-command-troubleshooting.md index b7ea16fd33..74b7ba70ef 100644 --- a/content/en/docs/claude-code/ship-command-troubleshooting.md +++ b/content/en/docs/claude-code/ship-command-troubleshooting.md @@ -34,7 +34,8 @@ On your own machine, take these steps: 1. Run `claude update` in your shell, then quit and start `claude` again. 2. If `/ship` is still missing, quit and start `claude` once more, because a new feature [can take a second start](https://code.claude.com/docs/en/env-vars.md#first-session-after-an-install-or-upgrade) to show. 3. Run `/status` at the Claude Code prompt. Its `Setting sources` line lists the settings that loaded. In each one that's your own [settings file](https://code.claude.com/docs/en/settings.md#find-or-create-your-settings-files), remove [`disableBundledSkills`](https://code.claude.com/docs/en/settings-reference#disablebundledskills) and any `ship-local` entry under [`skillOverrides`](https://code.claude.com/docs/en/skills#override-skill-visibility-from-settings). To change managed settings, ask your administrator. -4. Check whether your session [skips feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching), for example because `DISABLE_TELEMETRY` is set or you use a third-party provider. `/ship` isn't available in those sessions. +4. Check whether your session [skips feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching). On a third-party provider or in a Claude apps gateway session, `/ship` requires Claude Code v2.1.331 or later. In any other session, unset any variable that turns fetching off, such as `DISABLE_TELEMETRY`. +5. Check whether [`CLAUDE_CODE_DISABLE_SHIP`](https://code.claude.com/docs/en/env-vars#variables) is set, in your shell or under `env` in a settings file. Unset it, then quit and start `claude` again. The variable requires Claude Code v2.1.331 or later. ### A skillOverrides entry turns off /ship or /steward @@ -49,8 +50,12 @@ Find the opening words of the message: | `This session was started by another session` | Run it in a session that you started yourself | | `Usage: /ship` or `Usage: /steward` | Check what you typed against [the arguments](https://code.claude.com/docs/en/ship-command.md#arguments-for-%2Fship-and-%2Fsteward) | | `Nothing started. /ship starts only from a line that you type`, or the same for `/steward` | Type the command yourself at the Claude Code prompt. It doesn't start from `claude -p` or from a program | -| `/ship didn't start:` or `/steward didn't start:` | The rest of the message says what to check | -| `/ship is turned off right now`, or the same for `/steward` | Run `/login` at the Claude Code prompt, as the message says, then run the command again | +| `Nothing started. This line counts only if you type it yourself` | You accepted a [prompt suggestion](https://code.claude.com/docs/en/interactive-mode.md#prompt-suggestions). Type the command yourself at the Claude Code prompt | +| `Nothing started. Claude Code's built-in /ship is turned off while`, or the same for `/steward` | Unset the variable that the message names, such as `CLAUDE_CODE_DISABLE_SHIP`, then start Claude Code again | +| `Nothing started. Claude Code's built-in /ship doesn't start in this kind of session`, or the same for `/steward` | You typed it somewhere such as `claude -p`. Run `claude` in a terminal and type the command there | +| `Nothing started. /ship is a command built into Claude Code`, or the same for `/steward` | Another command, such as a plugin's, has the same name. To run the built-in command, type the same line again. To run the other one, follow the message, which gives its name or says where to find it | +| `/ship didn't start:` or `/steward didn't start:` | The rest of the message says what to check. In plan mode, for example, press `Shift+Tab` to leave plan mode, then run the command again | +| `/ship is turned off right now`, or the same for `/steward` | If the message says to run `/login`, do that at the Claude Code prompt, then run the command again. Otherwise, one cause is that `CLAUDE_CODE_DISABLE_SHIP` was set after the session started, for example under `env` in a settings file. Unset it, quit and start `claude` again, then run the command | | `/ship can't start from a queued message` or `/steward can't start from a queued message` | Wait until Claude has finished, then run it again | ### The GitHub CLI isn't ready @@ -61,10 +66,11 @@ Find the opening words of the message: | :- | :- | | `GitHub CLI (gh) isn't installed` or `GitHub CLI (gh) isn't signed in` | Install it, run `gh auth login` in your shell, then run the command again | | `gh couldn't tell me about a pull request here` | The words in parentheses say what failed. To see `gh`'s own error, run `gh pr view` in your shell. One cause is that none of your checkout's remotes is on a GitHub host that `gh` is signed in to. For GitHub Enterprise, run `gh auth login --hostname HOST` in your shell | +| `I can't watch the branch with git alone` | None of your checkout's remotes is on a GitHub host that `gh` is signed in to. For GitHub Enterprise, run `gh auth login --hostname HOST` in your shell, then run the command again. On another host, the words after the colon say what to fix, such as pushing the branch first. See [Watch a branch on another host](https://code.claude.com/docs/en/ship-command.md#watch-a-branch-on-another-host) | ## /ship committed or pushed nothing -In some cases, `/ship` leaves the commit or the push to you and says why. Its message can start with `Nothing committed or pushed`, `Nothing pushed`, `I didn't push anything`, `There is no pull request to watch`, or `This branch has no open pull request`. +In some cases, `/ship` leaves the commit or the push to you and says why. Its message can start with `Nothing committed or pushed`, `Nothing pushed`, `I didn't push anything`, `There is no pull request to watch`, or `This branch has no open pull request`. On a host other than GitHub, `/ship` doesn't commit or push when it starts, so see [Watch a branch on another host](https://code.claude.com/docs/en/ship-command.md#watch-a-branch-on-another-host). Find your case, take the step in its row, then run `/ship` again. In these cases, if nothing is pushed and the branch has no pull request, Claude reviews your change and [no watch starts](#no-watch-started). @@ -85,8 +91,8 @@ Find your case, take the step in its row, then run `/ship` again. In these cases | Case | What to do | | :- | :- | -| `there is nothing here to open one for`: you have no uncommitted changes, and every commit on the branch is already on the default branch | Make a change, or check out the branch that holds your work | -| The default branch holds your commits, and nothing is uncommitted | Move the commits to a new branch, for example with `git switch -c ` in your shell | +| `there is nothing here to open one for`: you have no uncommitted changes, and every commit on the branch is already on the default branch, or merging them would change nothing there | Make a change, or check out the branch that holds your work | +| `you're on the default branch, which /ship never pushes` | Move your commits to a new branch, for example with `git switch -c ` in your shell | | You're in detached HEAD state, or in the middle of a rebase | Check out a branch, or finish the rebase | ### Deny rules that forbid a commit or push @@ -95,6 +101,17 @@ A [deny rule](https://code.claude.com/docs/en/permissions.md#manage-permissions) A watch needs `git commit` and `git push` as well. If the rule forbids one of them, [have it removed](#a-tool-rule-or-hook-blocks-a-watch) before you run `/ship` again. +### Your pull request is already open + +Messages such as these mean that `/ship` left newer work off your open pull request: + +| Message | What it means | What to do | +| :- | :- | :- | +| `/ship didn't commit your uncommitted work` | Causes include a public repository, auto-merge turned on, and a merge or cherry-pick in progress. If [no watch can start](#no-watch-started), the review covers your uncommitted work. Otherwise, a review doesn't cover it, and your unpushed commits [can go up with Claude's next push](https://code.claude.com/docs/en/ship-command.md#keep-working-while-a-watch-runs) | If the message gives a `git push` line, commit the work yourself, then run that line. Otherwise, run `/ship` again when the message says to | +| `Nothing pushed` or `Nothing committed or pushed`, with a sentence about your unpushed commits | `/ship` held those commits back. No review or watch starts, and a running watch on that pull request ends. One cause is a file in them with a name such as `password.txt` | If the commits should go up, run the `git push` line in the message. If not, take the file out of every unpushed commit. Then run `/ship` again | + +Before v2.1.331, `/ship` prints neither message. It doesn't commit your uncommitted work once a pull request is open, so commit it, then push it, as in `git push origin ` in your shell. It doesn't hold back your unpushed commits, which [can go up with Claude's next push](https://code.claude.com/docs/en/ship-command.md#keep-working-while-a-watch-runs). + ### GitHub Enterprise and forks `/ship` doesn't open a pull request on GitHub Enterprise or from a fork. Push the branch and open the pull request yourself, then run `/ship`. From a fork, the checkout also needs a remote for the repository that the pull request goes to, or no watch starts. @@ -103,7 +120,7 @@ A watch needs `git commit` and `git push` as well. If the rule forbids one of th A watch is Claude's ongoing work on your pull request, which starts after `/ship`'s review or when you type `/steward`. In some cases, no watch starts and Claude says why. Its message can contain `/steward didn't start.`, `I can't watch`, or `is running on pull request`. -Fix the cause, then type `/steward` to start the watch with no second review, or `/ship` if the branch still has no pull request. +Fix the cause, then type `/steward` to start the watch with no second review. On a host other than GitHub, add any base that you named, as in `/steward origin/main`. If a branch on GitHub still has no pull request, type `/ship`. ### Your pull request or branch isn't ready for a watch @@ -111,7 +128,7 @@ Check the pull request and your checkout first: | Cause | What to do | | :- | :- | -| The branch has no pull request, and `/steward` doesn't open one | See [/ship committed or pushed nothing](#%2Fship-committed-or-pushed-nothing) | +| On GitHub, the branch has no pull request, and `/steward` doesn't open one | See [/ship committed or pushed nothing](#%2Fship-committed-or-pushed-nothing) | | The pull request's branch isn't checked out in this session | Check it out | | The pull request carries one of [PR Steward](https://code.claude.com/docs/en/pr-steward.md)'s labels, such as `claude-pr-steward-watching` | To take over, remove the label and pull the branch, as Claude's message says | @@ -123,16 +140,19 @@ Some settings of the session keep a watch from starting: | :- | :- | | The session is in `bypassPermissions` mode | Press `Shift+Tab` to switch to a permission mode other than plan mode | | [Remote Control](https://code.claude.com/docs/en/remote-control.md) is on | Run `/rc`, then select **Disconnect this session** | -| `your PATH has a relative or empty entry` | `/ship` with no pull request number reviews your change, and doesn't commit, push, or look for a pull request. Take the empty or relative entry out of `PATH`, such as a trailing `:`, or `;` on Windows. Start `claude` again, then run `/ship` | +| `this session runs in the background` | Open a new terminal in the checkout that holds the branch, run `claude`, and type `/steward` there | +| A message about an entry `on your PATH`, such as `entry 2 of 9 on your PATH is empty (a stray colon)` | Take the entry out of `PATH`, or write it as a full path, in your shell's profile and in any `env` block of your Claude Code settings that sets `PATH`. Quit Claude Code, start it again from a new terminal, then type `/steward` | +| `your PATH has a relative or empty entry` | Before v2.1.331, `/ship` with no pull request number reviews your change, and doesn't commit, push, or look for a pull request. Take the empty or relative entry out of `PATH`, such as a trailing `:`, or `;` on Windows. Start `claude` again, then run `/ship` | | Your `PATH` holds a folder inside the checkout. This happens, for example, when you activate a Python virtual environment that's in the checkout, or start `claude` through `npx` or a package script | To start a session without that folder, run `deactivate` in your shell if you use a virtual environment, then start `claude` directly | ### A tool, rule, or hook blocks a watch -A watch needs `gh`, `git commit`, and `git push`, and it doesn't start where a project's hook could approve commands: +A watch on a GitHub pull request needs `gh`, `git commit`, and `git push`, and it doesn't start where a project's hook could approve commands: | Cause | What to do | | :- | :- | | `gh` isn't installed or signed in | See [The GitHub CLI isn't ready](#the-github-cli-isn’t-ready) | +| `this gh is too old for a watch` | Update the GitHub CLI to 2.63 or later, then type `/steward` | | A deny rule forbids a command that the watch needs, such as `git push` | Claude's message names the command and the settings that hold the rule. If whoever set it agrees, remove it there. To change a rule in managed settings, ask your administrator | | The project sets a hook that could approve commands, for example a `PreToolUse` or `PermissionRequest` [hook](https://code.claude.com/docs/en/hooks.md) on shell commands in the checkout's `.claude/settings.json` | The message names the file and says what to change | @@ -141,12 +161,12 @@ A watch needs `gh`, `git commit`, and `git push`, and it doesn't start where a p In these cases, `/ship` can still review your change: * You're on native Windows -* Someone else opened the pull request -* You can't push to the repository that the pull request goes to, and another person has commented or reviewed. If this happens while a watch is running, the watch ends +* On GitHub, someone else opened the pull request +* On GitHub, you can't push to the repository that the pull request goes to, and another person has commented or reviewed. If this happens while a watch is running, the watch ends ## A watch stopped -A watch is Claude's ongoing work on your pull request, which starts after `/ship`'s review or when you type `/steward`. After one ends, look for a line that starts `Stopped watching pull request`, which gives the reason. +A watch is Claude's ongoing work on your pull request, which starts after `/ship`'s review or when you type `/steward`. After one ends, look for a line that starts `Stopped watching`, which gives the reason. To start the watch again, type the command that the line gives, if it gives one. To check whether a watch is still running, type [`/tasks`](https://code.claude.com/docs/en/ship-command#check-whether-a-watch-is-running) at the Claude Code prompt while Claude is idle. @@ -154,18 +174,24 @@ Find the words that follow "because" in that line: | Reason | What happened | | :- | :- | -| `its check-in was cancelled` | You pressed `Esc` or `Ctrl+C` at the prompt or while Claude was working, or stopped the task in `/tasks`. Claude's messages call its work on the pull request a check-in. An `Esc` that closes the `/tasks` list leaves a watch running | -| `the watch couldn't go on` | Claude's reply may give the cause. One cause is that the pull request's branch is no longer checked out. Check it out in the folder where you started, then type `/steward` | +| `the watch was cancelled`, or `its check-in was cancelled` | You pressed `Esc` or `Ctrl+C` at the prompt or while Claude was working, or stopped the task in `/tasks`. Claude's messages call its work on the pull request a check-in. An `Esc` that closes the `/tasks` list leaves a watch running | +| `the watch couldn't go on` | Claude's reply may give the cause. One cause is that the pull request's branch is no longer checked out. Check it out in the folder where you started, then start the watch again | | `a watch doesn't carry over when a session is resumed` | The process that ran the watch has ended, for example because you closed the terminal. Running `claude --continue` in your shell brings back the conversation without the watch | | `you moved to another session` | `/clear`, `/resume`, or `/branch` can do that | -| `its check-ins were replaced` | You started a `/loop` | +| `another loop took its place`, or `its check-ins were replaced` | You started a `/loop` | | `your new command took over this session` | You ran `/ship` or `/steward` again | -| `a deny rule now forbids a command that the watch runs` | Type `/permissions` at the Claude Code prompt to see the rule. See [A tool, rule, or hook blocks a watch](#a-tool-rule-or-hook-blocks-a-watch) | +| `a deny rule now blocks a command that the watch runs`, or `a deny rule now forbids a command that the watch runs` | Type `/permissions` at the Claude Code prompt to see the rule. See [A tool, rule, or hook blocks a watch](#a-tool-rule-or-hook-blocks-a-watch) | | `the watch reached its time limit` | About seven days passed | -| `no next check-in was set` | A declined permission prompt, an error, or a usage limit can do that | +| `the watch stalled`, or `no next check-in was set` | A declined permission prompt, an error, or a usage limit can do that | +| `this session is in plan mode` | Press `Shift+Tab` to leave plan mode, then type the command that the line gives | +| `this session runs in the background` | Open a new terminal in the checkout that holds the branch, run `claude`, and type the command that the line gives | +| `you asked` | You typed `/ship stop` or `/steward stop` | | `a file that gh, git, or /steward relies on changed` | See [A file that the watch relies on changed](#a-file-that-the-watch-relies-on-changed) | +| `a file that git or /steward relies on changed` | The same message, for a [watch on another host](https://code.claude.com/docs/en/ship-command.md#watch-a-branch-on-another-host). See [A file that the watch relies on changed](#a-file-that-the-watch-relies-on-changed) | -`No pull request is being watched in this session` means that you typed `/ship stop` or `/steward stop` and no watch was running. Scroll up for a `Stopped watching pull request` line. +Where a row gives two wordings, the second is the one from before v2.1.331. + +`Nothing to stop. This session isn't watching a pull request`, or `No pull request is being watched in this session`, means that you typed `/ship stop` or `/steward stop` and no watch was running. Scroll up for a `Stopped watching` line. ### A file that the watch relies on changed @@ -174,7 +200,7 @@ A watch ends when something changes a file that `gh`, `git`, or `/steward` relie * **Git's settings**: `git push -u`, `git branch -u`, and `git remote add` change them. An editor such as VS Code can also add a setting to `.git/config` when it opens the repository or you switch back to it * **`.claude/settings.local.json`**: Claude Code writes it when you answer a permission prompt with "Yes, and don't ask again" -Review the change, then type `/steward` to start the watch again. +Review the change, then type the command that the `Stopped watching` line gives to start the watch again. If you changed none, one cause on Linux and WSL2 is a [sandboxed](https://code.claude.com/docs/en/sandboxing.md) command that starts or ends during the watch. Stop the command or wait for it to end. @@ -185,9 +211,10 @@ These messages appear in your session during a watch: | Message, or what you see | What to do | | :- | :- | | `Claude Code did not run this`, or `Not run · permission denied` | Claude tried a step, and a [limit on the watch](https://code.claude.com/docs/en/ship-command.md#what-claude-code-blocks-during-a-watch) or one of your rules or hooks refused it. The message also appears when the watch had already ended. Claude's messages call those limits "the fence" | -| `In this session there's a way around my limits` | A setting in your session, such as a rule, a hook, a plugin, or the sandbox, lets some commands past the [limits on the watch](https://code.claude.com/docs/en/ship-command.md#what-claude-code-blocks-during-a-watch). The text after the message names it. To see your rules, type `/permissions` at the Claude Code prompt. To end the watch while you decide, type `/steward stop` | -| A line such as `1 comment not read (no write access, or a bot that you haven't named)` | Claude [skipped a comment](https://code.claude.com/docs/en/ship-command.md#what-claude-does-during-a-watch). Open the link in the message to read it. For a bot that you want Claude to read, type `/steward +botname`. For a person's comment that you agree with, tell Claude what to change | -| `gh couldn't say where the pull request's head and base stand` | One cause is a GitHub CLI older than 2.63. Run `gh --version` in your shell to check. Update it, then type `/steward` to start the watch again | +| `In this session there's a way around`, followed by `the watch's limits`, `these limits`, or `my limits` | A setting in your session, such as a rule, a hook, a plugin, or the sandbox, lets some commands past the [limits on the watch](https://code.claude.com/docs/en/ship-command.md#what-claude-code-blocks-during-a-watch). The text after the message names it. To see your rules, type `/permissions` at the Claude Code prompt. To end the watch while you decide, type `/steward stop` | +| A line such as `1 comment not read (no write access, or a bot that you haven't named)` | Claude [skipped a comment](https://code.claude.com/docs/en/ship-command.md#what-claude-does-during-a-watch). Open the link in the message to read it. For a bot on GitHub that you want Claude to read, type `/steward +botname`. For a person's comment that you agree with, tell Claude what to change | +| `gh couldn't say where the pull request's head and base stand` | Claude Code refused one of Claude's pushes. To see `gh`'s own error, run `gh pr view` in your shell. Before v2.1.331, one cause is a GitHub CLI older than 2.63. Run `gh --version` in your shell to check. Update it, then type `/steward` to start the watch again | +| `A watch is on`, `The watch's limits still hold`, or `/ship is still starting` or the same for `/steward`, after you press `←` or type `/background` | Claude Code doesn't move a session to the background while a watch is on. To move it, first take the step that the message names, such as typing `/steward stop`, which ends the watch. Before v2.1.331, the session moves, and [the watch ends](https://code.claude.com/docs/en/ship-command.md#when-a-watch-can-lead-to-a-merge) | | `Claude resuming /loop wakeup` or `/steward --tend` in the session | Claude Code enters them when Claude checks the pull request during a watch. You can keep working as you are | ## Pull request results that you didn't expect @@ -196,16 +223,21 @@ Start here when `/ship` ran, and something on GitHub or in your repository surpr | What you see | Why, and what to do | | :- | :- | -| The pull request's title is a line such as `Update greet.py and 1 more` | `/ship` falls back to that title when Claude can't write one from the session's conversation, for example in a session where you didn't discuss the change. Edit the title and description on GitHub. Next time, run `/ship` in the session where you made the change, or commit your work yourself first, on a branch other than the default branch | +| The pull request's title, or the commit message, is a line such as `Update greet.py and 1 more` | `/ship` falls back to that line when Claude can't write one from the session's conversation, for example in a session where you didn't discuss the change. Edit the title and description on GitHub. Next time, run `/ship` in the session where you made the change, or commit your work yourself first, on a branch other than the default branch | | Claude pushed commits or answered a reviewer before you saw them | In auto mode, or where your rules or the sandbox allow a command, a watch works that way. See [Ask Claude to check with you first](https://code.claude.com/docs/en/ship-command.md#ask-claude-to-check-with-you-first) | -| New uncommitted changes didn't reach the open pull request | Once a pull request is open, `/ship` doesn't commit your work. Commit it, then push it, as in `git push origin ` in your shell | +| New uncommitted changes didn't reach the open pull request | See [Your pull request is already open](#your-pull-request-is-already-open) | | `git pull` or `git push` asks for an upstream branch | `/ship` sets no upstream. Name the remote and branch, as in `git push origin `. Setting an upstream changes git's settings, which [ends a running watch](https://code.claude.com/docs/en/ship-command.md#keep-working-while-a-watch-runs) | ## A custom /ship or /steward command stopped loading -A `Not loaded: a custom /ship` or `Not loaded: custom /ship, /steward` notice is about a custom skill or command. Its name is one that the built-in commands reserve, such as `ship`, `ship-local`, or `steward`. Rename it, then restart Claude Code. +These messages are about a custom skill or command. Its name is one that the built-in commands reserve, such as `ship`, `ship-local`, or `steward`: + +| Message | What to do | +| :- | :- | +| `Not loaded: a custom /ship` or `Not loaded: custom /ship, /steward` | Rename it, then restart Claude Code | +| `Nothing started. A custom /ship isn't loaded`, or the same for `/steward` | To run the built-in command, type the same line again. To run the custom one, rename it, then restart Claude Code | -Leave a repository's `.claude/skills/steward/SKILL.md` as it is, because PR Steward and the watch read it as instructions. The notice doesn't count that file, so a notice that names `/steward` is about another skill or command. +Leave a repository's `.claude/skills/steward/SKILL.md` as it is, because PR Steward and the watch read it as instructions. Neither message counts that file, so one that names `/steward` is about another skill or command. ## Related resources diff --git a/content/en/docs/claude-code/ship-command.md b/content/en/docs/claude-code/ship-command.md index bf63488910..34ff2333e5 100644 --- a/content/en/docs/claude-code/ship-command.md +++ b/content/en/docs/claude-code/ship-command.md @@ -47,18 +47,18 @@ If you want something else, such as a review alone or fixes from a cloud session Install or update these tools: * Claude Code v2.1.330 or later. If `/ship` is missing, see [/ship isn't available in your session](https://code.claude.com/docs/en/ship-command-troubleshooting.md#%2Fship-isn’t-available-in-your-session) -* The [GitHub CLI](https://cli.github.com) 2.63 or later, signed in with `gh auth login`. With an older version, Claude can't push fixes -* git 2.38 or later, to merge new commits into your branch. With an older git, Claude leaves those merges to you +* For a repository on GitHub, the [GitHub CLI](https://cli.github.com) 2.63 or later, signed in with `gh auth login`. With an older version, no watch starts. Before v2.1.331, a watch starts and Claude can't push fixes +* git 2.38 or later, to merge new commits into your branch. With an older git, Claude leaves those merges to you, and no watch starts [on another host](#watch-a-branch-on-another-host) Then get your change and your session ready: -* **A finished change, for `/ship`**: have it in your local clone of a repository on GitHub. It can be uncommitted, committed on a branch other than the default branch, or already in an open pull request of yours. If the repository is hosted somewhere other than GitHub, `/ship` opens no pull request, and Claude reviews your change +* **A finished change, for `/ship`**: have it in your local clone of a repository on GitHub. It can be uncommitted, committed on a branch other than the default branch, or already in an open pull request of yours. If the repository is hosted somewhere other than GitHub, `/ship` opens no pull request. Claude reviews your change, and can then [watch your branch](#watch-a-branch-on-another-host). Before v2.1.331, no watch starts there * **Only the files that you want in the pull request, for `/ship`**: `/ship` can commit all your uncommitted changes, new files included. In your shell, run `git status`. Delete each new file that you don't want in the pull request, or stash the file with `git stash push -u -- ` * **No secrets in those files, for `/ship`**: `/ship` looks for secrets by file name, such as `.env`, so look inside your files yourself. A deny rule such as `Read(./notes.txt)` doesn't keep a file out of the commit -* **An open pull request on GitHub, for `/steward`**: it has to be your own, with its branch checked out in your local clone -* **Permission mode**: choose [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) if you want Claude to work on the pull request unattended. In most other permission modes, Claude waits at each prompt. In `bypassPermissions` mode, no watch starts +* **An open pull request on GitHub, for `/steward`**: it has to be your own, with its branch checked out in your local clone. On a host other than GitHub, see [Watch a branch on another host](#watch-a-branch-on-another-host) +* **Permission mode**: choose [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) if you want Claude to work on the pull request unattended. In [Manual mode and `acceptEdits` mode](https://code.claude.com/docs/en/permission-modes#available-modes), Claude waits at each prompt. In `bypassPermissions` mode, no watch starts. With v2.1.331 or later, `/ship` doesn't start in plan mode -On native Windows, [no watch starts](https://code.claude.com/docs/en/ship-command-troubleshooting.md#cases-where-no-watch-can-start). +On native Windows, [no watch starts](https://code.claude.com/docs/en/ship-command-troubleshooting.md#cases-where-no-watch-can-start). In a [background session](https://code.claude.com/docs/en/agent-view.md), [no watch starts](https://code.claude.com/docs/en/ship-command-troubleshooting.md#a-session-setting-blocks-a-watch) either. Before v2.1.331, one can start there. > [!WARNING] > @@ -82,11 +82,13 @@ If you cancel before the push, a commit that `/ship` made stays. To undo it and In a repository on github.com that isn't a fork, `/ship` can commit your uncommitted changes, push the branch, and open the pull request before the review. On the default branch, it commits on a new branch and switches your checkout to that branch. If your work is already committed on another branch, `/ship` pushes that branch and opens the pull request. -`/ship` doesn't commit your uncommitted changes in these cases. Take the first one that fits: +`/ship` does something else in these cases. Take the first one that fits: -* **A pull request is already open for the branch**: commit and push anything that you want in the pull request -* **The repository is public**: if you're on a branch other than the default branch and it has commits of its own, `/ship` pushes those and opens a pull request without your uncommitted changes. Otherwise, commit your work on a branch other than the default branch, then run `/ship` again +* **Someone else's pull request is open for the branch**: `/ship` doesn't commit or push your work, and no watch starts * **An uncommitted file's name suggests a secret, such as `.env`**: in a repository that isn't public, `/ship` doesn't commit or push anything. See [/ship committed or pushed nothing](https://code.claude.com/docs/en/ship-command-troubleshooting.md#%2Fship-committed-or-pushed-nothing) +* **Your own pull request is already open for the branch**: `/ship` can commit your uncommitted changes, then push them and your unpushed commits onto it. [In some cases](https://code.claude.com/docs/en/ship-command-troubleshooting.md#your-pull-request-is-already-open), such as a public repository or auto-merge turned on, it doesn't commit your changes. If a watch then starts, your unpushed commits [can go up with Claude's next push](#keep-working-while-a-watch-runs). Before v2.1.331, `/ship` doesn't commit or push here +* **The repository is public**: `/ship` doesn't commit your uncommitted changes. If you're on a branch other than the default branch and it has commits of its own, `/ship` pushes those and opens a pull request without your uncommitted changes. Otherwise, commit your work on a branch other than the default branch, then run `/ship` again +* **Your commits are on the default branch, with nothing uncommitted**: in a repository that isn't public, `/ship` makes a new branch for them, pushes that branch, opens a pull request, and switches your checkout to the new branch. Before v2.1.331, `/ship` pushes nothing, so put the commits on a branch other than the default branch, then run `/ship` again Open the pull request yourself, then run `/ship`, if you want any of these: @@ -105,9 +107,9 @@ To start a watch with no review first, type `/steward` at the Claude Code prompt ## What Claude does during a watch -A watch is Claude's ongoing work on your pull request, which starts after `/ship`'s review or when you type `/steward`. Claude uses your `gh` and `git` sign-ins, so its work on GitHub appears under your name. +A watch is Claude's ongoing work on your pull request, which starts after `/ship`'s review or when you type `/steward`. On a host other than GitHub, see [Watch a branch on another host](#watch-a-branch-on-another-host). Claude uses your `gh` and `git` sign-ins, so its work on GitHub appears under your name. -In auto mode, Claude takes these actions without asking: +In auto mode, on a GitHub pull request, Claude takes these actions without asking: * Works on the review findings that it judges to be problems * Can post one comment that sums up its review @@ -116,13 +118,52 @@ In auto mode, Claude takes these actions without asking: * Works on failing checks, and re-runs failed ones * Answers review comments, resolves threads, and re-requests reviews -Claude reads comments from you and from people with write access. On github.com, it also reads comments from Claude's bot. To have Claude read another bot's comments, type `/steward +` and the bot's name, as in `/steward +my-lint-bot`. +On GitHub, Claude reads comments from you and from people with write access. On github.com, it also reads comments from Claude's bot. To have Claude read another bot's comments, type `/steward +` and the bot's name, as in `/steward +my-lint-bot`. When checks pass and comments are answered, Claude says so in the session. Merge the pull request yourself. What can merge depends on your permissions and your repository's branch rules. See [When a watch can lead to a merge](#when-a-watch-can-lead-to-a-merge). +### Watch a branch on another host + +On a host other than GitHub, such as GitLab, Bitbucket, or Azure DevOps, Claude can watch your branch for up to seven days. The watch needs git 2.38 or later, and works without the GitHub CLI. `/ship` and `/steward` don't commit, push, or open anything when they start. Before v2.1.331, `/ship` reviews your change there, and no watch starts. + +Commit your change first, then push your branch with an upstream from your shell: + +```bash theme={null} +git push -u origin +``` + +On gitlab.com, bitbucket.org, or dev.azure.com, open your merge request or pull request next. Claude Code can then [read its checks and comments with your git sign-in](#checks-and-comments-on-gitlab-bitbucket-and-azure-devops). Then type `/ship` at the Claude Code prompt, or `/steward` for a watch with no review first. + +With your git sign-in, Claude can take actions such as these, in auto mode without asking: + +* Merge the base branch into yours to resolve a conflict +* Merge in other people's pushes to your branch +* Push commits to your branch + +The watch gives Claude no command to reply to comments, re-run a check, or read CI logs there. To see what Claude may do there, type `/ship terms` at the prompt while the watch runs. + +#### Checks and comments on GitLab, Bitbucket, and Azure DevOps + +In a terminal session, Claude Code can read details such as your open merge request or pull request, its checks, and its comments. To do so, it asks git for the sign-in that git keeps for the remote that your branch pushes to. That sign-in goes to the API of gitlab.com, bitbucket.org, or dev.azure.com in `GET` requests. You aren't asked first. + +A line such as this one appears before the first read, which can go out as soon as you run `/ship` or `/steward`: + +```text theme={null} +Claude Code is about to read gitlab.com's web API with the sign-in that git keeps for it. It only reads. +``` + +A watch that reads the host repeats these reads until it ends. To see whether they apply to your checkout, run `git remote -v` in your shell. They can happen only when the `(fetch)` line of the remote that your branch pushes to shows an `https` address on one of those hosts. + +To prevent them, switch the remote to SSH or deny the host in your settings before you run `/ship` or `/steward`. If a watch is running, type `/ship stop` first: + +* Have the remote that your branch pushes to fetch over SSH, as in `git remote set-url origin git@gitlab.com:/.git` in your shell, with that remote's name in place of `origin`. Then check that `git remote -v` shows no `https` address on its `(fetch)` line +* Add the host to [`sandbox.network.deniedDomains`](https://code.claude.com/docs/en/settings-reference#sandbox-network-denieddomains). The `about to read` notice still appears, but Claude Code doesn't ask git for the sign-in or call the web API. The watch's own git commands, which Claude Code runs outside the [sandbox](https://code.claude.com/docs/en/sandboxing.md), still contact the host with git's sign-in. With the sandbox on, Claude also can't fetch from or push to that host + +At the watch's start, the host can refuse the sign-in, or show no open merge request or pull request of yours for the branch. The watch can then go on with git alone, and the lines at its start include `Claude can't see checks or comments on gitlab.com, so watch those yourself`. If you close yours without merging it, that watch continues, so type `/ship stop`. + ### Keep working while a watch runs -While a watch runs, keep the session open and [in the foreground](https://code.claude.com/docs/en/agent-view.md#send-the-session-to-the-background), the computer awake, and your pull request's branch checked out. Claude edits files in the same checkout as you. +While a watch runs, keep the session open, the computer awake, and your pull request's branch checked out. Before v2.1.331, also keep the session [in the foreground](https://code.claude.com/docs/en/agent-view.md#send-the-session-to-the-background). Claude edits files in the same checkout as you. * **To start your next change**: work in another folder, such as a second clone of the repository, and open another Claude Code session there * **To push your own commits**: name the remote and branch, as in `git push origin `. If you change git's settings, for example with `git push -u` or `git branch -u`, the watch ends @@ -161,23 +202,24 @@ Type `/tasks` at the Claude Code prompt. Once the review is done and while Claud ### What ends a watch -After a watch ends, look for a line that starts `Stopped watching pull request`. [A watch stopped](https://code.claude.com/docs/en/ship-command-troubleshooting.md#a-watch-stopped) lists reasons that it gives. +After a watch ends, look for a line that starts `Stopped watching`. [A watch stopped](https://code.claude.com/docs/en/ship-command-troubleshooting.md#a-watch-stopped) lists reasons that it gives. The watch ends in cases such as these: | Where | What ends the watch | | :- | :- | -| On the pull request | It's merged or closed, [PR Steward](https://code.claude.com/docs/en/pr-steward.md) labels it, or seven days pass | +| On a GitHub pull request | It's merged or closed, [PR Steward](https://code.claude.com/docs/en/pr-steward.md) labels it, or seven days pass | +| On another host | Your branch is gone from its remote or adds nothing to its base any more, or seven days pass. Where Claude Code reads your merge request or pull request, the watch also ends when it's merged or closed. Otherwise, if you close it without merging it, [the watch can go on](#checks-and-comments-on-gitlab-bitbucket-and-azure-devops) | | At the keyboard | You press `Esc` or `Ctrl+C` at the prompt or while Claude is working. One press can end the watch, with no confirmation | | In your checkout | You check out another branch, or change git's settings | -| In the session | The session ends, you send it to the background, you start another watch or a `/loop` with a task, or you run `/clear`, `/resume`, or `/branch` | +| In the session | The session ends, you start another watch or a `/loop` with a task, you run `/clear`, `/resume`, or `/branch`, or the session is in plan mode when Claude next checks the pull request. Before v2.1.331, a watch goes on in plan mode, and ends when you send the session to the background | | After a failure | An error, a declined prompt, or a usage limit can end it early | ### Stop or restart a watch To end a watch, type `/ship stop` at the Claude Code prompt in the session that runs it. If Claude is working when you type it, the watch ends when the current turn does, so what Claude pushes or posts in that turn still reaches the pull request. To stop the turn as well, press `Esc`. -To start a watch again, type [`/steward`](#start-a-watch-with-%2Fsteward). +To start a watch again, type [`/steward`](#start-a-watch-with-%2Fsteward). On a host other than GitHub, add any base that you named, as in `/steward origin/main`. ## Decide where to run a watch @@ -211,9 +253,9 @@ Cases such as these can lead to a merge: | Case | What happens | | :- | :- | -| Auto-merge is on for the pull request | GitHub merges once the checks and reviews allow. What Claude does during the watch, such as pushing a fix, can bring that about. To turn it off, run `gh pr merge --disable-auto ` in your shell | +| Auto-merge is on for the pull request | The host merges once the checks and reviews allow. What Claude does during the watch, such as pushing a fix, can bring that about. To turn it off on GitHub, run `gh pr merge --disable-auto ` in your shell | | In a terminal session, you type a message while Claude is idle | [Claude Code's limits](#what-claude-code-blocks-during-a-watch) are off while Claude answers your message. They're also off while Claude handles a background task's result that arrives during that time. In auto mode, Claude may then be allowed to merge | -| You send a session that you started in your terminal to the background during the review or the watch, for example by pressing `←` | The watch ends. Work under way can go on there without these limits. To end that work, [stop that session](https://code.claude.com/docs/en/agent-view.md#manage-sessions-from-the-shell) | +| Before v2.1.331, you send a session that you started in your terminal to the background during the review or the watch, for example by pressing `←` | The watch ends. Work under way can go on there without these limits. To end that work, [stop that session](https://code.claude.com/docs/en/agent-view.md#manage-sessions-from-the-shell) | ### Permission rules and hooks that apply to /ship and /steward @@ -244,6 +286,8 @@ This example turns off both: } ``` +You can also set [`CLAUDE_CODE_DISABLE_SHIP`](https://code.claude.com/docs/en/env-vars#variables) to `1`, for example under `env` in managed settings. Requires Claude Code v2.1.331 or later. + To stop `/ship`'s own pushes, put a [deny rule](https://code.claude.com/docs/en/permissions.md#manage-permissions) such as `Bash(git push *)` in managed settings. With that rule, no watch starts. ## Arguments for /ship and /steward @@ -253,10 +297,11 @@ Type an argument after `/ship` or `/steward` at the Claude Code prompt. To combi | You type | Commands | What it does | | :- | :- | :- | | `low`, `medium`, `high`, `xhigh`, or `max` | `/ship` | Asks for a review at that effort level. The default is `high` | -| `41`, or a pull request's URL | `/ship`, `/steward` | Works on that pull request. For a watch, it has to be your own, with its branch checked out | -| `+botname` | `/ship`, `/steward` | Also reads that bot's comments. Repeat it when you start a watch again | +| `41`, or a pull request's URL | `/ship`, `/steward` | On GitHub, works on that pull request. For a watch, it has to be your own, with its branch checked out | +| `+botname` | `/ship`, `/steward` | On GitHub, also reads that bot's comments. Repeat it when you start a watch again | +| `origin/main`, or another remote and branch | `/ship`, `/steward` | On [a host other than GitHub](#watch-a-branch-on-another-host), names the branch that your change goes into. Requires Claude Code v2.1.331 or later | | `stop` | `/ship`, `/steward` | Ends the watch | -| `terms` | `/ship`, `/steward` | Shows what Claude may do during a watch and what limits it | +| `terms` | `/ship`, `/steward` | Shows what Claude may do during a watch and what limits it. On [another host](#watch-a-branch-on-another-host), type it while the watch runs | ## Related resources diff --git a/content/en/docs/claude-code/skills.md b/content/en/docs/claude-code/skills.md index 729c7535be..da9d424c96 100644 --- a/content/en/docs/claude-code/skills.md +++ b/content/en/docs/claude-code/skills.md @@ -425,7 +425,7 @@ Claude Code reads the frontmatter only when the opening `---` is the file's firs | `user-invocable` | No | Set to `false` when only Claude should invoke the skill: Claude Code hides it from the `/` menu and doesn't run it when you type `/name`. Use for background knowledge users shouldn't invoke directly. Default: `true`. | | `allowed-tools` | No | Tools Claude can use without asking permission during the turn that invokes this skill. The grant clears when you send your next message. Accepts a space- or comma-separated string, or a YAML list. See [Pre-approve tools for a skill](#pre-approve-tools-for-a-skill). | | `disallowed-tools` | No | Tools removed from Claude's available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message. Like deny rules, the field can't remove [`EndConversation`](https://code.claude.com/docs/en/tools-reference#endconversation-tool-behavior) while any other tool remains. | -| `model` | No | Model to use when this skill is active. The override applies for the rest of the current turn and isn't saved to settings. The session model resumes when you send your next prompt. Accepts the same values as [`/model`](https://code.claude.com/docs/en/model-config), or `inherit` to keep the active model. A value excluded by your organization's [`availableModels`](https://code.claude.com/docs/en/model-config#restrict-model-selection) allowlist isn't used, and the session keeps its current model. In [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode), and in [plan mode while the classifier reviews commands](https://code.claude.com/docs/en/permission-modes.md#analyze-before-you-edit-with-plan-mode), a model that auto mode doesn't support also isn't used, and the session keeps its current model. With `context: fork`, the value sets the [forked subagent's model](#run-skills-in-a-subagent) instead, and an excluded value follows the [same rules as a subagent model override](https://code.claude.com/docs/en/model-config.md#restrict-model-selection). | +| `model` | No | Model for the turn when you [run this skill with `/name`](#where-you-write-the-skills-name). Accepts [`/model`](https://code.claude.com/docs/en/model-config) values, or `inherit` for the active model. When Claude runs the skill, the session keeps its model. The same happens when your [organization blocks the value](https://code.claude.com/docs/en/model-config.md#restrict-model-selection), a [plan-mode upgrade](https://code.claude.com/docs/en/model-config.md#opusplan-model-setting) is active, or [auto mode's classifier is on](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) and doesn't support it. With `context: fork`, the value is the forked subagent's [per-invocation model](https://code.claude.com/docs/en/sub-agents.md#choose-a-model). | | `effort` | No | [Effort level](https://code.claude.com/docs/en/model-config.md#adjust-effort-level) for the rest of the current turn. Overrides the session effort level, but not the [`CLAUDE_CODE_EFFORT_LEVEL`](https://code.claude.com/docs/en/env-vars#variables) environment variable. With `context: fork`, the value sets the forked subagent's effort level instead. When you omit it, the level comes from the [effort resolution order](https://code.claude.com/docs/en/model-config.md#adjust-effort-level). For a fork on another model, see [Effort level of subagents and teammates](https://code.claude.com/docs/en/model-config.md#effort-level-of-subagents-and-teammates). Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model. | | `context` | No | Set to `fork` to run in a forked subagent context. See [Run skills in a subagent](#run-skills-in-a-subagent). | | `agent` | No | Which subagent type to use when `context: fork` is set. | diff --git a/content/en/docs/claude-code/sub-agents.md b/content/en/docs/claude-code/sub-agents.md index 2e70a99a9a..60343c9d68 100644 --- a/content/en/docs/claude-code/sub-agents.md +++ b/content/en/docs/claude-code/sub-agents.md @@ -458,7 +458,7 @@ On macOS, Linux, and WSL, a subagent can also receive the Glob and Grep tools wh * `WaitForMcpServers` * `Workflow` -The second filter applies to subagents running in the background. `Agent` and `ExitPlanMode` follow the first filter's conditions wherever the subagent runs. A background subagent keeps every MCP tool, and [`SubagentHandback`](https://code.claude.com/docs/en/tools-reference) if it reports through that tool. It also keeps `Read`, `Grep`, `Glob`, `LSP`, `Bash`, `PowerShell`, `Edit`, `Write`, `NotebookEdit`, `WebFetch`, `WebSearch`, `TodoWrite`, `Skill`, `ToolSearch`, `EnterWorktree`, `ExitWorktree`, `Monitor`, `TaskStop`, `SendMessage`, `Artifact`, `ListPlugins`, `ListSkills`, `SearchPlugins`, and `SearchSkills`. +The second filter applies to subagents running in the background. `Agent` and `ExitPlanMode` follow the first filter's conditions wherever the subagent runs. A background subagent keeps every MCP tool, and [`SubagentHandback`](https://code.claude.com/docs/en/tools-reference) if it reports through that tool. It also keeps `Read`, `Grep`, `Glob`, `LSP`, `Bash`, `PowerShell`, `Edit`, `Write`, `NotebookEdit`, `WebFetch`, `WebSearch`, `TodoWrite`, `Skill`, `ToolSearch`, `EnterWorktree`, `ExitWorktree`, `Monitor`, `TaskStop`, `SendMessage`, `Artifact`, `ListPlugins`, `ListSkills`, `SearchPlugins`, `SearchSkills`, and `REPL`. Don't rely on other built-in tools in a background subagent: Claude Code removes most of them, whether inherited or listed in the `tools` field. The removal reports no error unless it leaves the `tools` list [resolving to nothing](https://code.claude.com/docs/en/errors.md#agent-would-be-spawned-with-zero-tools). @@ -555,7 +555,7 @@ The `Agent(agent_type)` allowlist syntax applies only to an agent running as the #### Scope MCP servers to a subagent -Use the `mcpServers` field to give a subagent access to [MCP](https://code.claude.com/docs/en/mcp.md) servers that aren't available in the main conversation. Inline servers defined here are connected when the subagent starts, subject to the [trust rule for the agent file's folder](#inline-server-trust), and disconnected when it finishes. String references share the parent session's connection. +Use the `mcpServers` field to give a subagent access to [MCP](https://code.claude.com/docs/en/mcp.md) servers that aren't available in the main conversation. Inline servers defined here are connected when the subagent starts, subject to the [trust rule for the agent file's folder](#inline-server-trust), and disconnected when the last agent using them finishes. String references share the parent session's connection. > [!NOTE] > diff --git a/content/en/docs/claude-code/tools-reference.md b/content/en/docs/claude-code/tools-reference.md index b73b0f8746..01b9f01816 100644 --- a/content/en/docs/claude-code/tools-reference.md +++ b/content/en/docs/claude-code/tools-reference.md @@ -48,6 +48,7 @@ To add custom tools, connect an [MCP server](https://code.claude.com/docs/en/mcp | `Read` | Reads the contents of files. See [Read tool behavior](#read-tool-behavior) | No | | `ReadMcpResourceTool` | Reads a specific MCP resource by URI | No | | `RemoteTrigger` | Creates, updates, runs, and lists [cloud scheduled tasks](https://code.claude.com/docs/en/routines.md), formerly routines, on claude.ai. Backs the `/schedule` command. The [`RemoteTrigger` input reference](https://code.claude.com/docs/en/agent-sdk/typescript#remotetrigger) documents every action and the organization policies that remove the tool. Cloud scheduled tasks live on claude.ai and require a Pro, Max, Ultra, Team, or Enterprise plan. This tool is therefore not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform, or Microsoft Foundry | No | +| `REPL` | Runs the JavaScript that Claude writes in [Code Mode](https://code.claude.com/docs/en/code-mode.md). Available only when Code Mode is on. For how Claude Code checks the tool calls in that code, see [Permission checks](https://code.claude.com/docs/en/code-mode.md#permission-checks) | No | | `ReportFindings` | Reports code-review findings as a structured list, with a file, summary, and failure scenario per finding, so Claude Code can render them instead of printing them as text. Claude calls it when active code-review instructions tell it to. A finding can also carry an optional `category` slug, such as `correctness` or `test-coverage`, shown next to the file location in the rendered list | No | | `ScheduleWakeup` | Reschedules the next iteration of a [self-paced `/loop`](https://code.claude.com/docs/en/scheduled-tasks#let-claude-choose-the-interval). Claude calls this at the end of each iteration to pick when the next one runs, between one minute and one hour out; you don't call it directly. To end the loop instead, Claude calls it with `stop: true`, which cancels the pending wakeup. The pending wakeup appears in `session_crons` in [Stop hook input](https://code.claude.com/docs/en/hooks.md#stop-input) | No | | `SearchPlugins` | Searches your claude.ai plugin catalog. Available in the same sessions as `ListPlugins` | No | @@ -684,36 +685,59 @@ With a `domain:` allow rule, [sandboxed Bash commands](https://code.claude.com/d ### Block a site or turn WebFetch off -| To | Do this | +| Goal | What to do | | :- | :- | | Block a domain | Add a `WebFetch(domain:...)` rule for it to `deny` | | Require a prompt for a domain | Add a `WebFetch(domain:...)` rule for it to `ask` | | Turn WebFetch off | Add `WebFetch` to `deny`, or set [`CLAUDE_CODE_DISABLE_WEB_FETCH`](https://code.claude.com/docs/en/env-vars#variables) to `1` | -| Do any of these for your organization | Put the rule in [managed settings](https://code.claude.com/docs/en/managed-settings.md) | Outside the sandbox, if Bash is allowed, Claude can still use `curl`, `wget`, or other tools to reach any URL. See [Tool-specific permission rules](https://code.claude.com/docs/en/permissions.md#tool-specific-permission-rules). -### When a fetch prompts, fails, or WebFetch is missing +To apply a `WebFetch` rule to your organization, put it in [managed settings](https://code.claude.com/docs/en/managed-settings.md). -Claude's reply can leave out anything on the page that Claude didn't ask about. In the terminal, press `Ctrl+O` to see what Claude asked and the answer it received. +### Fix unexpected WebFetch prompts and denials + +If a fetch is blocked or denied, or you see a permission prompt you didn't expect or none at all, find what you see in the first column. -| What you notice | What to do | +| Symptom | Fix | | :- | :- | -| Claude says a page doesn't cover something you know is there | Ask Claude to fetch the page again and tell it what to look for. For the raw page, ask it to run `curl` on the URL through the Bash tool. | -| Claude leaves out the end of a long page, or says part of it wasn't read | Ask Claude to fetch the next part of the page. This requires Claude Code v2.1.290 or later. The [`web-fetch` subagent](#web-fetch-subagent) reads pages of up to about 48,000 characters in full, and WebFetch reads the first 100,000 when Claude calls it. | -| Claude describes a page as it was before a recent change | WebFetch reuses its copy of a page for 15 minutes. To change how long, set [`CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`](https://code.claude.com/docs/en/env-vars#variables). | -| Claude says the download ran out of time | A download fails after five minutes. To change the limit, set [`CLAUDE_CODE_WEBFETCH_DEADLINE_MS`](https://code.claude.com/docs/en/env-vars#variables). | -| Claude reports a redirect and stops there | Ask Claude to fetch the new URL. When a redirect changes the host by more than adding or dropping `www.`, WebFetch returns the new URL and no page content. | -| Claude can't fetch a local or intranet server | WebFetch [refuses `localhost`](https://code.claude.com/docs/en/errors#webfetch-cannot-fetch-localhost) and any other hostname without a dot. Ask Claude to reach the server with `curl` through the Bash tool. | -| In a cloud session, Claude says the network blocks the domain | An allow rule isn't enough there. Also [add the domain](https://code.claude.com/docs/en/cloud-environments.md#allow-specific-domains) to the cloud environment's network access. | +| A fetch fails for a domain you allowed | The URL also has to pass the [WebFetch domain safety check](https://code.claude.com/docs/en/data-usage.md#webfetch-domain-safety-check), unless you turn the check off with [`skipWebFetchPreflight`](https://code.claude.com/docs/en/settings-reference#skipwebfetchpreflight). See [WebFetch domain safety check failed](https://code.claude.com/docs/en/errors.md#webfetch-domain-safety-check-failed). | | In auto mode, a fetch is blocked and you see no prompt | Add an allow rule for the domain. If the classifier blocked the fetch, you can also open `/permissions` in the terminal and [approve the fetch](https://code.claude.com/docs/en/auto-mode-config.md#review-denials) under the **Recently blocked** tab so Claude can retry. | | In `claude -p` or the Agent SDK, a fetch is denied | These runs [start in Manual mode](https://code.claude.com/docs/en/permission-modes.md#which-mode-a-non-interactive-run-starts-in), and a call that needs approval is denied. Add an allow rule or start in auto mode. | -| A fetch fails for a domain you allowed | The URL also has to pass the [WebFetch domain safety check](https://code.claude.com/docs/en/data-usage.md#webfetch-domain-safety-check), unless you turn the check off with [`skipWebFetchPreflight`](https://code.claude.com/docs/en/settings-reference#skipwebfetchpreflight). See [WebFetch domain safety check failed](https://code.claude.com/docs/en/errors.md#webfetch-domain-safety-check-failed). | | A rule in your own settings file has no effect | If your organization sets [`allowManagedPermissionRulesOnly`](https://code.claude.com/docs/en/settings-reference#allowmanagedpermissionrulesonly), Claude Code ignores the rule. Ask your administrator to add it to managed settings. | | Prompts continue after you add the domain to the sandbox's [`allowedDomains`](https://code.claude.com/docs/en/settings-reference#sandbox-network-alloweddomains) | WebFetch doesn't read that list, so add a WebFetch allow rule | | No prompt for a domain you didn't allow | Claude Code skips the prompt for a built-in set of preapproved documentation domains, and in `auto` and `bypassPermissions` modes. To require the prompt anyway, add an `ask` rule for the domain. Sandboxed Bash commands don't inherit the preapproved set. | | A claude.ai artifact link brings another prompt | See [Read an artifact shared with you](https://code.claude.com/docs/en/artifacts.md#read-an-artifact-shared-with-you) | -| Claude can't fetch any page | Run `/status` in the session. If the `Organization configuration` line lists `HIPAA`, WebFetch is off: see [What developers see in Claude Code](https://code.claude.com/docs/en/hipaa-setup.md#what-developers-see-in-claude-code). If the `Organization policy` line reports that the policy didn't load and names web fetch, follow any fix the line names. WebFetch becomes available again without a restart once a policy that allows it loads. | + +### Fix a failed WebFetch request + +If Claude says it couldn't fetch a page, find what happened in the first column. + +| Symptom | Fix | +| :- | :- | +| In a cloud session, Claude says the network blocks the domain | An allow rule isn't enough there. Also [add the domain](https://code.claude.com/docs/en/cloud-environments.md#allow-specific-domains) to the cloud environment's network access. | +| Claude can't fetch a local or intranet server | WebFetch [refuses `localhost`](https://code.claude.com/docs/en/errors#webfetch-cannot-fetch-localhost) and any other hostname without a dot. Ask Claude to reach the server with `curl` through the Bash tool. | +| Claude reports a redirect and stops there | Ask Claude to fetch the new URL. When a redirect changes the host by more than adding or dropping `www.`, WebFetch returns the new URL and no page content. | +| Claude says the download ran out of time | A download fails after five minutes. To change the limit, set [`CLAUDE_CODE_WEBFETCH_DEADLINE_MS`](https://code.claude.com/docs/en/env-vars#variables). | + +### Fix missing or outdated page content + +Claude's reply can leave out anything on the page that Claude didn't ask about. In the terminal, press `Ctrl+O` to see what Claude asked and the answer it received. + +| Symptom | Fix | +| :- | :- | +| Claude says a page doesn't cover something you know is there | Ask Claude to fetch the page again and tell it what to look for. For the raw page, ask it to run `curl` on the URL through the Bash tool. | +| Claude leaves out the end of a long page, or says part of it wasn't read | Ask Claude to fetch the next part of the page. This requires Claude Code v2.1.290 or later. The [`web-fetch` subagent](#web-fetch-subagent) reads pages of up to about 48,000 characters in full, and WebFetch reads the first 100,000 when Claude calls it. | +| Claude describes a page as it was before a recent change | WebFetch reuses its copy of a page for 15 minutes. To change how long, set [`CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`](https://code.claude.com/docs/en/env-vars#variables). | + +### Find out why WebFetch is unavailable + +If Claude can't fetch any page, run `/status` in the session and check the `Organization configuration` and `Organization policy` lines: + +* **`Organization configuration` lists `HIPAA`**: WebFetch is off. See [What developers see in Claude Code](https://code.claude.com/docs/en/hipaa-setup.md#what-developers-see-in-claude-code). +* **`Organization policy` reports that the policy didn't load and names web fetch**: follow any fix the line names. WebFetch becomes available again without a restart once a policy that allows it loads. + +If `/status` shows neither, look for `WebFetch` under `deny` in a [settings file](https://code.claude.com/docs/en/settings.md#find-or-create-your-settings-files), or for `CLAUDE_CODE_DISABLE_WEB_FETCH` set to `1`. To turn WebFetch back on, remove the rule, or unset the variable and start a new session. Ask your administrator to remove a rule that's in [managed settings](https://code.claude.com/docs/en/settings.md#check-what-your-organization-enforces). ### The web-fetch subagent @@ -740,7 +764,7 @@ By default, the `web-fetch` subagent runs on the model that the `haiku` [model a Your `WebFetch` [permission rules](https://code.claude.com/docs/en/permissions.md#webfetch) apply to the pages the `web-fetch` subagent fetches, and so do the `PreToolUse` and `PostToolUse` [hooks](https://code.claude.com/docs/en/hooks.md) that match `WebFetch`. -| If you rely on | With the subagent | What to do | +| Your configuration | What changes with the subagent | What to do | | :- | :- | :- | | CLAUDE.md instructions about which pages to fetch | The subagent starts without your CLAUDE.md files, including your organization's managed one | Restrict fetches with `WebFetch` permission rules | | `SubagentStart` or `SubagentStop` hooks | Only the hooks defined in [managed settings](https://code.claude.com/docs/en/managed-settings.md) run for this subagent | In any other settings file, use a `PreToolUse` or `PostToolUse` hook that matches `WebFetch` | diff --git a/content/en/docs/claude-code/troubleshoot-install.md b/content/en/docs/claude-code/troubleshoot-install.md index 71bc25c4ea..939991b39e 100644 --- a/content/en/docs/claude-code/troubleshoot-install.md +++ b/content/en/docs/claude-code/troubleshoot-install.md @@ -1244,7 +1244,11 @@ To make the Keychain writable again and move your login back into the encrypted **1. Check Keychain access** -Run `claude doctor` to check Keychain access. When the Keychain rejects writes, the report lists a warning that starts with `macOS Keychain is not writable`, followed by a suggested fix. When the report lists no Keychain warning, the Keychain is writable and you can skip to the last step. +In the shell you run Claude Code from, run `claude doctor` and look for a warning that starts with `macOS Keychain is not writable`. What the report shows decides your next step: + +* **No such warning**: skip to the last step +* **A warning whose fix says `Unlocking the Keychain won't help`**: follow that fix. If that shell is sandboxed, restart these steps outside the sandbox to move your login back +* **A warning with another fix**: go on to the next step **2. Unlock the Keychain** diff --git a/content/en/docs/claude-code/vs-code.md b/content/en/docs/claude-code/vs-code.md index 23e97d5058..c67be76460 100644 --- a/content/en/docs/claude-code/vs-code.md +++ b/content/en/docs/claude-code/vs-code.md @@ -688,6 +688,8 @@ Some shortcuts depend on which panel is "focused" (receiving keyboard input). Wh | New Conversation | `Cmd+N` (Mac) / `Ctrl+N` (Windows/Linux) | Start a new conversation. Requires Claude to be focused and `enableNewConversationShortcut` set to `true` | | Reopen Closed Session | `Cmd+Shift+T` (Mac) / `Ctrl+Shift+T` (Windows/Linux) | Reopen the most recently closed Claude session tab. Falls through to VS Code's normal reopen-closed-editor when the last closed tab wasn't a Claude session. Disable with `enableReopenClosedSessionShortcut` | | Insert @-Mention Reference | `Option+K` (Mac) / `Alt+K` (Windows/Linux) | Insert a reference to the current file and selection (requires editor to be focused) | +| Add Cell to Chat | - | Add a notebook cell, its text output or error, and an @-mention of the notebook to the prompt box. Requires Claude Code v2.1.331 or later | +| Resolve Merge Conflicts | - | Put a conflict-resolution request in the prompt box. Click this command's button in a conflicted file's **Editor Toolbar** or on Source Control's **Merge Changes**. Requires Claude Code v2.1.331 or later | | Accept Change at Cursor | - | Accept the change at the cursor while [reviewing a proposed edit](#get-started) one change at a time. Requires Claude Code v2.1.275 or later | | Reject Change at Cursor | - | Revert the change at the cursor while reviewing a proposed edit one change at a time. Requires Claude Code v2.1.275 or later | | Toggle Focus view | `Ctrl+Option+F` (Mac) / `Ctrl+Alt+F` (Windows/Linux) | Hide or show tool activity in the conversation. Works while a Claude panel or sidebar is visible. On Windows/Linux, `Ctrl+Alt+F` opens VS Code's Find instead while focus is in the Debug Console or a searchable list such as the Explorer. Focus an editor or the Claude panel and press it again. Requires Claude Code v2.1.221 or later | @@ -771,6 +773,7 @@ VS Code reads `initialPermissionMode` from your user settings and ignores worksp | `autosave` | `true` | Auto-save files before the Read, Edit, and Write tools run | | `attachOpenFile` | `true` | Add the file that is open in the editor to your messages and show it in the prompt box. When off, the file is added only along with text you select. Requires Claude Code v2.1.271 or later | | `attachSelection` | `true` | Add the text you select in the editor to your messages and show it in the prompt box. When off, you can still [add a selection as an @-mention](#automatic-context-from-your-selection-and-open-file). Requires Claude Code v2.1.300 or later | +| `showFixActions` | `true` | Show **Fix with Claude Code** on editor errors, warnings, and failed tests. Selecting it puts a fix request in the prompt box. Requires Claude Code v2.1.331 or later | | `useCtrlEnterToSend` | `false` | Use Ctrl/Cmd+Enter instead of Enter to send prompts | | `scrollToBottomOnSend` | `true` | Scroll the conversation to the bottom when you send a message. When off, the conversation stays where you left it. Requires Claude Code v2.1.275 or later | | `pinPrompt` | `true` | Keep your message pinned at the top while you scroll through Claude's reply. Requires Claude Code v2.1.330 or later | @@ -996,6 +999,7 @@ Sign-in, network, and launch errors have their own entries on the install troubl | `Could not locate the Claude CLI on PATH` | [Could not locate the Claude CLI on PATH](https://code.claude.com/docs/en/errors.md#could-not-locate-the-claude-cli-on-path) | | `The connection to Claude Code ended before this message completed` | [The connection to Claude Code ended before this message completed](https://code.claude.com/docs/en/errors.md#the-connection-to-claude-code-ended-before-this-message-completed) | | `The Claude Code program for this computer, the build, could not be found` | [The Claude Code program for this computer could not be found](https://code.claude.com/docs/en/errors.md#the-claude-code-program-for-this-computer-could-not-be-found) | +| `Failed to set model: Settings file is not valid JSON` | [Fix a broken settings file](https://code.claude.com/docs/en/settings.md#fix-a-broken-settings-file) | | `claude` isn't found in VS Code's integrated terminal | [Run CLI in VS Code](#run-cli-in-vs-code) | ### Extension won't install diff --git a/content/en/get-started.md b/content/en/get-started.md index 0734305eb0..fc1705e5e0 100644 --- a/content/en/get-started.md +++ b/content/en/get-started.md @@ -33,7 +33,7 @@ description: Make your first API call to Claude and build a simple web search as For Linux environments, download the release binary directly. ```bash - VERSION=2.13.0 + VERSION=2.14.0 OS=$(uname -s | tr '[:upper:]' '[:lower:]') case $(uname -m) in x86_64) ARCH=amd64 ;; @@ -180,7 +180,7 @@ description: Make your first API call to Claude and build a simple web search as For Linux environments, download the release binary directly. ```bash - VERSION=2.13.0 + VERSION=2.14.0 OS=$(uname -s | tr '[:upper:]' '[:lower:]') case $(uname -m) in x86_64) ARCH=amd64 ;; @@ -505,7 +505,7 @@ description: Make your first API call to Claude and build a simple web search as } dependencies { - implementation("com.anthropic:anthropic-java:3.13.0") + implementation("com.anthropic:anthropic-java:3.14.0") } application { @@ -531,7 +531,7 @@ description: Make your first API call to Claude and build a simple web search as com.anthropic anthropic-java - 3.13.0 + 3.14.0 diff --git a/content/en/manage-claude/access-transparency.md b/content/en/manage-claude/access-transparency.md index 52c9f72997..841f9a5825 100644 --- a/content/en/manage-claude/access-transparency.md +++ b/content/en/manage-claude/access-transparency.md @@ -199,6 +199,7 @@ The following table lists which surfaces are covered by Access Transparency. Cov | Claude API (`api.anthropic.com`) | Yes | Prompts, completions, and data directly embedded in the API inputs | | Claude Code (using an API key) | Yes | API traffic from Claude Code is covered as Claude API traffic | | Claude Platform on AWS | Yes | Claude Platform on AWS generates Access Transparency events within the Compliance API (not AWS CloudTrail) | +| Claude Models on Google Cloud (Anthropic managed) | Yes | Claude Models on Google Cloud (Anthropic managed) generates Access Transparency events within the Compliance API, which you [read with Google Cloud credentials](https://platform.claude.com/docs/en/manage-claude/compliance-api-access#set-up-the-compliance-api) | | Claude API (`api.anthropic.com`) (Batch, Files) | No | The Claude API Batch and Files APIs are not covered, just like they are not covered by ZDR | | Claude for Enterprise (claude.ai seats) | No | Not covered | | Claude for Work | No | Not covered | diff --git a/content/en/manage-claude/oauth-apps/endpoints-and-parameters.md b/content/en/manage-claude/oauth-apps/endpoints-and-parameters.md new file mode 100644 index 0000000000..e7dc69968e --- /dev/null +++ b/content/en/manage-claude/oauth-apps/endpoints-and-parameters.md @@ -0,0 +1,297 @@ +--- +title: OAuth endpoints and parameters +url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters +description: The endpoints, parameters, scopes, OAuth tokens, lifetimes, and errors of Claude Platform OAuth, in the order a request uses them. +--- + + + Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use. + + +In request order, this page lists the values that [Claude Platform OAuth](https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview) requests use and then the [terms used on these pages](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#terms). + +## Endpoints + +| Endpoint | URL | +| ----- | ----- | +| Authorization endpoint (the approval page) | `https://auth.claude.com/oauth/authorize` | +| Pushed authorization request (PAR) endpoint | `https://auth.claude.com/v1/oauth/par` | +| Token endpoint | `https://auth.claude.com/v1/oauth/token` | +| Revocation endpoint | `https://auth.claude.com/v1/oauth/revoke` | +| Claude API ([user profiles](https://platform.claude.com/docs/en/manage-claude/user-profiles) and requests that bill a customer) | `https://api.anthropic.com` | + +## Client authentication + +`auth.claude.com` authenticates your app with a variation of the `private_key_jwt` method ([RFC 7523](https://www.rfc-editor.org/rfc/rfc7523)). Your identity provider, not your app, issues and signs the client assertion. Its `iss` is your identity provider’s issuer. Its `aud` is your app’s configured audience, not your client ID or the full URL of the endpoint. `auth.claude.com` checks it against the keys registered for that issuer and your app’s settings. + +Send these parameters in the body of every `POST` request to the PAR, token, and revocation endpoints. + +| Parameter | Value | +| ----- | ----- | +| `client_id` | Your OAuth app’s client ID, required even with a client assertion | +| `client_assertion_type` | `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` | +| `client_assertion` | A JWT from your identity provider with the claims in [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims) | + +These rules apply to each request: + +* **Body:** It can be JSON or form-encoded (`application/x-www-form-urlencoded`). Set the `Content-Type` header to match. +* **Query string:** `auth.claude.com` rejects credentials in a URL query string. +* **HTTP Basic:** Don’t send an HTTP Basic `Authorization` header. `auth.claude.com` doesn’t read credentials from it, and the PAR endpoint can refuse a request that has one. + +### Client assertion claims + +A client assertion must contain these claims. The values to match are in your app’s [client authentication settings](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication). + +| Claim | Requirement | +| ----- | ----- | +| `iss` | Your identity provider’s issuer URL, exactly as registered through [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) | +| `sub` | Your back end’s subject. If your app’s settings have a subject pattern, the subject must match it. | +| `aud` | Exactly one audience: the value in your app’s settings, not the full URL of the endpoint you call | +| `iat` | The time your identity provider issued the JWT | +| `exp` | The expiry time, no more than your issuer’s [maximum lifetime](https://platform.claude.com/docs/en/manage-claude/wif-reference#jwt-verification) after `iat` (1 hour by default) | + +A client assertion’s header and signature must also meet these rules: + +* **Algorithm:** `RS256`, `RS384`, `RS512`, `ES256`, `ES384`, `ES512`, `PS256`, `PS384`, or `PS512`, the same list as in the [WIF reference](https://platform.claude.com/docs/en/manage-claude/wif-reference#jwt-verification). `auth.claude.com` rejects any other, including the HMAC algorithms (`HS256`, `HS384`, `HS512`) and `none`. +* **Key ID:** The header’s `kid` must name a key in your JWKS. If that key declares an `alg`, it must be the algorithm that signed the assertion. +* **Your JWKS:** Every signing key must have a `kid`. A key without one makes the whole set unusable. + +An assertion’s payload looks like this. Its `aud` is your app’s own **Expected audience**, from the app’s **Client authentication** tab: + +```json +{ + "iss": "https://idp.example.com", + "sub": "workload:prod:claude-integration-backend", + "aud": "https://auth.claude.com", + "iat": 1791230000, + "exp": 1791230300 +} +``` + +`auth.claude.com` accepts any JWT from your identity provider that matches your app’s subject pattern and claim conditions. To narrow them, see [Set up client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication). + +## Authorization requests + +To build the approval flow that uses these values, see [Send the customer to approve](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve). + +### Authorization request parameters + +Send these parameters and the ones in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication) to the PAR endpoint. + +| Parameter | Description | +| ----- | ----- | +| `response_type` | The value `code` | +| `client_id` | Your OAuth app’s client ID | +| `redirect_uri` | A URI that exactly matches a registered redirect URI, up to 2,048 characters | +| `scope` | `billing:attribution` or `billing:attribution offline_access`. See [what each scope allows](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#scopes). | +| `state` | A random, single-use value, up to 2,048 characters, that you check on the callback | +| `code_challenge` | `BASE64URL(SHA256(code_verifier))` without padding, where the `code_verifier` is 43 to 128 characters | +| `code_challenge_method` | The value `S256` | +| `connection_type` | The value `organization_shared`. An administrator approves the connection for a whole organization. | +| `connection_auth_target` | The value `platform`. The connection’s requests route to the owner of the OAuth app. | +| `user_profile_id` | The ID of a user profile in your organization that represents the customer and that isn’t archived | + +The PAR endpoint returns HTTP 201 with `request_uri` and `expires_in`. Then, send the person’s browser to the authorization endpoint with only these two parameters: + +| Parameter | Value | +| ----- | ----- | +| `client_id` | Your OAuth app’s client ID | +| `request_uri` | The value that the PAR endpoint returned | + +After the person approves, `auth.claude.com` redirects the browser to your `redirect_uri` with these query parameters: + +| Parameter | Value | +| ----- | ----- | +| `code` | The authorization code to exchange at the token endpoint | +| `state` | The `state` value that you sent. Check that it matches. | +| `iss` | `https://identity.anthropic.com/users`, which differs from the endpoints’ host. Check that it’s present and matches. | + +### Scopes + +| Scope | Description | +| ----- | ----- | +| `billing:attribution` | A connection that lets you bill a customer’s Claude organization for the Claude API requests that the customer directs you to make. Send it alone or with `offline_access`. | +| `offline_access` | Also gives your app a refresh token. On a billing connection, send it only together with `billing:attribution`. | +| `org:billing_attribution` | Deprecated: use `billing:attribution`. See [If you still use the deprecated scope](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-still-use-the-deprecated-scope). | + +### Redirect URI rules + +* Each `redirect_uri` must exactly match a URI registered on your app. There’s no wildcard or prefix matching. The one exception is a local-development URI registered with an asterisk as the port, such as `http://localhost:*/callback`, which matches any port. +* Every redirect URI must use HTTPS and must not contain a fragment. Local-development URIs on `localhost`, `127.0.0.1`, or `[::1]` may use HTTP. +* You can register up to 10 redirect URIs for each app. +* `auth.claude.com` sends errors to your redirect URI only when the `redirect_uri` matches a registered URI. For any other `redirect_uri`, it doesn’t redirect the browser. + +## OAuth tokens + +### Token request and response + +To exchange a code, send these parameters to the [token endpoint](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#endpoints): + +| Parameter | Value | +| ----- | ----- | +| `grant_type` | `authorization_code` | +| `code` | The code from the callback | +| `redirect_uri` | The same `redirect_uri` that you sent in the authorization request | +| `code_verifier` | The PKCE code verifier | +| `client_id`, `client_assertion_type`, `client_assertion` | As in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication) | + +To refresh, send `grant_type` set to `refresh_token`, the `refresh_token`, and the parameters in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication). Each refresh token works once, and a billing connection has rules of its own: see the next section and [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). + +### OAuth tokens for a billing connection + +For a `billing:attribution` connection, a refresh must not send a `scope` parameter. Both grants return these fields: + +| Response field | Value | +| ----- | ----- | +| `access_token` | The connection’s access token | +| `token_type` | `Bearer` | +| `expires_in` | Seconds until the access token expires, at most `3600` | +| `scope` | Always `workspace:inference`, not the scope that you asked for | +| `connection_id` | The connection ID, for example `ocon_01HV9Z`. Only the `authorization_code` grant returns it. | +| `refresh_token` | Returned only when the customer approved `offline_access`. A refresh returns a new one, which replaces the one you sent. | +| `refresh_token_expires_in` | Seconds until `refresh_token` expires. Absent when there’s no `refresh_token`. | + +The access token authenticates as your app’s [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#terms), in the app’s [default workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace), which the API calls its `connection_token_workspace_id` setting. On `/v1/messages` and `/v1/chat/completions`, a request with it is billed to that connection’s customer. It works only on the endpoints listed in [Call Claude with a customer’s access token](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#call-claude-with-a-token), and any other endpoint refuses it. How to use, refresh, and recover these tokens is in [Use a separate credential for each customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer). + +Each of these events revokes a `billing:attribution` connection’s tokens, the current access token included: + +* The customer or you unlink. +* The customer approves a new authorization request with different scopes for the same user profile, and you exchange its code. The new connection replaces the earlier one. +* The workspace that the tokens run in is archived. +* A refresh token that a refresh replaced is sent again more than 30 seconds later. +* You revoke one of the connection’s tokens at the [revocation endpoint](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#revocation). + +### Lifetimes + +| Item | Lifetime | +| ----- | ----- | +| `request_uri` from the PAR endpoint | 10 minutes, single use | +| Authorization code | 5 minutes, single use | +| `access_token` | Up to 1 hour | +| `refresh_token` | Up to 1 year from the code exchange. A refresh doesn’t extend it. | + +Where a response gives `expires_in` or `refresh_token_expires_in`, read the lifetime from it rather than from this table. + +### Revocation + +Send revocation requests to the revocation endpoint, `https://auth.claude.com/v1/oauth/revoke`. Besides tokens, it accepts connection and user profile IDs. To unlink a customer or link them again, see [Manage linked customers](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers). Send the parameters in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication) and exactly one of these: + +| Parameter | What it ends | +| ----- | ----- | +| `connection_id` | One of your app’s connections, given as an `ocon_` ID | +| `user_profile_id` | All of your app’s connections on one user profile, given as a `uprof_` ID | +| `token` | The connection that an access token or refresh token belongs to, and all of that connection’s tokens | + +An access token from a connection approved with the deprecated `org:billing_attribution` scope is an exception: sending it ends only that token. To end that connection, send `connection_id` or `user_profile_id`. + +`auth.claude.com` accepts `token_type_hint` and ignores it. + +The endpoint returns HTTP 200 and the IDs of the connections that the request ended: + +```json +{ + "revoked_connection_ids": ["ocon_01HV9Z"] +} +``` + +The list is empty in any of these cases, and the response doesn’t say which: + +* The token or ID is unknown or belongs to another app. +* The connection has already ended. +* The request ended a token but no connection. + +After a connection ends, the Claude API refuses requests that bill that customer with `user_profile_billing_not_authorized`, and the connection’s tokens stop working. An access token from a connection approved with the deprecated scope might instead work until it expires. + +## Protocol errors + +### Errors on the redirect + +`auth.claude.com` returns errors as `error`, `error_description`, `state`, and `iss` query parameters on your redirect URI. They are standard OAuth 2.0 errors ([RFC 6749](https://www.rfc-editor.org/rfc/rfc6749)), except `user_profile_already_linked`. + +| Error | When | +| ----- | ----- | +| `access_denied` | The person declined or can’t approve this request. See [`access_denied`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#access-denied). | +| `server_error` | `auth.claude.com` failed to process the request. Ask the person to try again. | +| `user_profile_already_linked` | The customer’s organization is already linked to your app through a different user profile, or the user profile is already linked to your app through a different organization. See [`user_profile_already_linked`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-already-linked). | + +If the `request_uri` has expired or was already used, `auth.claude.com` displays an error page and doesn’t redirect the browser. Start again with a new pushed authorization request. + +### Errors from the PAR and token endpoints + +These endpoints return a JSON body with `error` and `error_description`. + +| Error | When | +| ----- | ----- | +| `invalid_request` | A required parameter is missing or invalid, such as a missing `state`, a missing PKCE challenge, or a `user_profile_id` that isn’t an active user profile in your organization | +| `invalid_client` | The client ID is unknown, or the client assertion failed a check in [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims). Your app’s **Client authentication history** in the Claude Console says which check failed. | +| `invalid_scope` | The scope isn’t allowed for this app, a refresh of a billing connection sent a `scope` parameter, or `billing:attribution` was removed from your app. In the last case, a code exchange also uses up the code. | +| `invalid_grant` | At the code exchange: the code expired or was already used, the person who approved has signed out, or the code doesn’t match the `redirect_uri` or `code_verifier`. A mismatch uses up the code. | +| `invalid_grant` | At the code exchange: the customer approved again with the same scopes while their connection has a refresh token. See [If a customer approves again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-a-customer-approves-again). | +| `invalid_grant` | On a refresh: see [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails) | +| `unauthorized_client` | Your app isn’t set up for this request. It uses up no code and revokes no refresh token. See [`unauthorized_client`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#code-exchange-unauthorized-client) or, for a refresh, [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). | +| `user_profile_already_linked` | From the token endpoint: between the approval and the exchange, the profile or the organization was linked another way | + +Some responses come in another format, which might not be JSON. That happens when `auth.claude.com` rate-limits a request or has an outage. It also happens for an unknown `grant_type` or a parameter that’s too long. Handle a response without a string `error` by its status, using the first row that fits: + +| Status | What to do | +| ----- | ----- | +| Any status, on a refresh | Follow [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). | +| `501` | Anthropic has turned the endpoint off. Don’t retry. | +| `429` or `5xx` | Retry with backoff, and wait at least as long as any `retry-after` header says. Send each retry from your own code: an HTTP client’s automatic retries might not run for such a response. | +| Any other status | Treat it as a fault in the request. | + +### Errors from the revocation endpoint + +For most refusals, the revocation endpoint returns HTTP 400 and a JSON body with `error` and `error_description`. + +| Error | When | +| ----- | ----- | +| `invalid_request` | A parameter is missing or invalid: none or more than one of `token`, `connection_id`, and `user_profile_id`, a malformed ID, or a credential in the URL query string | +| `invalid_request` | The user profile has too many connections for one request. It might have ended some, so end the rest with each `connection_id`. | +| `invalid_client` | `auth.claude.com` couldn’t authenticate your app. Check your client assertion against [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims). Your app’s **Client authentication history** doesn’t record this endpoint. | +| `unauthorized_client` | Your app isn’t set up for this request. Contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or your Anthropic account team if you have one. | + +Other refusals carry only a status, and their body might not be JSON. When such a body is JSON, its `error` is an object, not a string: + +| Status | When | What to do | +| ----- | ----- | ----- | +| `400` | A parameter is longer than its limit | Correct the request. Don’t retry. | +| `429` | Too many failed requests came from your IP address | Retry with backoff. | +| `500` | `auth.claude.com` failed to process the request | Retry with backoff. If it keeps happening, contact support or your account team. | +| `501` | Anthropic has turned the endpoint off | Don’t retry. Contact support or your account team. | +| `503` | The request didn’t finish, and anything it ended stays ended | Retry with backoff. Use the same parameters and a new client assertion. | + +A retry after a `503` finishes the rest, and its list leaves out connections that the earlier request ended. With `connection_id`, retry at any time. With `user_profile_id`, retry within a day. After a day, a retry still ends active connections. It doesn’t revoke what’s left of the connections that the failed request ended, such as their OAuth tokens. To revoke that, send each stored `connection_id`. + +### Billing errors + +The Claude API’s errors for requests that bill a customer or that use a customer’s access token are in [Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#while-billing). + +## Standards + +| Standard | Where it applies | +| ----- | ----- | +| [OAuth 2.0 (RFC 6749)](https://www.rfc-editor.org/rfc/rfc6749) | The authorization code flow, the token endpoint, and error responses | +| [PKCE (RFC 7636)](https://www.rfc-editor.org/rfc/rfc7636) | Required with `S256` on every authorization request | +| [Pushed authorization requests (RFC 9126)](https://www.rfc-editor.org/rfc/rfc9126) | Required for Linked billing | +| [Authorization server issuer identification (RFC 9207)](https://www.rfc-editor.org/rfc/rfc9207) | The `iss` parameter on every redirect to your app | +| [Token revocation (RFC 7009)](https://www.rfc-editor.org/rfc/rfc7009) | The revocation endpoint, which also takes connection and user profile IDs | +| [JWT client authentication (RFC 7523)](https://www.rfc-editor.org/rfc/rfc7523) | Client authentication at the PAR, token, and revocation endpoints | + +## Terms used on these pages + +These meanings apply only to Claude Platform OAuth. + +| Term | Meaning | +| ----- | ----- | +| Claude organization | An organization account with Anthropic. Your company has one, and so does each customer that links its organization for billing. | +| Administrator | A member of a Claude organization with the Admin or Billing role | +| OAuth app | The registration in your Claude organization that identifies your product to `auth.claude.com`. It has a client ID, name, logo, homepage, and redirect URIs. | +| Identity provider | The service in your own infrastructure that signs short-lived JWTs for your back end and publishes its public keys as a JSON Web Key Set (JWKS). It’s never Anthropic. | +| Client assertion | A short-lived JWT that your identity provider signs and that your back end sends to authenticate your OAuth app | +| Pushed authorization request (PAR) | A request in which your back end sends the authorization parameters to `auth.claude.com` and gets a `request_uri` to use in the browser redirect | +| Workload Identity Federation | The Claude Console feature where your organization registers your identity provider so that Anthropic accepts JWTs signed with your keys | +| User profile | A record in your own Claude organization that stands for one of your customers | +| Connection | The record that ties a customer’s Claude organization to one of your user profiles, created when the customer links your app. Its ID starts with `ocon_`. | +| Service account | A non-human account in your Claude organization. Your app’s operator service account is the one your back end authenticates as to bill a customer. | +| Connection’s OAuth tokens | The access token that `auth.claude.com` returns for a connection and the refresh token it returns with `offline_access`. The access token can bill only that connection’s customer. | diff --git a/content/en/manage-claude/oauth-apps/linked-billing.md b/content/en/manage-claude/oauth-apps/linked-billing.md new file mode 100644 index 0000000000..d4d1b3136c --- /dev/null +++ b/content/en/manage-claude/oauth-apps/linked-billing.md @@ -0,0 +1,182 @@ +--- +title: Linked billing +url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing +description: Learn who pays, which customers are eligible, and whose terms apply so that you can decide whether Linked billing fits your business. +featureMetadata: + status: beta + betaHeader: user-profiles-billing-2026-10-01 + supportedModels: + - claude-fable-5-2 + - claude-mythos-5-2 + - claude-fable-5-1 + - claude-mythos-5-1 + - claude-fable-5 + - claude-mythos-5 + - claude-mythos-preview + - claude-opus-5-5 + - claude-opus-5 + - claude-sonnet-5-5 + - claude-sonnet-5 + - claude-haiku-5-5 + - claude-haiku-4-5-20251001 + - claude-opus-4-8 + - claude-opus-4-7 + - claude-opus-4-6 + - claude-sonnet-4-6 + - claude-opus-4-5-20251101 + - claude-sonnet-4-5-20250929 + supportedPlatforms: + Claude API: + availability: beta + note: Only requests that send `billing_policy` need the beta header. +--- + + + Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use. + + +Linked billing lets your customers pay for the Claude usage in your product through their own Claude organization. It’s a feature of [Claude Platform OAuth](https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview), so it works through an [OAuth app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview#your-oauth-app) that you register for your product. A customer links their organization to your app once. After that, you choose on each Claude API request whether you or the customer pays. + +## How it works + +Suppose Acme uses your product and already pays Anthropic for its own Claude usage. You create a [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles) for Acme: a record in your organization that stands for that customer. Someone at Acme clicks the [Link your Claude organization button](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button) in your product. On Claude’s approval page, they approve your app. Approving needs the Admin or Billing role in Acme’s Claude organization. They can also set a monthly [spend cap](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#spend-caps) for it. + +From then on, your back end sends Acme’s Claude API requests as your app’s [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account), a non-human account in your Claude organization. Only that account can bill linked customers. A customer’s own OAuth access token counts as that account, so a request with it can bill that customer and no other. Your back end marks the requests that Acme pays for, and Anthropic bills those to Acme’s organization, not to yours, at Acme’s own rates. The [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms) set out how customers are charged. + +### How a connection starts and ends + +Linking creates a connection, which ties the customer’s Claude organization to their user profile. The connection belongs to the customer’s organization, not to the person who approved it, so it stays if that person leaves. These are the usual ways a connection ends: + +* The customer unlinks your app. +* An Admin of your organization unlinks the customer in the Claude Console. +* Your back end ends the connection through the API. + +There are also [less common ways a connection ends](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#after-linking). Anthropic doesn’t tell you when a customer unlinks, so [check whether customers are still linked](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#check-a-links-status). + +### Choose who pays on each request + +Each request that your operator service account sends for a linked customer names their user profile in the `anthropic-user-profile-id` header. What’s in the request’s body decides who pays: + +* **The customer pays** when the body’s [`billing_policy`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#bill-a-request) field sets `bill_to` to `user_profile`. +* **You pay** when `bill_to` is `self` or when the body has no `billing_policy`. + +You can therefore bill some of a customer’s usage to them and pay for the rest yourself. A request sent with the customer’s own access token instead bills only that customer: see [Use a separate credential for each customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer). + +### When a request is refused + +If Anthropic can’t bill the customer for a request, the Claude API refuses the request. It never bills you instead. These are the usual causes: + +* The customer reached the spend cap that they set for your app, or their organization reached its monthly spend limit. +* No credit on the customer’s account can pay for the request. +* The connection has ended. + +You can send a refused request again as one that you pay for. For each refusal and its fix, see [Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors). + +## When to use it + +Linked billing fits a product whose users are mostly Claude Platform customers with their own Claude organization. To offer it, your own organization must pay Anthropic directly, through prepaid credits or invoiced billing. + +Some requests can’t be billed to a customer. To serve them, send them as requests that you pay for: + +* Requests for a customer whose organization [can’t be billed this way](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers) +* Requests to an [endpoint that can’t bill a customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#which-endpoints-can-bill-a-customer) + +### Eligible customers + +A customer can be billed this way only if their Claude organization pays Anthropic directly for its API usage, through prepaid credits or invoiced billing. These organizations can’t be billed this way: + +* Organizations billed through a cloud marketplace (AWS, Google Cloud, or Azure) +* Organizations that have only a Claude subscription with no Claude API access of their own + +An organization that has only a Claude subscription can’t link your app. An organization billed through a cloud marketplace is refused either when it tries to link or on every request that you bill to it. So a completed link doesn’t show that such an organization can be billed. + +### Which credits can pay + +Not all credit can pay for a request that an app bills to a customer. What can pay depends on the organization that’s billed: + +* **When your app bills a customer:** the customer’s organization +* **When another company’s app bills you:** your own organization + +Credit bought in the Claude Console for that organization can pay for these requests. If that organization has invoiced billing, it’s invoiced for these requests. + +Some promotional credits from Anthropic can’t pay for these requests. These include the monthly API credits that come with Claude Max, Ultra, and Team plans. Credits from Anthropic’s partner, VC, and startup programs aren’t eligible to pay for these requests. + +When nothing on that organization’s account can pay for a request, the Claude API can refuse it with a 402. The response doesn’t say whether a lack of credit or a spend limit caused the refusal. See [`linked_organization_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-spend-limit-reached). + +### Which endpoints can bill a customer + +| Endpoint | Can bill a customer | +| ----- | ----- | +| The Messages API (`/v1/messages`) | Yes, except with [billable code execution](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-code-execution) | +| OpenAI SDK compatibility (`/v1/chat/completions`) | Yes | +| [Message Batches](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-message-batches) | No | +| Claude Managed Agents | No | + +To ask for another endpoint, contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support). + +## Whose terms and limits apply + + + Don’t offer Linked billing to a customer that needs HIPAA, FERPA, or customer-managed encryption key coverage for this usage. + + +Requests that you bill to a customer still run in your organization: + +| Setting | Applies to these requests | +| ----- | ----- | +| Your rate limits, usage tier, model access, and [service tier](https://platform.claude.com/docs/en/api/service-tiers) | Yes | +| Your usage tier’s [monthly spend cap](https://platform.claude.com/docs/en/api/rate-limits#spend-limits) | Yes | +| Your data retention and encryption keys | Yes | +| The customer’s [zero data retention (ZDR)](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#zero-data-retention-zdr-scope), business associate agreement (BAA), customer-managed encryption keys (CMEK), and IP allowlist | No | +| The customer’s spend cap for your app and their organization’s monthly spend limit | Yes | +| The spend limits you set for your organization and its workspaces | No | + +Once your organization reaches your usage tier’s monthly spend cap, the Claude API refuses all its requests, including ones that bill a customer: see [`enforced_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#enforced-spend-limit-reached). Usage that you bill to a customer doesn’t count toward that cap. + +## What you may bill + +Bill a customer only for the usage that they direct you to make. That’s the Claude usage that the customer and their users cause in your product. Don’t bill them for your own usage, such as testing, evaluations, or work for other customers. The Claude API can’t check this for you, so it’s your responsibility. You accept the [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms) when you create your app. + +## Who supports the customer + +You support your customers for everything about your app, including the Claude usage that you bill to them. Anthropic gives them only [the approval page and the Linked platforms page](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see) in their Claude Console. All other questions about your app come to you, so tell your customers how to reach you. + +## Rules and special cases + +Some features can’t bill a customer, and some treat `billing_policy` in their own way. + +### If you use Message Batches + +Send the requests in a [message batch](https://platform.claude.com/docs/en/build-with-claude/batch-processing) as ones that you pay for: with `bill_to` set to `self` or without `billing_policy`. They’re billed to you as usual. A request in a batch that’s marked for the customer is refused. Its result is `errored` with an `invalid_request_error`, and nobody is billed for it. The batch’s other requests run as usual. + +### If you use code execution + +A request that bills a customer can’t use [billable code execution features](https://platform.claude.com/docs/en/about-claude/pricing#code-execution-tool): the API refuses it with a 400. Send such requests as ones that you pay for. + +### If you count tokens + +The token counting endpoint (`/v1/messages/count_tokens`) accepts the `billing_policy` field when the request has the `user-profiles-billing-2026-10-01` beta header, and ignores the field. You don’t need to remove it before you count tokens. + +## Availability + +Linked billing is in beta on every model. + +### API support + +#### [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) + +* Availability: Available + +| Status | Cloud platforms | +| ----- | ----- | +| Beta1 | Claude API | + +1. Only requests that send `billing_policy` need the beta header. + +### Required beta headers + +[Beta headers overview](https://platform.claude.com/docs/en/api/beta-headers) + +Beta headers allow you to access experimental features and new model capabilities before they become part of the standard API. + +* `user-profiles-billing-2026-10-01` diff --git a/content/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer.md b/content/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer.md new file mode 100644 index 0000000000..011d382173 --- /dev/null +++ b/content/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer.md @@ -0,0 +1,2285 @@ +--- +title: Use a separate credential for each customer +url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer +description: Call Claude with each customer's own OAuth access token, so that code you don't fully control can bill only that customer. +--- + + + Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use. + + +Each customer you link with [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing) comes with their own credential: an OAuth access token that can bill only that customer. Use it when code that you don’t fully control calls Claude for one customer, for example in an agent’s sandbox or a single-tenant deployment. A bug or a leak in that code can then bill only that customer. + +If every request that bills a customer comes from your own back end, you don’t need these credentials. [Bill customers as your operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#bill-a-request), and skip this page. + +## Before you begin + +* **The customer’s OAuth tokens and connection ID:** The code exchange returned them when you [linked the customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#save-the-connection-and-its-tokens). A connection is the record that ties the customer’s Claude organization to one of your [user profiles](https://platform.claude.com/docs/en/manage-claude/user-profiles). +* **A refresh token:** [**Offline access**](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#choose-whether-to-get-refresh-tokens) is on for your app, and the customer approved `billing:attribution offline_access`. A customer who approved without `offline_access` gets a refresh token by [approving again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-a-customer-approves-again), which replaces their connection without an unlink. +* **For the refresh samples:** A client assertion: a JWT from your identity provider for your app’s **Expected audience**, set up as your app’s [client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication). The samples read it from the file that the `CLIENT_ASSERTION_FILE` environment variable names or from the `CLIENT_ASSERTION` shell variable. + +## Keep the OAuth tokens secret + +Store each customer’s access token, refresh token, and their expiry times in a secret store that only the refreshing service can read. Anyone who holds an access token can bill that customer until the token expires. If a token leaks, [unlink the customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#unlink-a-customer) first, then link them again. If you lose a refresh token, [link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). + +## Call Claude with a customer’s access token + +Send the customer’s access token in place of your operator service account’s credential: + +* **In the Anthropic SDK:** Pass the customer’s access token as the client’s authentication token when you build the client. +* **In the `ant` CLI:** Set `ANTHROPIC_AUTH_TOKEN` to the token for the command. +* **In an HTTP request:** Send it as a bearer token in the `Authorization` header. Don’t send an `x-api-key` header. + + + Unset `ANTHROPIC_API_KEY` wherever you use a customer’s access token: some clients send the key instead, and Anthropic can bill you. + + +Those clients are the `ant` CLI and an SDK client that reads the token from `ANTHROPIC_AUTH_TOKEN`. For the reason and a guard against it, see [If an API key can reach the process](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-an-api-key-can-reach-the-process). If your lookup finds no token for the customer, stop before you build the client. Given a null token, the SDK might fall back to your own credential and bill you. + + + ```bash cURL + curl https://api.anthropic.com/v1/messages \ + -H "authorization: Bearer $CUSTOMER_ACCESS_TOKEN" \ + -H "anthropic-version: 2026-10-21" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-5-5", + "max_tokens": 1024, + "messages": [{"role": "user", "content": "Hello, Claude"}] + }' + ``` + + ```bash CLI + ANTHROPIC_AUTH_TOKEN="$CUSTOMER_ACCESS_TOKEN" ant messages create \ + --model claude-opus-5-5 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' + ``` + + ```python Python + client = anthropic.Anthropic(auth_token=customer_access_token) + + message = client.messages.create( + model="claude-opus-5-5", + max_tokens=1024, + messages=[{"role": "user", "content": "Hello, Claude"}], + ) + + for block in message.content: + if block.type == "text": + print(block.text) + ``` + + ```typescript TypeScript + const client = new Anthropic({ authToken: customerAccessToken }); + + const message = await client.messages.create({ + model: "claude-opus-5-5", + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }] + }); + + for (const block of message.content) { + if (block.type === "text") { + console.log(block.text); + } + } + ``` + + ```csharp C# + AnthropicClient client = new() { AuthToken = customerAccessToken }; + + var message = await client.Messages.Create( + new MessageCreateParams + { + Model = Model.ClaudeOpus5_5, + MaxTokens = 1024, + Messages = [new UserMessageParam { Content = "Hello, Claude" }], + } + ); + + foreach (var block in message.Content) + { + if (block.TryPickText(out var textBlock)) + { + Console.WriteLine(textBlock.Text); + } + } + ``` + + ```go Go + client := anthropic.NewClient(option.WithAuthToken(customerAccessToken)) + + message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{ + Model: anthropic.ModelClaudeOpus5_5, + MaxTokens: 1024, + Messages: []anthropic.MessageParam{ + anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")), + }, + }) + if err != nil { + log.Fatal(err) + } + + for _, block := range message.Content { + if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok { + fmt.Println(textBlock.Text) + } + } + ``` + + ```java Java + AnthropicClient client = AnthropicOkHttpClient.builder() + .authToken(customerAccessToken) + .build(); + // ... + + var params = MessageCreateParams.builder() + .model(Model.CLAUDE_OPUS_5_5) + .maxTokens(1024) + .addUserMessage("Hello, Claude") + .build(); + var message = client.messages().create(params); + + for (var block : message.content()) { + block.text().ifPresent(textBlock -> IO.println(textBlock.text())); + } + ``` + + ```php PHP + $client = new Client(authToken: $customerAccessToken); + + $message = $client->messages->create( + maxTokens: 1024, + messages: [['role' => 'user', 'content' => 'Hello, Claude']], + model: Model::CLAUDE_OPUS_5_5, + ); + + foreach ($message->content as $block) { + if ($block instanceof \Anthropic\Messages\TextBlock) { + echo $block->text, PHP_EOL; + } + } + ``` + + ```ruby Ruby + client = Anthropic::Client.new(auth_token: customer_access_token) + + message = client.messages.create( + model: Anthropic::Model::CLAUDE_OPUS_5_5, + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }] + ) + + message.content.each do |block| + puts(block.text) if block.is_a?(Anthropic::Models::TextBlock) + end + ``` + + +A customer’s access token works on these endpoints only: + +* `/v1/messages` and `/v1/chat/completions` +* `/v1/messages/count_tokens` +* the Models endpoints + +On `/v1/messages` and `/v1/chat/completions`, the access token alone bills the customer. You don’t need the `anthropic-user-profile-id` header or [`billing_policy`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#bill-a-request). + +Send every other request and every request that you pay for as your operator service account. That includes requests that use billable code execution, which [can’t bill a customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-code-execution). + +Requests with the token run in the workspace that you set as your app’s default. Archiving it revokes every token in it: see [If you move to another workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-move-to-another-workspace). If a request with the token is refused, see [Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors). + +## Refresh the OAuth tokens + +A customer’s access token lasts at most 1 hour. Before it expires, send the customer’s refresh token to the token endpoint for a new pair of tokens. Each refresh token works once, apart from a single repeat within 30 seconds to recover an answer that you lost. + + + A refresh token sent again more than 30 seconds after its first use ends the customer’s connection, and you have to link them again. + + +To make sure that you never send a used token late: + +* Turn off automatic retries for the refresh request in your HTTP client and in any proxy. +* Refresh each customer’s OAuth tokens from one service, one refresh at a time for each customer. If the service has replicas, give them a shared lock. Hold it from reading a customer’s stored tokens until the new ones are stored. +* Store the new refresh token before you use the new access token. + +The request is a `refresh_token` grant to `auth.claude.com`. It carries the refresh token and your app’s [client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication): `client_id` and a client assertion. No SDK covers `auth.claude.com`, so the samples call it over HTTP. They show the plain call with no failure handling: + + + ```bash cURL + curl https://auth.claude.com/v1/oauth/token \ + -H "content-type: application/json" \ + -d @- < + The `ant` CLI has no command for `auth.claude.com`. Send the refresh with cURL or in your application’s language. + + + ```python Python + import os + from pathlib import Path + + import httpx2 # comes with the Anthropic SDK + + + def refresh_tokens(refresh_token: str) -> dict: + assertion_file = Path(os.environ["CLIENT_ASSERTION_FILE"]) + + response = httpx2.post( + "https://auth.claude.com/v1/oauth/token", + json={ + "grant_type": "refresh_token", + "refresh_token": refresh_token, + "client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": assertion_file.read_text().strip(), + }, + timeout=10, + ) + if not response.is_success: + raise RuntimeError(f"Refresh failed: {response.status_code} {response.text}") + return response.json() # the new access_token and refresh_token + ``` + + ```typescript TypeScript + import { readFile } from "node:fs/promises"; + + async function refreshTokens(refreshToken: string) { + const jwt = await readFile(process.env.CLIENT_ASSERTION_FILE!, "utf8"); + + const response = await fetch("https://auth.claude.com/v1/oauth/token", { + method: "POST", + redirect: "error", + signal: AbortSignal.timeout(10_000), + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + grant_type: "refresh_token", + refresh_token: refreshToken, + client_id: "clid_01ABcDeFgHiJkLmNoPqRsTuV", + client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + client_assertion: jwt.trim() + }) + }); + if (!response.ok) { + throw new Error(`Refresh failed: ${response.status} ${await response.text()}`); + } + return response.json(); // the new access_token and refresh_token + } + ``` + + ```csharp C# + using System.Net.Http.Json; + using System.Text.Json; + + using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) }; + + async Task RefreshTokens(string refreshToken) + { + var assertionFile = Environment.GetEnvironmentVariable("CLIENT_ASSERTION_FILE")!; + var jwt = await File.ReadAllTextAsync(assertionFile); + + using var response = await http.PostAsJsonAsync( + "https://auth.claude.com/v1/oauth/token", + new Dictionary + { + ["grant_type"] = "refresh_token", + ["refresh_token"] = refreshToken, + ["client_id"] = "clid_01ABcDeFgHiJkLmNoPqRsTuV", + ["client_assertion_type"] = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + ["client_assertion"] = jwt.Trim(), + } + ); + if (!response.IsSuccessStatusCode) + { + var details = await response.Content.ReadAsStringAsync(); + throw new HttpRequestException($"Refresh failed: {(int)response.StatusCode} {details}"); + } + + // The new access_token and refresh_token + return await response.Content.ReadFromJsonAsync(); + } + ``` + + ```go Go + import ( + "bytes" + "encoding/json" + "fmt" + "io" + "net/http" + "os" + "strings" + "time" + ) + + var httpClient = &http.Client{Timeout: 10 * time.Second} + + func refreshTokens(refreshToken string) (map[string]any, error) { + jwt, err := os.ReadFile(os.Getenv("CLIENT_ASSERTION_FILE")) + if err != nil { + return nil, err + } + + body, err := json.Marshal(map[string]string{ + "grant_type": "refresh_token", + "refresh_token": refreshToken, + "client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": strings.TrimSpace(string(jwt)), + }) + if err != nil { + return nil, err + } + + endpoint := "https://auth.claude.com/v1/oauth/token" + response, err := httpClient.Post(endpoint, "application/json", bytes.NewReader(body)) + if err != nil { + return nil, err + } + defer response.Body.Close() + if response.StatusCode/100 != 2 { + details, _ := io.ReadAll(response.Body) + return nil, fmt.Errorf("refresh failed: %d %s", response.StatusCode, details) + } + + var tokens map[string]any // the new access_token and refresh_token + err = json.NewDecoder(response.Body).Decode(&tokens) + return tokens, err + } + ``` + + ```java Java + import module java.base; + import module java.net.http; + import com.fasterxml.jackson.databind.JsonNode; + import com.fasterxml.jackson.databind.ObjectMapper; // Jackson comes with the Anthropic SDK + + final HttpClient http = HttpClient.newHttpClient(); + final ObjectMapper mapper = new ObjectMapper(); + + JsonNode refreshTokens(String refreshToken) throws Exception { + var jwt = Files.readString(Path.of(System.getenv("CLIENT_ASSERTION_FILE"))); + + var body = mapper.createObjectNode() + .put("grant_type", "refresh_token") + .put("refresh_token", refreshToken) + .put("client_id", "clid_01ABcDeFgHiJkLmNoPqRsTuV") + .put("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") + .put("client_assertion", jwt.strip()); + + var request = HttpRequest.newBuilder(URI.create("https://auth.claude.com/v1/oauth/token")) + .header("content-type", "application/json") + .timeout(Duration.ofSeconds(10)) + .POST(HttpRequest.BodyPublishers.ofString(body.toString())) + .build(); + var response = http.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() / 100 != 2) { + throw new IOException("Refresh failed: " + response.statusCode() + " " + response.body()); + } + return mapper.readTree(response.body()); // the new access_token and refresh_token + } + ``` + + ```php PHP + function refreshTokens(string $refreshToken): mixed + { + $jwt = file_get_contents((string) getenv('CLIENT_ASSERTION_FILE')) + ?: throw new \RuntimeException('Cannot read the client assertion file'); + + $body = json_encode([ + 'grant_type' => 'refresh_token', + 'refresh_token' => $refreshToken, + 'client_id' => 'clid_01ABcDeFgHiJkLmNoPqRsTuV', + 'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', + 'client_assertion' => trim($jwt), + ], JSON_THROW_ON_ERROR); + + $context = stream_context_create(['http' => [ + 'method' => 'POST', + 'header' => 'content-type: application/json', + 'content' => $body, + 'timeout' => 10, + 'ignore_errors' => true, // keep the body of an error response + ]]); + $response = file_get_contents('https://auth.claude.com/v1/oauth/token', context: $context); + $status = http_get_last_response_headers()[0] ?? ''; + if ($response === false || !preg_match('{^HTTP/\S+ 2}', $status)) { + throw new \RuntimeException("Refresh failed: {$status} {$response}"); + } + + // The new access_token and refresh_token + return json_decode($response, associative: true, flags: JSON_THROW_ON_ERROR); + } + ``` + + ```ruby Ruby + require "json" + require "net/http" + + def refresh_tokens(refresh_token) + jwt = File.read(ENV.fetch("CLIENT_ASSERTION_FILE")) + + body = { + grant_type: "refresh_token", + refresh_token:, + client_id: "clid_01ABcDeFgHiJkLmNoPqRsTuV", + client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + client_assertion: jwt.strip + } + response = Net::HTTP.start("auth.claude.com", 443, use_ssl: true, read_timeout: 10) do |http| + http.post("/v1/oauth/token", body.to_json, "content-type" => "application/json") + end + unless response.is_a?(Net::HTTPSuccess) + raise "Refresh failed: #{response.code} #{response.body}" + end + + JSON.parse(response.body) # the new access_token and refresh_token + end + ``` + + +The response holds a new access token and a new refresh token. `expires_in` and `refresh_token_expires_in` give their lifetimes in seconds. The new refresh token replaces the one you sent, and the earlier access token stops working within a few minutes. + +Before you send a token again after a failed refresh, read [what to do if a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). Some retries end the connection, and some failures mean that you pause every customer’s refreshes. The [full refresh sample](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#full-refresh-sample) handles those failures. + +A refresh token lasts at most 1 year from the code exchange, and a refresh doesn’t extend that. Before it expires, [link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). + +## Run an agent in a sandbox + +Before you use this section, read section 4.1(b) of the [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms). If you have a question about it, ask your Anthropic account team. + +When an agent works for one customer in a sandbox, follow these rules: + +* Give the sandbox only the access token, never the refresh token. Your back end refreshes the tokens and sends each new access token to the sandbox. +* Decide which customer a sandbox serves from the sandbox’s own identity, such as its pod identity. Never decide from a value that the sandbox sends. +* Send a sandbox only the token of the customer it serves. +* Give the sandbox no mounted identity token and no access to a cloud metadata server. + +That last rule keeps the sandbox from getting a JWT that matches your app’s client authentication or one of your [federation rules](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation). With such a JWT, code in the sandbox could authenticate as your app or as one of your service accounts. + +The Anthropic SDK, Claude Code, and the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview) can read the access token from a credentials file in a configuration profile. For the file’s format, see [Profile configuration file](https://platform.claude.com/docs/en/manage-claude/wif-reference#profile-configuration-file). To set up the sandbox: + + + + In the sandbox, create a configuration directory. Inside it, add a profile at `configs/customer.json` whose authentication type is `user_oauth`. Don’t give the profile a `client_id`: with one, the SDK expects a refresh token in the file and refreshes the token itself. + + + ```json + { + "version": "1.0", + "authentication": { + "type": "user_oauth" + } + } + ``` + + + + + Before the agent starts, write the access token to `credentials/customer.json` in the same configuration directory, so that `configs` and `credentials` sit side by side. Write it again right after each refresh. `expires_at` is the token’s expiry time in Unix seconds. For code that writes it safely, see [When you write each new access token to a sandbox](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#when-you-write-each-new-token-to-a-sandbox). + + ```json credentials/customer.json + { + "type": "oauth_token", + "access_token": "sk-ant-oat01-...", + "expires_at": 1793635200 + } + ``` + + + + Set `ANTHROPIC_CONFIG_DIR` to the configuration directory and `ANTHROPIC_PROFILE` to `customer`. + + + + Unset every other credential in the sandbox, because each can take precedence over the profile. These include: + + * the `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN` environment variables + * Claude Code’s `CLAUDE_CODE_OAUTH_TOKEN` environment variable and `apiKeyHelper` setting + + + +The SDK picks up each new token without a restart: see [When you write each new access token to a sandbox](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#when-you-write-each-new-token-to-a-sandbox). + +## Check the result + +To confirm that a request billed the customer, see [where a billed request appears](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#check-the-result). To confirm that a token is limited to its customer: + +* A request with the token that names another of your user profiles gets `400 invalid_request_error`. +* A few minutes after a refresh, a request with the earlier access token gets `401 authentication_error`. + +## Decide whether to turn off operator-only authentication + +By default, your operator service account can bill any linked customer without the customer’s access token. It names the customer’s user profile and sets `bill_to: "user_profile"` in [`billing_policy`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#bill-a-request). This default is called operator-only authentication, and it keeps working after a customer’s access token expires. + +Once every customer’s requests use their own access token, you can turn off operator-only authentication. Then, only a customer’s own access token can bill them, so a bug that names the wrong user profile can’t bill the wrong customer. + +Every customer’s requests then depend on refreshes. If you lose a customer’s refresh token, you can’t bill them until they [link again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). Anything that stops refreshes, such as turning off **Offline access** or clearing the [default workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace), makes every customer’s requests fail as their access tokens expire. + +The Claude Console checks only that your app has `billing:attribution`, `offline_access`, and a default workspace. Before you turn off operator-only authentication, check these yourself: + +* Your store holds a refresh token for every linked customer. +* Your requests with their access tokens work. + +To turn off operator-only authentication: + +1. Open the app’s **Client authentication** tab in the Console. +2. Under the operator service account, turn on **Disable operator-only tokenless authentication** and confirm in the dialog box. Its name in the API is `disable_operator_only_auth`. + +These rules then apply: + +* A request from the service account alone that sets `bill_to: "user_profile"` for a linked customer gets `403 user_profile_not_billable`. The customer still shows as **Linked**, so watch your logs for this error. +* The service account can still manage user profiles and send the requests that you pay for. +* To go back to the default, turn the same setting off. + +## Implementation details, rules, and special cases + +The rest of this page is the detail behind the steps. It covers failed refreshes, a full refresh sample, and how an API key or a refresh affects a running client. A customer who approved only the deprecated scope has no access token of their own: see [If you still use the deprecated scope](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-still-use-the-deprecated-scope). + +### If a refresh fails + +A refresh replaces the refresh token that you sent. What happens when the replaced token arrives again depends on when it arrives: + +* **Within 30 seconds, the first time:** It returns a new pair of tokens and revokes the pair that you never received. This lets you repeat a refresh whose answer you lost. +* **Within 30 seconds, the first time, if the token that you sent was under 30 seconds old when it was replaced:** It gets `invalid_grant`, and the connection stays. +* **Within 30 seconds, any later time:** It gets `invalid_grant`, and the connection stays. +* **After 30 seconds:** It gets `invalid_grant` and ends the connection. Every token is revoked, the customer shows as **Unlinked**, and nothing can bill them until they link again. + +After a failed refresh, what to do depends on whether the refresh token reached `auth.claude.com` and was used: + +| What the refresh got | What it means | What to do | +| ----- | ----- | ----- | +| The request couldn’t reach `auth.claude.com`, including a connect timeout | The token wasn’t sent | Send it again later | +| `429` | Nothing was revoked | Wait, then send it again | +| A `503` refusal: a `retry-after` header and `"type": "error"` at the top level of the body | Nothing was revoked | Wait, then send it again | +| Any other `4xx`, except `invalid_grant` | Nothing was revoked | Fix the cause, then send it again | +| Any other `5xx` or a network drop after the request went out | It might have worked | Send it once more, right away | +| No answer in time (a read timeout) | It might still be running | Don’t send it again | +| `invalid_grant` | The token can’t be used now | Stop sending it | + +**Wait, then send it again:** Wait at least as long as `retry-after` says. If a `429` has no `retry-after` header, back off before you send it again. A `503` that lacks either mark counts as any other `5xx`. + +**Fix the cause, then send it again:** + +* `unauthorized_client`: `error_description` usually names the cause, such as a missing default workspace or `offline_access` no longer on your app. +* `invalid_client`: your client assertion failed. Check it against [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims). +* `invalid_scope`: the request sent a `scope` parameter, or `billing:attribution` is no longer on your app. +* Any other `4xx`, such as `invalid_request`: correct the request. + +If you changed or archived the operator service account, every refresh of a working token gets `unauthorized_client`, and sending again can’t help. See [If you change the service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-change-the-service-account). + +**Send it once more, right away:** `auth.claude.com` must receive the second request within 30 seconds of replacing the token. You can’t see when that was, so count from when you sent the first request, and leave time for the second to arrive. Then: + +* If the second request returns new tokens, store them and use only them. +* If it returns anything else, gets no answer, or can’t go out in time, don’t send the token again. + +**Don’t send it again:** After a read timeout or a lost answer that you can’t recover, stop refreshing that customer and [link them again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). + +**Stop sending it:** Stop refreshing that customer. `invalid_grant` usually means one of these, and the response doesn’t say which, so check the first two before you link anyone again: + +* The customer’s organization is suspended. Don’t unlink the customer, and keep the refresh token: it works again after the suspension ends. To find out, ask [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or your Anthropic account team if you have one. +* Every customer’s refresh got `invalid_grant` at the same time. Look for a cause on your side, such as an [archived workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-move-to-another-workspace). +* The token expired or was already used, the connection ended, or its workspace was archived. [Link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). + +A lost network connection, a `5xx` response, or a timeout can mean that `auth.claude.com` has a fault. If one made you stop refreshing a customer, keep the fault from costing you more connections: + +1. Pause the refreshes of your other customers. +2. Refresh one customer. +3. Resume the rest only after that refresh succeeds or gets a `4xx` response. + +### Full refresh sample + +This version of the refresh follows [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). It adds these safeguards to the plain call: + +* It refreshes when the access token has less than 10 minutes left. +* It holds a lock for each customer from reading the stored tokens until the new ones are stored. +* Before the refresh token leaves the process, it marks the stored tokens `on_hold` (typescript, java, php: `onHold`; csharp, go: `OnHold`), so that a crash can’t lead to a second send. +* It waits up to 2 seconds to reach `auth.claude.com` and 10 seconds for an answer. +* It sends a second request only within 4 seconds of the first. That leaves time for the second to arrive within the 30 seconds. It also keeps the second inside the 10-second wait, so that a request that timed out is never sent again. +* If only the write to your secret store fails, it tries the write again and doesn’t refresh again. + +The sample leaves three things to you: + +* a lock that all your replicas share, because its own lock doesn’t reach your other replicas +* waiting and sending again after a `429` or a `503` refusal, which it reports as an error +* pausing the refreshes of your other customers after a lost refresh, on every replica + +Call the refresh function for each customer more often than every 10 minutes, so that it always runs inside that margin. + +`refresh_connection()` (typescript, go, java, php: `refreshConnection()`; csharp: `Connections.RefreshConnection()`) fails with `RefreshOnHoldError` (csharp, java, php: `RefreshOnHoldException`) when a refresh token must not be sent again. It also fails on every later call for that customer. The stored record keeps `on_hold` (typescript, java, php: `onHold`; csharp, go: `OnHold`) and `hold_reason` (typescript, java, php: `holdReason`; csharp, go: `HoldReason`), so that you can tell later why the hold was set. When only the write failed, the error’s `new_tokens` (typescript, java, php: `newTokens`; csharp, go: `NewTokens`) holds the tokens to store. + +The following setup defines the shared names. You write `load_tokens()` (typescript, go, java, php: `loadTokens()`; csharp: `LoadTokens()`) and `save_tokens()` (typescript, go, java, php: `saveTokens()`; csharp: `SaveTokens()`) for your own secret store. + + + + This setup goes with the refresh function that follows, which needs more logic than a single shell command. Write both in your application’s language. + + + + This setup goes with the refresh function that follows, which needs more logic than a single shell command. Write both in your application’s language. + + + ```python Python + import os + import threading + import time + from collections import defaultdict + from dataclasses import dataclass, field, replace + from pathlib import Path + + import httpx2 # comes with the Anthropic SDK + + TOKEN_URL = "https://auth.claude.com/v1/oauth/token" + CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV" + JWT_BEARER = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" + REFRESH_MARGIN_SECONDS = 600 + REQUEST_TIMEOUT = httpx2.Timeout(10, connect=2) + SECOND_REQUEST_DEADLINE_SECONDS = 4 # keep this under the 10-second read timeout + + + @dataclass + class ConnectionTokens: + refresh_token: str = field(repr=False) + access_token: str = field(repr=False) + expires_at: int # Unix seconds + refresh_expires_at: int # Unix seconds + on_hold: bool = False # True: the refresh token might have been used + hold_reason: str | None = None # "lost" or "invalid_grant" + + + class RefreshOnHoldError(Exception): + """The refresh token must not be sent again. Don't catch this to try again. + + If new_tokens is set, only the write failed: store those tokens. + """ + + new_tokens: ConnectionTokens | None = None + + + def client_assertion() -> str: + """Reads the JWT that authenticates your app to auth.claude.com.""" + return Path(os.environ["CLIENT_ASSERTION_FILE"]).read_text().strip() + + + def load_tokens(connection_id: str) -> ConnectionTokens: + """Reads the connection's newest tokens from your secret store.""" + raise NotImplementedError("Read the tokens from your secret store.") + + + def save_tokens(connection_id: str, tokens: ConnectionTokens) -> None: + """Writes the connection's newest tokens to your secret store.""" + raise NotImplementedError("Write the tokens to your secret store.") + ``` + + ```typescript TypeScript + import { readFile } from "node:fs/promises"; + import type { IncomingHttpHeaders } from "node:http"; + import { request } from "node:https"; + + const TOKEN_URL = "https://auth.claude.com/v1/oauth/token"; + const CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV"; + const JWT_BEARER = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"; + const REFRESH_MARGIN_SECONDS = 600; + const SECOND_REQUEST_DEADLINE_MS = 4_000; // keep this under the 10-second timeout + + interface ConnectionTokens { + refreshToken: string; + accessToken: string; + expiresAt: number; // Unix seconds + refreshExpiresAt: number; // Unix seconds + onHold?: boolean; // true: the refresh token might have been used + holdReason?: "lost" | "invalid_grant"; + } + + /** The refresh token must not be sent again. Don't catch this to try again. */ + class RefreshOnHoldError extends Error { + override name = "RefreshOnHoldError"; + readonly #newTokens?: ConnectionTokens; // private, so that printing the error doesn't show them + + constructor(message: string, newTokens?: ConnectionTokens) { + super(message); + this.#newTokens = newTokens; + } + + /** If set, only the write failed: store these tokens. */ + get newTokens() { + return this.#newTokens; + } + } + + /** Reads the JWT that authenticates your app to auth.claude.com. */ + async function clientAssertion(): Promise { + return (await readFile(process.env.CLIENT_ASSERTION_FILE!, "utf8")).trim(); + } + + /** Reads the connection's newest tokens from your secret store. */ + async function loadTokens(connectionId: string): Promise { + throw new Error("Read the tokens from your secret store."); + } + + /** Writes the connection's newest tokens to your secret store. */ + async function saveTokens(connectionId: string, tokens: ConnectionTokens): Promise { + throw new Error("Write the tokens to your secret store."); + } + ``` + + ```csharp C# + using System.Collections.Concurrent; + using System.Diagnostics; + using System.Text; + using System.Text.Json; + + record ConnectionTokens( + string RefreshToken, + string AccessToken, + long ExpiresAt, // Unix seconds + long RefreshExpiresAt, // Unix seconds + bool OnHold = false, // true: the refresh token might have been used + string? HoldReason = null // "lost" or "invalid_grant" + ) + { + // Keeps the tokens out of logs. + public override string ToString() => + $"ConnectionTokens {{ ExpiresAt = {ExpiresAt}, OnHold = {OnHold}, HoldReason = {HoldReason} }}"; + } + + /// The refresh token must not be sent again. Don't catch this to try again. + class RefreshOnHoldException(string message) : Exception(message) + { + /// If set, only the write failed: store these tokens. + public ConnectionTokens? NewTokens { get; init; } + } + + static partial class Connections + { + const string TokenUrl = "https://auth.claude.com/v1/oauth/token"; + const string ClientId = "clid_01ABcDeFgHiJkLmNoPqRsTuV"; + const string JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"; + const int RefreshMarginSeconds = 600; + static readonly TimeSpan SecondRequestDeadline = TimeSpan.FromSeconds(4); // keep this under the 10-second timeout + + /// Reads the JWT that authenticates your app to auth.claude.com. + static string ClientAssertion() => + File.ReadAllText(Environment.GetEnvironmentVariable("CLIENT_ASSERTION_FILE")!).Trim(); + + /// Reads the connection's newest tokens from your secret store. + static Task LoadTokens(string connectionId) => + throw new NotImplementedException("Read the tokens from your secret store."); + + /// Writes the connection's newest tokens to your secret store. + static Task SaveTokens(string connectionId, ConnectionTokens tokens) => + throw new NotImplementedException("Write the tokens to your secret store."); + } + ``` + + ```go Go + import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "net" + "net/http" + "net/http/httptrace" + "os" + "strings" + "sync" + "time" + ) + + const ( + tokenURL = "https://auth.claude.com/v1/oauth/token" + clientID = "clid_01ABcDeFgHiJkLmNoPqRsTuV" + jwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" + refreshMargin = 10 * time.Minute + secondRequestDeadline = 4 * time.Second // keep this under the 10-second timeout + ) + + var httpClient = &http.Client{ + Timeout: 10 * time.Second, + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{Timeout: 2 * time.Second}).DialContext, + TLSHandshakeTimeout: 2 * time.Second, + }, + CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }, + } + + type ConnectionTokens struct { + RefreshToken string + AccessToken string + ExpiresAt int64 // Unix seconds + RefreshExpiresAt int64 // Unix seconds + OnHold bool // true: the refresh token might have been used + HoldReason string // "lost" or "invalid_grant" + } + + // String keeps the tokens out of logs. + func (t ConnectionTokens) String() string { + return fmt.Sprintf("ConnectionTokens{ExpiresAt: %d, OnHold: %t, HoldReason: %q}", t.ExpiresAt, t.OnHold, t.HoldReason) + } + + // RefreshOnHoldError means the refresh token must not be sent again. Don't try again. + type RefreshOnHoldError struct { + Message string + NewTokens *ConnectionTokens // if set, only the write failed: store these tokens + } + + func (e *RefreshOnHoldError) Error() string { return e.Message } + + // clientAssertion reads the JWT that authenticates your app to auth.claude.com. + func clientAssertion() (string, error) { + jwt, err := os.ReadFile(os.Getenv("CLIENT_ASSERTION_FILE")) + return strings.TrimSpace(string(jwt)), err + } + + // loadTokens reads the connection's newest tokens from your secret store. + func loadTokens(connectionID string) (ConnectionTokens, error) { + return ConnectionTokens{}, errors.New("read the tokens from your secret store") + } + + // saveTokens writes the connection's newest tokens to your secret store. + func saveTokens(connectionID string, tokens ConnectionTokens) error { + return errors.New("write the tokens to your secret store") + } + ``` + + ```java Java + import module java.base; + import module java.net.http; + import com.fasterxml.jackson.databind.JsonNode; + import com.fasterxml.jackson.databind.ObjectMapper; // Jackson comes with the Anthropic SDK + + static final URI TOKEN_URL = URI.create("https://auth.claude.com/v1/oauth/token"); + static final String CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV"; + static final String JWT_BEARER = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"; + static final long REFRESH_MARGIN_SECONDS = 600; + static final Duration SECOND_REQUEST_DEADLINE = Duration.ofSeconds(4); // keep this under the 10-second read timeout + + record ConnectionTokens( + String refreshToken, + String accessToken, + long expiresAt, // Unix seconds + long refreshExpiresAt, // Unix seconds + boolean onHold, // true: the refresh token might have been used + String holdReason // "lost" or "invalid_grant" + ) { + @Override // keeps the tokens out of logs + public String toString() { + return "ConnectionTokens[expiresAt=" + expiresAt + ", onHold=" + onHold + ", holdReason=" + holdReason + "]"; + } + + ConnectionTokens withHold(String reason) { + return new ConnectionTokens(refreshToken, accessToken, expiresAt, refreshExpiresAt, true, reason); + } + } + + record AccessToken(String value, long expiresAt /* Unix seconds */) { + @Override // keeps the token out of logs + public String toString() { + return "AccessToken[expiresAt=" + expiresAt + "]"; + } + } + + /** The refresh token must not be sent again. Don't catch this to try again. */ + static class RefreshOnHoldException extends RuntimeException { + /** If set, only the write failed: store these tokens. */ + ConnectionTokens newTokens; + + RefreshOnHoldException(String message) { + super(message); + } + } + + /** Reads the JWT that authenticates your app to auth.claude.com. */ + String clientAssertion() throws IOException { + return Files.readString(Path.of(System.getenv("CLIENT_ASSERTION_FILE"))).strip(); + } + + /** Reads the connection's newest tokens from your secret store. */ + ConnectionTokens loadTokens(String connectionId) throws IOException { + throw new UnsupportedOperationException("Read the tokens from your secret store."); + } + + /** Writes the connection's newest tokens to your secret store. */ + void saveTokens(String connectionId, ConnectionTokens tokens) throws IOException { + throw new UnsupportedOperationException("Write the tokens to your secret store."); + } + ``` + + ```php PHP + const TOKEN_URL = 'https://auth.claude.com/v1/oauth/token'; + const CLIENT_ID = 'clid_01ABcDeFgHiJkLmNoPqRsTuV'; + const JWT_BEARER = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'; + const REFRESH_MARGIN_SECONDS = 600; + const SECOND_REQUEST_DEADLINE_SECONDS = 4; // keep this under the 10-second timeout + + final class ConnectionTokens + { + public function __construct( + public readonly string $refreshToken, + public readonly string $accessToken, + public readonly int $expiresAt, // Unix seconds + public readonly int $refreshExpiresAt, // Unix seconds + public readonly bool $onHold = false, // true: the refresh token might have been used + public readonly ?string $holdReason = null, // 'lost' or 'invalid_grant' + ) {} + + /** Keeps the tokens out of var_dump and print_r. */ + public function __debugInfo(): array + { + return ['expiresAt' => $this->expiresAt, 'onHold' => $this->onHold, 'holdReason' => $this->holdReason]; + } + + public function withHold(string $reason): self + { + return new self( + refreshToken: $this->refreshToken, + accessToken: $this->accessToken, + expiresAt: $this->expiresAt, + refreshExpiresAt: $this->refreshExpiresAt, + onHold: true, + holdReason: $reason, + ); + } + } + + /** The refresh token must not be sent again. Don't catch this to try again. */ + final class RefreshOnHoldException extends \RuntimeException + { + /** If set, only the write failed: store these tokens. */ + public ?ConnectionTokens $newTokens = null; + } + + /** Reads the JWT that authenticates your app to auth.claude.com. */ + function clientAssertion(): string + { + $jwt = file_get_contents((string) getenv('CLIENT_ASSERTION_FILE')) + ?: throw new \RuntimeException('Cannot read the client assertion file'); + return trim($jwt); + } + + /** Reads the connection's newest tokens from your secret store. */ + function loadTokens(string $connectionId): ConnectionTokens + { + throw new \LogicException('Read the tokens from your secret store.'); + } + + /** Writes the connection's newest tokens to your secret store. */ + function saveTokens(string $connectionId, ConnectionTokens $tokens): void + { + throw new \LogicException('Write the tokens to your secret store.'); + } + ``` + + ```ruby Ruby + require "json" + require "net/http" + + TOKEN_URL = URI("https://auth.claude.com/v1/oauth/token") + CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV" + JWT_BEARER = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" + REFRESH_MARGIN_SECONDS = 600 + SECOND_REQUEST_DEADLINE_SECONDS = 4 # keep this under the 10-second read timeout + + ConnectionTokens = Data.define( + :refresh_token, + :access_token, + :expires_at, # Unix seconds + :refresh_expires_at, # Unix seconds + :on_hold, # true: the refresh token might have been used + :hold_reason # "lost" or "invalid_grant" + ) do + def initialize(on_hold: false, hold_reason: nil, **) = super + + # Keeps the tokens out of logs. + def inspect = "#" + alias_method :to_s, :inspect + end + + # The refresh token must not be sent again. Don't rescue this to try again. + # If new_tokens is set, only the write failed: store those tokens. + class RefreshOnHoldError < StandardError + attr_accessor :new_tokens + end + + # Reads the JWT that authenticates your app to auth.claude.com. + def client_assertion = File.read(ENV.fetch("CLIENT_ASSERTION_FILE")).strip + + # Reads the connection's newest tokens from your secret store. + def load_tokens(connection_id) + raise NotImplementedError, "Read the tokens from your secret store." + end + + # Writes the connection's newest tokens to your secret store. + def save_tokens(connection_id, tokens) + raise NotImplementedError, "Write the tokens to your secret store." + end + ``` + + +The following refresh function uses that setup: + + + + This refresh needs more logic than a single shell command. Write it in your application’s language. + + + + This refresh needs more logic than a single shell command. Write it in your application’s language. + + + ```python Python + connection_locks: defaultdict[str, threading.Lock] = defaultdict(threading.Lock) + + + def error_body(response: httpx2.Response) -> dict: + try: + body = response.json() + except ValueError: + return {} + return body if isinstance(body, dict) else {} + + + def is_lost(response: httpx2.Response) -> bool: + """True for a 5xx response that can follow a refresh that took effect.""" + if response.status_code < 500: + return False + refused = ( + response.status_code == 503 + and error_body(response).get("type") == "error" + and "retry-after" in response.headers + ) + return not refused + + + def hold_error(connection_id: str, reason: str) -> RefreshOnHoldError: + return RefreshOnHoldError( + f"Connection {connection_id} is on hold. {reason} Don't send its refresh token" + " again: that can end the customer's link. See" + ' "If a refresh fails" in the Linked billing docs.' + ) + + + def refresh_connection(connection_id: str, *, force: bool = False) -> tuple[str, int]: + """Returns a current access token and its expiry time in Unix seconds. + + Call this from your schedule. Pass force=True to refresh a token that isn't + close to its expiry. Raises RefreshOnHoldError when the refresh token must not be + sent again, and httpx2.HTTPStatusError for a refusal that keeps it. + """ + # This lock works inside one process only. + with connection_locks[connection_id]: + tokens = load_tokens(connection_id) + if tokens.on_hold: + raise hold_error(connection_id, f"Reason: {tokens.hold_reason}.") + if not force and tokens.expires_at - time.time() > REFRESH_MARGIN_SECONDS: + return tokens.access_token, tokens.expires_at + request = { + "grant_type": "refresh_token", + "refresh_token": tokens.refresh_token, + "client_id": CLIENT_ID, + "client_assertion_type": JWT_BEARER, + "client_assertion": client_assertion(), + } + # Hold first, so that the hold stays if the process stops mid-refresh. + held = replace(tokens, on_hold=True, hold_reason="lost") + save_tokens(connection_id, held) + issued_at = int(time.time()) + started = time.monotonic() + # Don't add retries: a late retry ends the customer's link. + try: + response = httpx2.post(TOKEN_URL, json=request, timeout=REQUEST_TIMEOUT) + lost = is_lost(response) + except (httpx2.ConnectError, httpx2.ConnectTimeout): + # The refresh token never left this process, so take the hold off. + save_tokens(connection_id, tokens) + raise + except httpx2.TransportError: + lost = True + if lost: + if time.monotonic() - started > SECOND_REQUEST_DEADLINE_SECONDS: + raise hold_error(connection_id, "A refresh got no usable answer.") + try: + response = httpx2.post(TOKEN_URL, json=request, timeout=REQUEST_TIMEOUT) + except httpx2.TransportError: + raise hold_error( + connection_id, "Two refreshes got no answer." + ) from None + if response.status_code != 200: + raise hold_error(connection_id, "The second refresh failed.") + if error_body(response).get("error") == "invalid_grant": + save_tokens(connection_id, replace(held, hold_reason="invalid_grant")) + raise hold_error(connection_id, "The refresh returned invalid_grant.") + if response.status_code != 200: + # A refusal that keeps the refresh token, so take the hold off. + save_tokens(connection_id, tokens) + response.raise_for_status() + body = response.json() + tokens = ConnectionTokens( + refresh_token=body["refresh_token"], + access_token=body["access_token"], + expires_at=issued_at + body["expires_in"], + refresh_expires_at=issued_at + body["refresh_token_expires_in"], + ) + # Retry only the write. Don't refresh again. + for attempt in range(5): + try: + save_tokens(connection_id, tokens) + return tokens.access_token, tokens.expires_at + except OSError: # your secret store's error type + if attempt < 4: + time.sleep(2**attempt) + error = hold_error( + connection_id, + "The refresh succeeded, but the new tokens could not be saved.", + ) + error.new_tokens = tokens + raise error + ``` + + ```typescript TypeScript + const connectionLocks = new Map>(); + + function withConnectionLock(connectionId: string, work: () => Promise): Promise { + const result = (connectionLocks.get(connectionId) ?? Promise.resolve()).then(work, work); + connectionLocks.set( + connectionId, + result.catch(() => {}) + ); + return result; + } + + class NotSent extends Error {} + + interface TokenResponse { + status: number; + headers: IncomingHttpHeaders; + text: string; + } + + function post(body: string): Promise { + return new Promise((resolve, reject) => { + let connected = false; + const req = request( + TOKEN_URL, + { + method: "POST", + agent: false, // a new connection for each request + headers: { "content-type": "application/json" }, + signal: AbortSignal.timeout(10_000) + }, + (response) => { + let text = ""; + response.setEncoding("utf8"); + response.on("data", (chunk: string) => (text += chunk)); + response.on("end", () => + resolve({ status: response.statusCode!, headers: response.headers, text }) + ); + response.on("error", reject); + } + ); + const connectTimer = setTimeout( + () => req.destroy(new Error("No connection in 2 seconds")), + 2_000 + ); + req.on("socket", (socket) => + socket.once("secureConnect", () => { + connected = true; + clearTimeout(connectTimer); + }) + ); + req.on("error", (error) => { + clearTimeout(connectTimer); + reject(connected ? error : new NotSent(error.message, { cause: error })); + }); + req.end(body); + }); + } + + function errorBody(response: TokenResponse): Record { + try { + const body: unknown = JSON.parse(response.text); + return typeof body === "object" && body !== null ? (body as Record) : {}; + } catch { + return {}; + } + } + + /** True for a 5xx response that can follow a refresh that took effect. */ + function isLost(response: TokenResponse): boolean { + if (response.status < 500) { + return false; + } + const refused = + response.status === 503 && + errorBody(response).type === "error" && + "retry-after" in response.headers; + return !refused; + } + + function holdError( + connectionId: string, + reason: string, + newTokens?: ConnectionTokens + ): RefreshOnHoldError { + return new RefreshOnHoldError( + `Connection ${connectionId} is on hold. ${reason} Don't send its refresh token again: ` + + 'that can end the customer\'s link. See "If a refresh fails" in the Linked billing docs.', + newTokens + ); + } + + /** + * Returns a current access token and its expiry time in Unix seconds. + * + * Call this from your schedule. Pass force: true to refresh a token that isn't + * close to its expiry. Throws RefreshOnHoldError when the refresh token must not be + * sent again, and an Error for a refusal that keeps it. + */ + function refreshConnection(connectionId: string, { force = false } = {}) { + // This lock works inside one process only. + return withConnectionLock(connectionId, async () => { + const tokens = await loadTokens(connectionId); + if (tokens.onHold) { + throw holdError(connectionId, `Reason: ${tokens.holdReason}.`); + } + if (!force && tokens.expiresAt - Date.now() / 1000 > REFRESH_MARGIN_SECONDS) { + return { accessToken: tokens.accessToken, expiresAt: tokens.expiresAt }; + } + const body = JSON.stringify({ + grant_type: "refresh_token", + refresh_token: tokens.refreshToken, + client_id: CLIENT_ID, + client_assertion_type: JWT_BEARER, + client_assertion: await clientAssertion() + }); + // Hold first, so that the hold stays if the process stops mid-refresh. + const held: ConnectionTokens = { ...tokens, onHold: true, holdReason: "lost" }; + await saveTokens(connectionId, held); + const issuedAt = Math.floor(Date.now() / 1000); + const started = performance.now(); + // Don't add retries: a late retry ends the customer's link. + let response: TokenResponse | undefined; + try { + response = await post(body); + } catch (error) { + if (error instanceof NotSent) { + // The refresh token never left this process, so take the hold off. + await saveTokens(connectionId, tokens); + throw error; + } + } + if (!response || isLost(response)) { + if (performance.now() - started > SECOND_REQUEST_DEADLINE_MS) { + throw holdError(connectionId, "A refresh got no usable answer."); + } + try { + response = await post(body); + } catch { + throw holdError(connectionId, "Two refreshes got no answer."); + } + if (response.status !== 200) { + throw holdError(connectionId, "The second refresh failed."); + } + } + if (errorBody(response).error === "invalid_grant") { + await saveTokens(connectionId, { ...held, holdReason: "invalid_grant" }); + throw holdError(connectionId, "The refresh returned invalid_grant."); + } + if (response.status !== 200) { + // A refusal that keeps the refresh token, so take the hold off. + await saveTokens(connectionId, tokens); + throw new Error(`Refresh failed: ${response.status} ${response.text}`); + } + const answer = JSON.parse(response.text); + const newTokens: ConnectionTokens = { + refreshToken: answer.refresh_token, + accessToken: answer.access_token, + expiresAt: issuedAt + answer.expires_in, + refreshExpiresAt: issuedAt + answer.refresh_token_expires_in + }; + // Retry only the write. Don't refresh again. + for (let attempt = 0; attempt < 5; attempt++) { + try { + await saveTokens(connectionId, newTokens); + return { accessToken: newTokens.accessToken, expiresAt: newTokens.expiresAt }; + } catch { + // the write failed + if (attempt < 4) { + await new Promise((wake) => setTimeout(wake, 2 ** attempt * 1000)); + } + } + } + throw holdError( + connectionId, + "The refresh succeeded, but the new tokens could not be saved.", + newTokens + ); + }); + } + ``` + + ```csharp C# + static partial class Connections + { + static readonly ConcurrentDictionary ConnectionLocks = new(); + + static readonly HttpClient Http = new(new SocketsHttpHandler + { + ConnectTimeout = TimeSpan.FromSeconds(2), + AllowAutoRedirect = false, + PooledConnectionLifetime = TimeSpan.Zero, // a new connection for each request + }) + { Timeout = Timeout.InfiniteTimeSpan }; // Post sets the 10-second timeout + + static async Task<(HttpResponseMessage? Response, string Body, Exception? Error, bool Connected)> Post( + string body) + { + using var request = new HttpRequestMessage(HttpMethod.Post, TokenUrl) + { + Content = new StringContent(body, Encoding.UTF8, "application/json"), + }; + using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(10)); + try + { + var response = await Http.SendAsync(request, timeout.Token); + return (response, await response.Content.ReadAsStringAsync(timeout.Token), null, true); + } + catch (HttpRequestException e) when (e.HttpRequestError is HttpRequestError.ConnectionError + or HttpRequestError.NameResolutionError or HttpRequestError.SecureConnectionError) + { + return (null, "", e, false); + } + catch (TaskCanceledException e) when (!timeout.IsCancellationRequested) + { + return (null, "", e, false); // the 2-second connect timeout + } + catch (Exception e) when (e is HttpRequestException or TaskCanceledException) + { + return (null, "", e, true); // a dropped connection or a timeout + } + } + + static JsonElement ErrorBody(string body) + { + try + { + using var document = JsonDocument.Parse(body); + var parsed = document.RootElement; + return parsed.ValueKind == JsonValueKind.Object ? parsed.Clone() : default; + } + catch (JsonException) + { + return default; + } + } + + static string? ErrorField(string body, string name) => + ErrorBody(body) is { ValueKind: JsonValueKind.Object } error && error.TryGetProperty(name, out var value) + ? value.ToString() + : null; + + /// True for a 5xx response that can follow a refresh that took effect. + static bool IsLost(HttpResponseMessage response, string body) + { + if ((int)response.StatusCode < 500) return false; + var refused = (int)response.StatusCode == 503 + && ErrorField(body, "type") == "error" + && response.Headers.Contains("retry-after"); + return !refused; + } + + static RefreshOnHoldException HoldError(string connectionId, string reason) => new( + $"Connection {connectionId} is on hold. {reason} Don't send its refresh token again: " + + "that can end the customer's link. See \"If a refresh fails\" in the Linked billing docs."); + + /// + /// Returns a current access token and its expiry time in Unix seconds. + /// Call this from your schedule. Pass force: true to refresh a token that isn't + /// close to its expiry. Throws RefreshOnHoldException when the refresh token must not be + /// sent again, and HttpRequestException for a refusal that keeps it. + /// + public static async Task<(string AccessToken, long ExpiresAt)> RefreshConnection( + string connectionId, bool force = false) + { + // This lock works inside one process only. + var connectionLock = ConnectionLocks.GetOrAdd(connectionId, _ => new SemaphoreSlim(1, 1)); + await connectionLock.WaitAsync(); + try + { + var tokens = await LoadTokens(connectionId); + if (tokens.OnHold) throw HoldError(connectionId, $"Reason: {tokens.HoldReason}."); + if (!force && tokens.ExpiresAt - DateTimeOffset.UtcNow.ToUnixTimeSeconds() > RefreshMarginSeconds) + { + return (tokens.AccessToken, tokens.ExpiresAt); + } + var request = JsonSerializer.Serialize(new Dictionary + { + ["grant_type"] = "refresh_token", + ["refresh_token"] = tokens.RefreshToken, + ["client_id"] = ClientId, + ["client_assertion_type"] = JwtBearer, + ["client_assertion"] = ClientAssertion(), + }); + // Hold first, so that the hold stays if the process stops mid-refresh. + var held = tokens with { OnHold = true, HoldReason = "lost" }; + await SaveTokens(connectionId, held); + var issuedAt = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + var started = Stopwatch.StartNew(); + // Don't add retries: a late retry ends the customer's link. + var (response, body, error, connected) = await Post(request); + if (!connected) + { + // The refresh token never left this process, so take the hold off. + await SaveTokens(connectionId, tokens); + throw new HttpRequestException("Couldn't connect to auth.claude.com.", error); + } + if (response is null || IsLost(response, body)) + { + if (started.Elapsed > SecondRequestDeadline) + throw HoldError(connectionId, "A refresh got no usable answer."); + (response, body, _, _) = await Post(request); + if (response is null) throw HoldError(connectionId, "Two refreshes got no answer."); + if ((int)response.StatusCode != 200) throw HoldError(connectionId, "The second refresh failed."); + } + if (ErrorField(body, "error") == "invalid_grant") + { + await SaveTokens(connectionId, held with { HoldReason = "invalid_grant" }); + throw HoldError(connectionId, "The refresh returned invalid_grant."); + } + if ((int)response.StatusCode != 200) + { + // A refusal that keeps the refresh token, so take the hold off. + await SaveTokens(connectionId, tokens); + throw new HttpRequestException($"Refresh failed: {(int)response.StatusCode} {body}", + null, response.StatusCode); + } + using var document = JsonDocument.Parse(body); + var answer = document.RootElement; + var newTokens = new ConnectionTokens( + RefreshToken: answer.GetProperty("refresh_token").GetString()!, + AccessToken: answer.GetProperty("access_token").GetString()!, + ExpiresAt: issuedAt + answer.GetProperty("expires_in").GetInt64(), + RefreshExpiresAt: issuedAt + answer.GetProperty("refresh_token_expires_in").GetInt64()); + // Retry only the write. Don't refresh again. + for (var attempt = 0; attempt < 5; attempt++) + { + try + { + await SaveTokens(connectionId, newTokens); + return (newTokens.AccessToken, newTokens.ExpiresAt); + } + catch (IOException) // your secret store's error type + { + if (attempt < 4) await Task.Delay(TimeSpan.FromSeconds(1 << attempt)); + } + } + throw new RefreshOnHoldException(HoldError(connectionId, + "The refresh succeeded, but the new tokens could not be saved.").Message) + { NewTokens = newTokens }; + } + finally + { + connectionLock.Release(); + } + } + } + ``` + + ```go Go + var connectionLocks sync.Map + + type tokenResponse struct { + status int + header http.Header + body []byte + } + + // post sends the refresh. connected is false if the request never left. + func post(body []byte) (response *tokenResponse, connected bool, err error) { + request, err := http.NewRequest(http.MethodPost, tokenURL, bytes.NewReader(body)) + if err != nil { + return nil, false, err + } + request.Header.Set("content-type", "application/json") + trace := &httptrace.ClientTrace{GotConn: func(httptrace.GotConnInfo) { connected = true }} + request = request.WithContext(httptrace.WithClientTrace(request.Context(), trace)) + answer, err := httpClient.Do(request) + if err != nil { + return nil, connected, err + } + defer answer.Body.Close() + data, err := io.ReadAll(answer.Body) + if err != nil { + return nil, true, err + } + return &tokenResponse{answer.StatusCode, answer.Header, data}, true, nil + } + + func errorBody(response *tokenResponse) map[string]any { + var body map[string]any + if json.Unmarshal(response.body, &body) != nil { + return map[string]any{} + } + return body + } + + // isLost is true for a 5xx response that can follow a refresh that took effect. + func isLost(response *tokenResponse) bool { + if response.status < 500 { + return false + } + refused := response.status == 503 && + errorBody(response)["type"] == "error" && + response.header.Get("retry-after") != "" + return !refused + } + + func holdError(connectionID, reason string) *RefreshOnHoldError { + return &RefreshOnHoldError{Message: fmt.Sprintf("connection %s is on hold. %s Don't send its refresh token "+ + "again: that can end the customer's link. See \"If a refresh fails\" in the Linked billing docs.", + connectionID, reason)} + } + + // refreshConnection returns a current access token and its expiry time in Unix + // seconds. Call it from your schedule. Pass force=true to refresh a token that + // isn't close to its expiry. It returns a *RefreshOnHoldError when the refresh + // token must not be sent again, and another error for a refusal that keeps it. + func refreshConnection(connectionID string, force bool) (string, int64, error) { + // This lock works inside one process only. + lock, _ := connectionLocks.LoadOrStore(connectionID, &sync.Mutex{}) + lock.(*sync.Mutex).Lock() + defer lock.(*sync.Mutex).Unlock() + + tokens, err := loadTokens(connectionID) + if err != nil { + return "", 0, err + } + if tokens.OnHold { + return "", 0, holdError(connectionID, "Reason: "+tokens.HoldReason+".") + } + if !force && time.Until(time.Unix(tokens.ExpiresAt, 0)) > refreshMargin { + return tokens.AccessToken, tokens.ExpiresAt, nil + } + assertion, err := clientAssertion() + if err != nil { + return "", 0, err + } + body, err := json.Marshal(map[string]string{ + "grant_type": "refresh_token", + "refresh_token": tokens.RefreshToken, + "client_id": clientID, + "client_assertion_type": jwtBearer, + "client_assertion": assertion, + }) + if err != nil { + return "", 0, err + } + // Hold first, so that the hold stays if the process stops mid-refresh. + held := tokens + held.OnHold, held.HoldReason = true, "lost" + if err := saveTokens(connectionID, held); err != nil { + return "", 0, err + } + issuedAt := time.Now().Unix() + started := time.Now() + // Don't add retries: a late retry ends the customer's link. + response, connected, err := post(body) + if err != nil && !connected { + // The refresh token never left this process, so take the hold off. + if saveErr := saveTokens(connectionID, tokens); saveErr != nil { + return "", 0, saveErr + } + return "", 0, err + } + if err != nil || isLost(response) { + if time.Since(started) > secondRequestDeadline { + return "", 0, holdError(connectionID, "A refresh got no usable answer.") + } + if response, _, err = post(body); err != nil { + return "", 0, holdError(connectionID, "Two refreshes got no answer.") + } + if response.status != 200 { + return "", 0, holdError(connectionID, "The second refresh failed.") + } + } + if errorBody(response)["error"] == "invalid_grant" { + held.HoldReason = "invalid_grant" + if err := saveTokens(connectionID, held); err != nil { + return "", 0, err + } + return "", 0, holdError(connectionID, "The refresh returned invalid_grant.") + } + if response.status != 200 { + // A refusal that keeps the refresh token, so take the hold off. + if err := saveTokens(connectionID, tokens); err != nil { + return "", 0, err + } + return "", 0, fmt.Errorf("refresh failed: %d %s", response.status, response.body) + } + var answer struct { + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + ExpiresIn int64 `json:"expires_in"` + RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in"` + } + if err := json.Unmarshal(response.body, &answer); err != nil { + return "", 0, holdError(connectionID, "The refresh answer could not be read.") + } + tokens = ConnectionTokens{ + RefreshToken: answer.RefreshToken, + AccessToken: answer.AccessToken, + ExpiresAt: issuedAt + answer.ExpiresIn, + RefreshExpiresAt: issuedAt + answer.RefreshTokenExpiresIn, + } + // Retry only the write. Don't refresh again. + for attempt := range 5 { + if err := saveTokens(connectionID, tokens); err == nil { + return tokens.AccessToken, tokens.ExpiresAt, nil + } + if attempt < 4 { + time.Sleep(time.Second << attempt) + } + } + hold := holdError(connectionID, "The refresh succeeded, but the new tokens could not be saved.") + hold.NewTokens = &tokens + return "", 0, hold + } + ``` + + ```java Java + final Map connectionLocks = new ConcurrentHashMap<>(); + final ObjectMapper mapper = new ObjectMapper(); + final HttpClient http = HttpClient.newBuilder() + .connectTimeout(Duration.ofSeconds(2)) + .followRedirects(HttpClient.Redirect.NEVER) + .build(); + + HttpResponse post(String body) throws IOException, InterruptedException { + var request = HttpRequest.newBuilder(TOKEN_URL) + .header("content-type", "application/json") + .timeout(Duration.ofSeconds(10)) + .POST(HttpRequest.BodyPublishers.ofString(body)) + .build(); + return http.send(request, HttpResponse.BodyHandlers.ofString()); + } + + JsonNode errorBody(HttpResponse response) { + try { + return mapper.readTree(response.body()); + } catch (IOException _) { + return mapper.createObjectNode(); + } + } + + /** True for a 5xx response that can follow a refresh that took effect. */ + boolean isLost(HttpResponse response) { + if (response.statusCode() < 500) { + return false; + } + boolean refused = response.statusCode() == 503 + && errorBody(response).path("type").asText().equals("error") + && response.headers().firstValue("retry-after").isPresent(); + return !refused; + } + + RefreshOnHoldException holdError(String connectionId, String reason) { + return new RefreshOnHoldException("Connection " + connectionId + " is on hold. " + reason + + " Don't send its refresh token again: that can end the customer's link." + + " See \"If a refresh fails\" in the Linked billing docs."); + } + + /** + * Returns a current access token and its expiry time in Unix seconds. + * Call this from your schedule. Pass force = true to refresh a token that isn't + * close to its expiry. Throws RefreshOnHoldException when the refresh token must not be + * sent again, and IOException for a refusal that keeps it. + */ + AccessToken refreshConnection(String connectionId, boolean force) + throws IOException, InterruptedException { + // This lock works inside one process only. + var lock = connectionLocks.computeIfAbsent(connectionId, id -> new ReentrantLock()); + lock.lock(); + try { + var tokens = loadTokens(connectionId); + if (tokens.onHold()) { + throw holdError(connectionId, "Reason: " + tokens.holdReason() + "."); + } + if (!force && tokens.expiresAt() - Instant.now().getEpochSecond() > REFRESH_MARGIN_SECONDS) { + return new AccessToken(tokens.accessToken(), tokens.expiresAt()); + } + var request = mapper.createObjectNode() + .put("grant_type", "refresh_token") + .put("refresh_token", tokens.refreshToken()) + .put("client_id", CLIENT_ID) + .put("client_assertion_type", JWT_BEARER) + .put("client_assertion", clientAssertion()) + .toString(); + // Hold first, so that the hold stays if the process stops mid-refresh. + var held = tokens.withHold("lost"); + saveTokens(connectionId, held); + long issuedAt = Instant.now().getEpochSecond(); + long started = System.nanoTime(); + // Don't add retries: a late retry ends the customer's link. + HttpResponse response = null; + try { + response = post(request); + } catch (ConnectException | HttpConnectTimeoutException | SSLHandshakeException e) { + // The refresh token never left this process, so take the hold off. + saveTokens(connectionId, tokens); + throw e; + } catch (IOException _) { + // The connection dropped, or no answer came in time. + } + if (response == null || isLost(response)) { + if (Duration.ofNanos(System.nanoTime() - started).compareTo(SECOND_REQUEST_DEADLINE) > 0) { + throw holdError(connectionId, "A refresh got no usable answer."); + } + try { + response = post(request); + } catch (IOException _) { + throw holdError(connectionId, "Two refreshes got no answer."); + } + if (response.statusCode() != 200) { + throw holdError(connectionId, "The second refresh failed."); + } + } + if (errorBody(response).path("error").asText().equals("invalid_grant")) { + saveTokens(connectionId, held.withHold("invalid_grant")); + throw holdError(connectionId, "The refresh returned invalid_grant."); + } + if (response.statusCode() != 200) { + // A refusal that keeps the refresh token, so take the hold off. + saveTokens(connectionId, tokens); + throw new IOException("Refresh failed: " + response.statusCode() + " " + response.body()); + } + var answer = mapper.readTree(response.body()); + var newTokens = new ConnectionTokens( + answer.get("refresh_token").asText(), + answer.get("access_token").asText(), + issuedAt + answer.get("expires_in").asLong(), + issuedAt + answer.get("refresh_token_expires_in").asLong(), + false, + null); + // Retry only the write. Don't refresh again. + for (int attempt = 0; attempt < 5; attempt++) { + try { + saveTokens(connectionId, newTokens); + return new AccessToken(newTokens.accessToken(), newTokens.expiresAt()); + } catch (IOException _) { // your secret store's error type + if (attempt < 4) { + Thread.sleep(Duration.ofSeconds(1L << attempt)); + } + } + } + var error = holdError(connectionId, "The refresh succeeded, but the new tokens could not be saved."); + error.newTokens = newTokens; + throw error; + } finally { + lock.unlock(); + } + } + ``` + + ```php PHP + /** + * Sends the refresh. Returns a string, curl's error, when the request never left this process. + * + * @return array{status: int, headers: list, body: string}|false|string false: no answer + */ + function post(string $body): array|false|string + { + $headers = []; + $curl = curl_init(TOKEN_URL); + curl_setopt_array($curl, [ + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $body, + CURLOPT_HTTPHEADER => ['content-type: application/json'], + CURLOPT_RETURNTRANSFER => true, + CURLOPT_CONNECTTIMEOUT => 2, + CURLOPT_TIMEOUT => 10, + CURLOPT_FOLLOWLOCATION => false, + CURLOPT_FORBID_REUSE => true, // a new connection for each request + CURLOPT_HEADERFUNCTION => function ($curl, string $line) use (&$headers): int { + $headers[] = strtolower(trim($line)); + return strlen($line); + }, + ]); + $text = curl_exec($curl); + if (!is_string($text)) { + // No TLS connection yet means that nothing was sent. + return curl_getinfo($curl, CURLINFO_APPCONNECT_TIME_T) > 0 ? false : curl_error($curl); + } + return ['status' => curl_getinfo($curl, CURLINFO_RESPONSE_CODE), 'headers' => $headers, 'body' => $text]; + } + + /** + * @param array{status: int, headers: list, body: string} $response + * @return array + */ + function errorBody(array $response): array + { + $body = json_decode($response['body'], associative: true); + return is_array($body) ? $body : []; + } + + /** + * True for a 5xx response that can follow a refresh that took effect. + * + * @param array{status: int, headers: list, body: string} $response + */ + function isLost(array $response): bool + { + if ($response['status'] < 500) { + return false; + } + $refused = $response['status'] === 503 + && (errorBody($response)['type'] ?? null) === 'error' + && preg_grep('/^retry-after:/', $response['headers']); + return !$refused; + } + + function holdError(string $connectionId, string $reason): RefreshOnHoldException + { + return new RefreshOnHoldException( + "Connection {$connectionId} is on hold. {$reason} Don't send its refresh token again: " + . "that can end the customer's link. See \"If a refresh fails\" in the Linked billing docs." + ); + } + + /** + * Returns a current access token and its expiry time in Unix seconds. + * + * Call this from your schedule. Pass force: true to refresh a token that isn't + * close to its expiry. Throws RefreshOnHoldException when the refresh token must not be + * sent again, and \RuntimeException for a refusal that keeps it. + * + * @return array{string, int} + */ + function refreshConnection(string $connectionId, bool $force = false): array + { + // This lock works on one machine only. + $lock = fopen(sys_get_temp_dir() . '/refresh-' . hash('sha256', $connectionId) . '.lock', 'c') + ?: throw new \RuntimeException('Cannot open the lock file'); + flock($lock, LOCK_EX); + try { + $tokens = loadTokens($connectionId); + if ($tokens->onHold) { + throw holdError($connectionId, "Reason: {$tokens->holdReason}."); + } + if (!$force && $tokens->expiresAt - time() > REFRESH_MARGIN_SECONDS) { + return [$tokens->accessToken, $tokens->expiresAt]; + } + $request = json_encode([ + 'grant_type' => 'refresh_token', + 'refresh_token' => $tokens->refreshToken, + 'client_id' => CLIENT_ID, + 'client_assertion_type' => JWT_BEARER, + 'client_assertion' => clientAssertion(), + ], JSON_THROW_ON_ERROR); + // Hold first, so that the hold stays if the process stops mid-refresh. + $held = $tokens->withHold('lost'); + saveTokens($connectionId, $held); + $issuedAt = time(); + $started = hrtime(true); + // Don't add retries: a late retry ends the customer's link. + $response = post($request); + if (is_string($response)) { + // The refresh token never left this process, so take the hold off. + saveTokens($connectionId, $tokens); + throw new \RuntimeException("Could not connect to auth.claude.com: {$response}"); + } + if ($response === false || isLost($response)) { + if ((hrtime(true) - $started) / 1e9 > SECOND_REQUEST_DEADLINE_SECONDS) { + throw holdError($connectionId, 'A refresh got no usable answer.'); + } + $response = post($request); + if (!is_array($response)) { + throw holdError($connectionId, 'Two refreshes got no answer.'); + } + if ($response['status'] !== 200) { + throw holdError($connectionId, 'The second refresh failed.'); + } + } + if ((errorBody($response)['error'] ?? null) === 'invalid_grant') { + saveTokens($connectionId, $held->withHold('invalid_grant')); + throw holdError($connectionId, 'The refresh returned invalid_grant.'); + } + if ($response['status'] !== 200) { + // A refusal that keeps the refresh token, so take the hold off. + saveTokens($connectionId, $tokens); + throw new \RuntimeException("Refresh failed: {$response['status']} {$response['body']}"); + } + /** + * @var array{ + * access_token: string, + * refresh_token: string, + * expires_in: int, + * refresh_token_expires_in: int, + * } $answer + */ + $answer = json_decode($response['body'], associative: true, flags: JSON_THROW_ON_ERROR); + $newTokens = new ConnectionTokens( + refreshToken: $answer['refresh_token'], + accessToken: $answer['access_token'], + expiresAt: $issuedAt + $answer['expires_in'], + refreshExpiresAt: $issuedAt + $answer['refresh_token_expires_in'], + ); + // Retry only the write. Don't refresh again. + for ($attempt = 0; $attempt < 5; $attempt++) { + try { + saveTokens($connectionId, $newTokens); + return [$newTokens->accessToken, $newTokens->expiresAt]; + } catch (\RuntimeException) { // your secret store's error type + if ($attempt < 4) { + sleep(2 ** $attempt); + } + } + } + $error = holdError($connectionId, 'The refresh succeeded, but the new tokens could not be saved.'); + $error->newTokens = $newTokens; + throw $error; + } finally { + flock($lock, LOCK_UN); + fclose($lock); + } + } + ``` + + ```ruby Ruby + CONNECTION_LOCKS = Hash.new { |locks, connection_id| locks[connection_id] = Mutex.new } + LOCKS_GUARD = Mutex.new + + # Raises before the request leaves if it can't connect. + def open_connection + Net::HTTP.start(TOKEN_URL.host, TOKEN_URL.port, use_ssl: true, + open_timeout: 2, read_timeout: 10, write_timeout: 10, max_retries: 0) + end + + def post(http, body) + http.post(TOKEN_URL.path, body, "content-type" => "application/json") + ensure + http.finish + end + + def error_body(response) + body = JSON.parse(response.body.to_s) + body.is_a?(Hash) ? body : {} + rescue JSON::ParserError + {} + end + + # True for a 5xx response that can follow a refresh that took effect. + def lost?(response) + return false if response.code.to_i < 500 + + refused = response.code == "503" && + error_body(response)["type"] == "error" && + response.key?("retry-after") + !refused + end + + def hold_error(connection_id, reason) + RefreshOnHoldError.new( + "Connection #{connection_id} is on hold. #{reason} Don't send its refresh token again: " \ + "that can end the customer's link. See \"If a refresh fails\" in the Linked billing docs." + ) + end + + # Returns a current access token and its expiry time in Unix seconds. + # + # Call this from your schedule. Pass force: true to refresh a token that isn't + # close to its expiry. Raises RefreshOnHoldError when the refresh token must not be + # sent again, and RuntimeError for a refusal that keeps it. + def refresh_connection(connection_id, force: false) + # This lock works inside one process only. + LOCKS_GUARD.synchronize { CONNECTION_LOCKS[connection_id] }.synchronize do + tokens = load_tokens(connection_id) + raise hold_error(connection_id, "Reason: #{tokens.hold_reason}.") if tokens.on_hold + if !force && tokens.expires_at - Time.now.to_i > REFRESH_MARGIN_SECONDS + return tokens.access_token, tokens.expires_at + end + + request = { + grant_type: "refresh_token", + refresh_token: tokens.refresh_token, + client_id: CLIENT_ID, + client_assertion_type: JWT_BEARER, + client_assertion: + }.to_json + # Hold first, so that the hold stays if the process stops mid-refresh. + held = tokens.with(on_hold: true, hold_reason: "lost") + save_tokens(connection_id, held) + issued_at = Time.now.to_i + started = Process.clock_gettime(Process::CLOCK_MONOTONIC) + # Don't add retries: a late retry ends the customer's link. + begin + http = open_connection + rescue + # The refresh token never left this process, so take the hold off. + save_tokens(connection_id, tokens) + raise + end + begin + response = post(http, request) + lost = lost?(response) + rescue + lost = true + end + if lost + if Process.clock_gettime(Process::CLOCK_MONOTONIC) - started > SECOND_REQUEST_DEADLINE_SECONDS + raise hold_error(connection_id, "A refresh got no usable answer.") + end + begin + response = post(open_connection, request) + rescue + raise hold_error(connection_id, "Two refreshes got no answer.") + end + raise hold_error(connection_id, "The second refresh failed.") unless response.code == "200" + end + if error_body(response)["error"] == "invalid_grant" + save_tokens(connection_id, held.with(hold_reason: "invalid_grant")) + raise hold_error(connection_id, "The refresh returned invalid_grant.") + end + unless response.code == "200" + # A refusal that keeps the refresh token, so take the hold off. + save_tokens(connection_id, tokens) + raise "Refresh failed: #{response.code} #{response.body}" + end + body = JSON.parse(response.body) + tokens = ConnectionTokens.new( + refresh_token: body.fetch("refresh_token"), + access_token: body.fetch("access_token"), + expires_at: issued_at + body.fetch("expires_in"), + refresh_expires_at: issued_at + body.fetch("refresh_token_expires_in") + ) + # Retry only the write. Don't refresh again. + 5.times do |attempt| + save_tokens(connection_id, tokens) + return tokens.access_token, tokens.expires_at + rescue IOError, SystemCallError # your secret store's error types + sleep(2**attempt) if attempt < 4 + end + error = hold_error(connection_id, "The refresh succeeded, but the new tokens could not be saved.") + error.new_tokens = tokens + raise error + end + end + ``` + + +### If an API key can reach the process + +This section is only for a process where `ANTHROPIC_API_KEY` might be set beside a customer’s access token. These clients send the key in place of the token: + +* the `ant` CLI +* an SDK client that reads the token from `ANTHROPIC_AUTH_TOKEN` + +An SDK client given the token when you build it sends only the token. Other clients can send both. The key still wins, except on the Models endpoints, where the request can be refused. When the key goes out, the Claude API authenticates the request with it, so the request isn’t limited to that customer. + +As a guard in such a process, send each request with the `anthropic-user-profile-id` header, `billing_policy` with `bill_to: "user_profile"`, and the `user-profiles-billing-2026-10-01` beta header. Then, a request that goes out with the key has one of these outcomes: + +* **With the header and `bill_to: "user_profile"`:** It fails, or it bills the customer the header names. +* **With the header alone, or with neither:** Anthropic bills it to you. + +### When you write each new access token to a sandbox + +Your back end sends each new token to code in the sandbox, over a channel that you build. That code runs as the agent’s user and writes the token into a `credentials` directory with mode `0700`. It writes a new file with mode `0600` and renames it over the old one, so that the agent never reads half a file. This function does that: + + + + Write the file with your application’s code, running in the sandbox as the agent’s user. + + + + Write the file with your application’s code, running in the sandbox as the agent’s user. + + + ```python Python + import json + import os + import tempfile + from pathlib import Path + + + def write_credentials_file( + config_dir: Path, profile: str, token: str, expires_at: int + ) -> None: + """Run this in the sandbox, as the agent's user.""" + credentials_dir = config_dir / "credentials" + credentials_dir.mkdir(mode=0o700, parents=True, exist_ok=True) + body = {"type": "oauth_token", "access_token": token, "expires_at": expires_at} + handle, temporary_path = tempfile.mkstemp(dir=credentials_dir) # mode 0600 + with os.fdopen(handle, "w") as temporary_file: + json.dump(body, temporary_file) + os.replace(temporary_path, credentials_dir / f"{profile}.json") + ``` + + ```typescript TypeScript + import { mkdir, rename, writeFile } from "node:fs/promises"; + import { join } from "node:path"; + + /** Run this in the sandbox, as the agent's user. */ + async function writeCredentialsFile( + configDir: string, + profile: string, + token: string, + expiresAt: number + ) { + const credentialsDir = join(configDir, "credentials"); + await mkdir(credentialsDir, { mode: 0o700, recursive: true }); + const body = { type: "oauth_token", access_token: token, expires_at: expiresAt }; + const temporaryPath = join(credentialsDir, `.${crypto.randomUUID()}.tmp`); + await writeFile(temporaryPath, JSON.stringify(body), { mode: 0o600, flag: "wx" }); + await rename(temporaryPath, join(credentialsDir, `${profile}.json`)); + } + ``` + + ```csharp C# + using System.Text.Json; + + /// Run this in the sandbox, as the agent's user. + static void WriteCredentialsFile(string configDir, string profile, string token, long expiresAt) + { + var credentialsDir = Path.Combine(configDir, "credentials"); + Directory.CreateDirectory(credentialsDir, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); + var body = new Dictionary + { + ["type"] = "oauth_token", + ["access_token"] = token, + ["expires_at"] = expiresAt, + }; + var temporaryPath = Path.Combine(credentialsDir, $".{Guid.NewGuid()}.tmp"); + using (var temporaryFile = new FileStream(temporaryPath, new FileStreamOptions + { + Mode = FileMode.CreateNew, + Access = FileAccess.Write, + UnixCreateMode = UnixFileMode.UserRead | UnixFileMode.UserWrite, + })) + { + JsonSerializer.Serialize(temporaryFile, body); + } + File.Move(temporaryPath, Path.Combine(credentialsDir, $"{profile}.json"), overwrite: true); + } + ``` + + ```go Go + import ( + "encoding/json" + "os" + "path/filepath" + ) + + // writeCredentialsFile runs in the sandbox, as the agent's user. + func writeCredentialsFile(configDir, profile, token string, expiresAt int64) error { + credentialsDir := filepath.Join(configDir, "credentials") + if err := os.MkdirAll(credentialsDir, 0o700); err != nil { + return err + } + body, err := json.Marshal(map[string]any{"type": "oauth_token", "access_token": token, "expires_at": expiresAt}) + if err != nil { + return err + } + temporaryFile, err := os.CreateTemp(credentialsDir, ".tmp-*") // mode 0600 + if err != nil { + return err + } + defer os.Remove(temporaryFile.Name()) // does nothing once the rename is done + if _, err := temporaryFile.Write(body); err != nil { + temporaryFile.Close() + return err + } + if err := temporaryFile.Close(); err != nil { + return err + } + return os.Rename(temporaryFile.Name(), filepath.Join(credentialsDir, profile+".json")) + } + ``` + + ```java Java + import module java.base; + import com.fasterxml.jackson.databind.ObjectMapper; // Jackson comes with the Anthropic SDK + + /** Run this in the sandbox, as the agent's user. */ + void writeCredentialsFile(Path configDir, String profile, String token, long expiresAt) throws IOException { + var credentialsDir = Files.createDirectories(configDir.resolve("credentials"), + PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwx------"))); + var body = Map.of("type", "oauth_token", "access_token", token, "expires_at", expiresAt); + var temporaryPath = Files.createTempFile(credentialsDir, ".", ".tmp"); // mode 0600 + Files.writeString(temporaryPath, new ObjectMapper().writeValueAsString(body)); + Files.move(temporaryPath, credentialsDir.resolve(profile + ".json"), + StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); + } + ``` + + ```php PHP + /** Run this in the sandbox, as the agent's user. */ + function writeCredentialsFile(string $configDir, string $profile, string $token, int $expiresAt): void + { + $credentialsDir = "{$configDir}/credentials"; + if (!is_dir($credentialsDir) && !mkdir($credentialsDir, 0700, recursive: true)) { + throw new \RuntimeException("Cannot create {$credentialsDir}"); + } + $credentials = ['type' => 'oauth_token', 'access_token' => $token, 'expires_at' => $expiresAt]; + $body = json_encode($credentials, JSON_THROW_ON_ERROR); + $temporaryPath = tempnam($credentialsDir, '.tmp'); // mode 0600 + if ($temporaryPath === false || dirname($temporaryPath) !== realpath($credentialsDir)) { + throw new \RuntimeException("Cannot create a file in {$credentialsDir}"); // tempnam can fall back to /tmp + } + $finalPath = "{$credentialsDir}/{$profile}.json"; + if (file_put_contents($temporaryPath, $body) === false || !rename($temporaryPath, $finalPath)) { + throw new \RuntimeException("Cannot write the credentials for {$profile}"); + } + } + ``` + + ```ruby Ruby + require "fileutils" + require "json" + require "tempfile" + + # Run this in the sandbox, as the agent's user. + def write_credentials_file(config_dir, profile, token, expires_at) + credentials_dir = File.join(config_dir, "credentials") + FileUtils.mkdir_p(credentials_dir, mode: 0o700) + body = { type: "oauth_token", access_token: token, expires_at: } + temporary_file = Tempfile.create(".tmp", credentials_dir) # mode 0600 + temporary_file.write(body.to_json) + temporary_file.close + File.rename(temporary_file.path, File.join(credentials_dir, "#{profile}.json")) + end + ``` + + +Within a few minutes of a refresh, a request with the earlier token gets a `401`. The client can then read the file again and send the request with the new token. With the TypeScript or C# SDK on its own, that one request fails instead. Send it once more: the next request uses the new token. The SDK also reads the file again in the last 2 minutes before `expires_at`, or in the last 30 seconds in Java. + +### For agents + +* When you refresh, don’t send a `scope` parameter. +* For every refresh, read the client assertion again from its file. +* When you store new tokens, count their expiry times from when you sent the refresh, using `expires_in` and `refresh_token_expires_in`. +* When a suspension ends, clear `on_hold` (typescript, java, php: `onHold`; csharp, go: `OnHold`) only if its `hold_reason` (typescript, java, php: `holdReason`; csharp, go: `HoldReason`) is `invalid_grant`. +* When you write a sandbox’s credentials file, write a token that has more than 30 seconds left before its `expires_at`. + +## Next steps + + + + Add test users, publish your app, and change or delete it + + + + The approval page, spend caps, and emails that your customers see, so that you can support them + + diff --git a/content/en/manage-claude/oauth-apps/linked-billing/errors.md b/content/en/manage-claude/oauth-apps/linked-billing/errors.md new file mode 100644 index 0000000000..502754ef8b --- /dev/null +++ b/content/en/manage-claude/oauth-apps/linked-billing/errors.md @@ -0,0 +1,252 @@ +--- +title: Linked billing errors +url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors +description: Find what to do about each error that linking or billing a customer can return, with its causes in the order to check them. +featureMetadata: + status: beta + betaHeader: user-profiles-billing-2026-10-01 + supportedModels: + - claude-fable-5-2 + - claude-mythos-5-2 + - claude-fable-5-1 + - claude-mythos-5-1 + - claude-fable-5 + - claude-mythos-5 + - claude-mythos-preview + - claude-opus-5-5 + - claude-opus-5 + - claude-sonnet-5-5 + - claude-sonnet-5 + - claude-haiku-5-5 + - claude-haiku-4-5-20251001 + - claude-opus-4-8 + - claude-opus-4-7 + - claude-opus-4-6 + - claude-sonnet-4-6 + - claude-opus-4-5-20251101 + - claude-sonnet-4-5-20250929 + supportedPlatforms: + Claude API: + availability: beta + note: Only requests that send `billing_policy` need the beta header. +--- + + + Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use. + + +These are the errors that `auth.claude.com` returns while linking and the Claude API returns while billing, apart from a [failed refresh](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). + +## While linking + +These errors arrive on your redirect URI or from the code exchange. A connection is the record that ties a customer’s Claude organization to one of your [user profiles](https://platform.claude.com/docs/en/manage-claude/user-profiles). In each case, no connection is made. For the standard OAuth errors, see [OAuth endpoints and parameters](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#errors). + +### `access_denied` + +First, check your app: causes 3 and 4 are yours to fix. + +Otherwise, tell the person that linking didn’t complete, and don’t assume that they declined. Ask them to check which Claude account they signed in with and their role in the organization they want to link. To let them try again, [send them to approve](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve) with a new pushed authorization request. + +For these causes, your redirect URI receives `error=access_denied` with your `state` value: + +1. The person clicked **Cancel** on an approval screen. + +2. The approval page had no organization to offer, and the person clicked the button that returns to your app. That happens when: + + * the person doesn’t have the Admin or Billing role in any Claude organization + * the person’s only organization is the one that owns your app + * the user profile that you sent is already linked to another organization, where the person doesn’t have the Admin or Billing role + * the person’s only organizations are of a kind that can’t link: see [eligible customers](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers) + +3. Your app’s **Who can link** setting reads “only” after your organization’s name. Nobody can link such an app. On its **Settings** tab, select **Any Claude user** and click **Save changes**. + +4. Your app isn’t live, the person isn’t on its **Test users** list, and they clicked the button that returns to your app. [Add them as a test user](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#add-test-users), or [publish the app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#publish-the-app). + +For these causes, `error_description` reads `the user declined the request`, so it can’t tell you which one happened. If it reads `the request cannot be approved for this organization` instead, the organization that the person selected can’t approve your app. Ask them to select another. + +### `user_profile_already_linked` + +Each customer’s organization can have only one connection to your app at a time, and so can each of your profiles. `error_description` says which of these two causes applies: + +1. **The organization already has a connection**, through another of your profiles. This is the usual cause, and `error_description` starts `This organization already has an active connection`. On your [User profiles page](https://platform.claude.com/user-profiles), look for another profile of this customer that shows as **Linked**. Anthropic doesn’t show which organization a profile is linked to, so confirm with the customer that it’s theirs. + + * **You find it:** Bill the customer through that profile, or [unlink that profile](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#unlink-a-customer) and send the customer to approve again with the profile that was refused. + * **None of this customer’s profiles is linked:** The person might have selected an organization that belongs to another of your customers. Send them to approve again, and ask them to check which organization they select. + +2. **The profile you sent already has a connection**, to another organization. Its `error_description` starts `This user profile already has an active connection`. End that connection first: see [Move a customer to another organization](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#move-a-customer-to-another-organization). + +You can’t catch this error early: the pushed authorization request succeeds. + +The error arrives in one of two places: + +* **On your redirect URI:** If the person returns to your app, the redirect carries `error=user_profile_already_linked` with your `state` value. `auth.claude.com` has already asked them to contact you with this code. +* **From the token endpoint:** The code exchange returns it if the connection was made after the approval. + +The error doesn’t name the profile that holds the connection. + +### No redirect + +If the person comes back to your product without a callback, send them to approve again with a new pushed authorization request. You get no callback and can’t tell these cases apart: + +* The person closed the approval page. +* The `request_uri` had expired. It expires 10 minutes after you create it. +* The `request_uri` was already used. Each one works once. + +In the last two cases, the approval page displays an error and doesn’t send the browser back to your app. + +### `unauthorized_client` from the code exchange + +Check your app’s setup in the Claude Console, fix what’s missing, and exchange the same code again. This refusal doesn’t use up the code, which lasts 5 minutes. + +| Check | `error_description` | Fix | +| ----- | ----- | ----- | +| The app has an operator service account | `the client is not registered for this grant` | [Choose an operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account) | +| The app has a default workspace that isn’t archived | Names the workspace problem | [Choose a default workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace) | +| The operator service account is a member of that workspace | Names the workspace problem | [Choose a workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace) that the account is a member of, such as the built-in workspace named **Default** | + +A saved change can take a few minutes to reach `auth.claude.com`, so if the exchange is refused again, wait and retry. If the code expires first, send the customer to approve again. + +If the Console says that the service account no longer exists, see [If you change the service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-change-the-service-account). For any other cause, contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or your Anthropic account team if you have one. + +## While billing + +A request that the Claude API refuses before Claude starts a reply bills no one. Where the error’s details are depends on the endpoint: + +| Endpoint | Where the error code is | Request ID header | +| ----- | ----- | ----- | +| `/v1/messages` | `error.details.error_code` | `request-id` | +| `/v1/chat/completions` | Not sent | `x-request-id` | + +On `/v1/chat/completions`, the error takes another form: + +* `error.type` is `invalid_request_error`. +* `error.code` holds the error type, such as `billing_error`, not one of the error codes in this page’s headings. + +Match on the HTTP status and `error.code`. The two `402` errors look alike there, and so do the `403` errors, so follow every entry that fits. A `401` for an access token has the `/v1/messages` form and the `request-id` header on both endpoints. + +A refusal on `/v1/messages` has this form: + +```json +{ + "type": "error", + "error": { + "type": "billing_error", + "message": "...", + "details": { + "error_code": "linked_organization_spend_limit_reached" + } + } +} +``` + +The `401` and `503` errors later on this page have no error code. On `/v1/messages`, match them on the status and `error.type`. + +In the Anthropic SDK, catch the error class for the HTTP status, then read the error code from its `error_code` (typescript: `errorCode`; csharp: `ErrorCode`; go: `ErrorCode()`; java: `errorCode()`; php: `getErrorCode()`). The class for a `402` is `PaymentRequiredError` (ruby: `Anthropic::Errors::PaymentRequiredError`; java, php: `PaymentRequiredException`; csharp: `AnthropicPaymentRequiredException`; go: `*anthropic.Error`), and the class for a `403` is `PermissionDeniedError` (ruby: `Anthropic::Errors::PermissionDeniedError`; java, php: `PermissionDeniedException`; csharp: `AnthropicForbiddenException`; go: `*anthropic.Error`). + +Outside Go, each class covers every error with its status. Go has one type, `*anthropic.Error`, for every status: check its `StatusCode`. One code can also arrive inside a streamed reply: see [`linked_organization_billing_unavailable`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-billing-unavailable). + +Log the whole `error.message` and the request ID of each refused request. To serve a refused customer at your own cost, send the request again [as one that you pay for](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#you-pay), with `bill_to: "self"` in `billing_policy`. Send it as your [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account), not with a customer’s access token. + +For a `402` or `403`, sending the same request again doesn’t help while the cause lasts. A new connection’s first seconds are an exception: see [`user_profile_billing_not_authorized`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-billing-not-authorized). + +A request that fits causes of both `403` codes can get either code, for example the wrong credential for a customer who also isn’t linked. Handle the two codes together, and if one entry’s causes don’t explain a refusal, check the other’s. + +### 403 `user_profile_billing_not_authorized` + +No connection lets your request bill the user profile it names. The response doesn’t say why. To tell causes 2 to 4 apart, [check whether the customer is linked](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#check-a-links-status) through the app you expect. + +Check these causes in order: + +1. **Your request.** The request must name the user profile that this customer linked. It must also authenticate as the operator service account of the app that they linked through, or with that connection’s access token. The service account of another of your apps gets this error if the customer hasn’t linked through that app. Correct the request: a new connection doesn’t help. + +2. **The customer hasn’t linked through this app.** The [connection status](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#check-a-links-status) reads `not_connected`. A profile linked only through another of your apps, such as a [separate test app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-run-several-apps), isn’t linked to this one. Until the customer [links through this app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve), a request can bill only you, with `bill_to: "self"`. + +3. **The connection has ended.** The connection status reads `disconnected`, and the profile shows as **Unlinked** on your [User profiles page](https://platform.claude.com/user-profiles). The status’s `last_revoked_reason.type` says why. Until the customer [links again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again), a request can bill only you, with `bill_to: "self"`. + +4. **The connection status reads `connected`, and the request is still refused.** + + * **A new connection:** A new connection usually works at once, but it can take about 10 seconds after the code exchange. If the connection is that new, wait until about 10 seconds have passed since the exchange and then send the request once more. + * **An earlier connection’s access token:** A customer’s access token works only for the connection that issued it. After that connection ends, a request with its token can get this error or a [`401 authentication_error`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#authentication-error), even if the customer has linked again. Use the new connection’s access token. + * **Neither:** Send a refused request’s ID to [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or to your Anthropic account team if you have one. + +### 403 `user_profile_not_billable` + +Find the cause before you ask the customer to link again, because linking the same organization again can fix only cause 2. + +Check these causes in order: + +1. **Your request’s credential.** The request must authenticate as your app’s [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account) or with a customer’s access token. Any other credential is refused, such as an API key that isn’t bound to a service account. So is a service account that operates no OAuth app, such as an [operator that you replaced](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-change-the-service-account). Correct the request. + +2. **Operator-only authentication.** If you [turned off operator-only authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#turn-off-operator-only-authentication), only a customer’s own access token can bill them. A request from your service account alone is refused, even though the customer shows as **Linked**. + + * **You hold the customer’s access token:** Send the request with it. If it has expired, [refresh the OAuth tokens](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#refresh-the-tokens) first. + * **You hold no refresh token, or the refresh returns `invalid_grant`:** [Link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). + +3. **The customer’s organization.** You can’t see its status from your side, so ask the customer how their organization pays for its Claude API usage. + + * **It isn’t eligible:** It must [pay Anthropic directly](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers). Some organizations billed through a cloud marketplace can link, and then every request that you bill to them gets this error. + * **It has no billing set up:** A new organization can link before it has billing set up. Until then, it gets this error, not the out-of-credit `402`. Ask the customer to buy credits on their [Billing page](https://platform.claude.com/settings/billing) and then send the request again. A purchase can take some time to apply, so if you still get this error or [`linked_organization_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-spend-limit-reached), try again later. + +4. **Something only Anthropic can see.** The customer shows as **Linked**, and your request is correct. Send a refused request’s ID to [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or to your Anthropic account team if you have one. + +### 402 `linked_organization_spend_limit_reached` + +Ask a person with the Admin or Billing role at the customer to check these in the Claude Console. The response doesn’t say which one applies: + +* **Their spend cap for your app:** On the page for your app under [Linked platforms](https://platform.claude.com/linked-platforms), they can set or raise it. A cap set there replaces the default cap that they set for all linked platforms. +* **Their organization’s monthly spend limit:** Under [Spend limits](https://platform.claude.com/settings/billing#spend-limits), they can raise it. +* **Their credit balance:** On their [Billing page](https://platform.claude.com/settings/billing), they can buy credits. A purchase can take some time to apply, so a request soon after it can still get this error. If so, try again later. Some credits can’t pay for these requests: see [Which credits can pay](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#which-credits-can-pay). A balance above $0 USD can therefore still get this error. + +While your app isn’t live, a cap can’t go above $50 USD. A refusal at $50 USD then lasts until the next month begins (UTC): see [Caps while testing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#caps-while-testing). + +An organization that has billing set up but no credit gets this code. One whose billing isn’t set up yet gets [`user_profile_not_billable`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-not-billable). + +### 402 `linked_organization_billing_unavailable` + +What to do depends on when the error arrives: + +* **Before a reply starts:** Anthropic can’t bill the customer’s organization, for example because it’s suspended. The response doesn’t say why. Ask the customer to check their Claude account and their billing status with Anthropic. +* **After Claude has started a reply:** Usually, the organization’s credit ran out, though a suspension can also cut a reply. Ask the customer to buy credits on their [Billing page](https://platform.claude.com/settings/billing) or to check their account. + +A request that isn’t streamed gets an HTTP `402` in both cases, so follow both. A customer who has no credit when the request arrives gets [`linked_organization_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-spend-limit-reached) instead. + +On a streamed reply, the HTTP status is already `200` when the reply is cut, and the error arrives in the stream: + +* **On `/v1/messages`:** As an `error` event whose `error.type` is `billing_error` and whose `error.details.error_code` is this code. The SDK’s class for a `402` doesn’t catch it. +* **On `/v1/chat/completions`:** As a last `data:` line that holds an OpenAI error object, with `billing_error` in `error.code` and no `[DONE]` after it. + +No one pays for the reply that was cut. If the request had already finished a step, such as Claude’s turn before a web search, the customer pays for that step. + +### 400 `user_profile_required` + +Send the customer’s user profile ID in the `anthropic-user-profile-id` header. The request set `bill_to: "user_profile"` without it. A request with a [customer’s access token](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#call-claude-with-a-token) doesn’t need the header. + +### 401 `authentication_error` + +Send the request again with the customer’s newest access token, or [refresh the OAuth tokens](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#refresh-the-tokens). [Link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again) only if their profile shows as **Unlinked**, you hold no refresh token for them, or the refresh returns `invalid_grant`. + +This entry covers requests with a customer’s access token, which no longer works: it expired, a refresh replaced it, or it was revoked. A refresh revokes the earlier token too, so “revoked” in `error.message` doesn’t alone mean that the connection ended. After a connection ends, each request with its token can get this error or a [`403 user_profile_billing_not_authorized`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-billing-not-authorized), in no fixed order. + +### 429 `enforced_spend_limit_reached` + +[Request a higher monthly spend cap](https://platform.claude.com/docs/en/api/rate-limits#requesting-higher-limits) for your organization, or wait until the next month begins (UTC). Sending the request again doesn’t help, even as one that you pay for. + +Your organization reached your usage tier’s monthly spend cap. The customer’s spend cap for your app isn’t the cause, so the customer can’t fix it. See [Reaching your spend cap](https://platform.claude.com/docs/en/api/rate-limits#reaching-your-spend-cap). + +### 503 `overloaded_error` + +Retry with backoff. If the response has a `retry-after` header, wait at least that long. The Claude API couldn’t confirm whether it can bill the customer, so it didn’t serve or bill the request. + +### Other errors with no code + +| Status and type | Cause | Fix | +| ----- | ----- | ----- | +| `400 invalid_request_error` | The `anthropic-user-profile-id` header holds an ID that is malformed or isn’t one of your organization’s user profiles | Send the customer’s user profile ID | +| `400 invalid_request_error` | The request sends `billing_policy` without the `user-profiles-billing-2026-10-01` beta header | Add the beta header | +| `400 invalid_request_error` | `billing_policy` has a missing or invalid field | Correct `billing_policy` | +| `400 invalid_request_error` | The request bills a customer and uses [billable code execution features](https://platform.claude.com/docs/en/about-claude/pricing#code-execution-tool) | Send it as your operator service account, billed to you | +| `invalid_request_error` in an `errored` batch result | A request in a batch bills a customer: see [If you use Message Batches](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-message-batches) | Send it billed to you | +| `400 invalid_request_error` | The request uses a customer’s access token and sets `bill_to: "self"` | Send requests that you pay for as your operator service account | +| `400 invalid_request_error` | The request uses a customer’s access token and names another user profile | Name only that customer’s profile | +| `403 permission_error` | The request uses a customer’s access token on an endpoint that doesn’t take it, such as [Message Batches](https://platform.claude.com/docs/en/build-with-claude/batch-processing) | Send it as your operator service account | +| `403 permission_error` | Anthropic doesn’t bill your organization directly, so it can’t bill customers on your behalf | Bill customers from an organization that pays Anthropic directly | diff --git a/content/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer.md b/content/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer.md new file mode 100644 index 0000000000..d57383ed2a --- /dev/null +++ b/content/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer.md @@ -0,0 +1,1623 @@ +--- +title: Link and bill a customer +url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer +description: Send a customer to approve your OAuth app, save the connection, and bill Claude API requests to their Claude organization. +featureMetadata: + status: beta + betaHeader: user-profiles-billing-2026-10-01 + supportedModels: + - claude-fable-5-2 + - claude-mythos-5-2 + - claude-fable-5-1 + - claude-mythos-5-1 + - claude-fable-5 + - claude-mythos-5 + - claude-mythos-preview + - claude-opus-5-5 + - claude-opus-5 + - claude-sonnet-5-5 + - claude-sonnet-5 + - claude-haiku-5-5 + - claude-haiku-4-5-20251001 + - claude-opus-4-8 + - claude-opus-4-7 + - claude-opus-4-6 + - claude-sonnet-4-6 + - claude-opus-4-5-20251101 + - claude-sonnet-4-5-20250929 + supportedPlatforms: + Claude API: + availability: beta + note: Only requests that send `billing_policy` need the beta header. +--- + + + Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use. + + +This page shows how to build Linked billing into your product. A customer approves your app once, which creates a connection between their Claude organization and one of your user profiles. After that, your back end bills the customer by sending requests as your own [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account), naming the customer’s [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles). You try the flow first on a test customer, a second organization of your own. For how the feature works and whether it fits your product, see [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing). + +## Before you begin + +You need these: + +* **An app set up for Linked billing:** It needs client authentication, an operator service account, and a default workspace: see [Set up your app for Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app). +* **A test customer:** A second Claude organization of yours, because the organization that owns your app can’t link to it. It must pay Anthropic directly, through invoiced billing or [credit that can pay for these requests](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#which-credits-can-pay). +* **A test user:** A person with the Admin or Billing role in the test customer’s organization, who approves for it. Until your app is live, only people on its **Test users** list can link it. [Add this person’s Claude email address](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#add-test-users) to that list. + +### Sample setup + +The samples read these values: + +| Samples | What they need | Where it comes from | +| ----- | ----- | ----- | +| SDK and CLI | Your operator service account’s federation settings, in environment variables, including the federation JWT’s file in `ANTHROPIC_IDENTITY_TOKEN_FILE` | [Construct the SDK client](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#construct-the-sdk-client) | +| cURL requests to the Claude API | Your service account’s access token, in `ANTHROPIC_AUTH_TOKEN` | [Authenticate from your workload](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#authenticate-from-your-workload) | +| Requests to `auth.claude.com` | A client assertion: a JWT for your app’s **Expected audience**, in the file that `CLIENT_ASSERTION_FILE` names or in place of `YOUR_CLIENT_ASSERTION_JWT` | Your identity provider | +| All | Your app’s client ID and redirect URI, in place of the sample’s client ID and redirect URI | Your app’s page in the Claude Console | + +Set `ANTHROPIC_AUTH_TOKEN` only where the cURL samples run. Where the SDK and CLI samples run, unset it and `ANTHROPIC_API_KEY`, because [each one takes priority over federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#credential-precedence). + +The client assertion and the federation JWT usually need different audiences, so keep them in separate files: see [when the two audiences differ](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-the-audiences-differ). The samples that use `CLIENT_ASSERTION_FILE` read it for each request, because the JWT in it rotates. + +## Choose the user profile + +A [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles) is a record in your own organization that stands for one of your customers. A request that bills the customer carries the profile’s ID, which tells Anthropic whom to bill. You can link a profile that you already have, unless it’s archived, and linking doesn’t change its ID or usage history. + +Within one app, a customer’s Claude organization can link to only one of your profiles, and a profile can link to only one organization. Decide which profile stands for which organization before you link your first customer. The organization is the one that your customer selects when they approve, so ask them how their teams use Claude organizations: + +* **Several teams share one Claude organization:** Use one profile for all of the teams. +* **Each team has its own Claude organization:** Use one profile for each organization. + +If the customer selects an organization that’s already linked to another of your profiles, the approval is refused: see [`user_profile_already_linked` in Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-already-linked). + +Two cases change the profile that you create: [If you have a profile for each person](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-you-have-a-profile-for-each-person) and [If you resell API access](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-you-resell-api-access). + +## Link the customer + + + ![Sequence diagram: the customer approves at auth.claude.com, then your back end gets a connection and OAuth tokens](https://platform.claude.com/docs/images/linked-billing-link-flow.svg) + + +### Create the user profile + +Create one user profile for each Claude organization that will link, as you mapped them in [Choose the user profile](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#choose-the-user-profile). Skip this step for a profile that you already have. Send a name and your own ID for the customer (`reference_id`). Create the profile once, and store its ID with the customer’s record: each create request makes a new profile, even with the same `reference_id`. + + + ```bash cURL + curl https://api.anthropic.com/v1/user_profiles \ + -H "authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \ + -H "anthropic-version: 2026-10-21" \ + -H "content-type: application/json" \ + -d '{ + "name": "Example Customer Inc.", + "external_user_details": {"reference_id": "cust_2abc3def"} + }' + ``` + + ```bash CLI + ant user-profiles create \ + --name "Example Customer Inc." \ + --external-user-details.reference-id cust_2abc3def + ``` + + ```python Python + client = anthropic.Anthropic() + + profile = client.user_profiles.create( + name="Example Customer Inc.", + external_user_details={"reference_id": "cust_2abc3def"}, + ) + + print(profile.id) + ``` + + ```typescript TypeScript + const client = new Anthropic(); + + const profile = await client.userProfiles.create({ + name: "Example Customer Inc.", + external_user_details: { reference_id: "cust_2abc3def" } + }); + + console.log(profile.id); + ``` + + ```csharp C# + AnthropicClient client = new(); + + var profile = await client.UserProfiles.Create( + new() + { + Name = "Example Customer Inc.", + ExternalUserDetails = new() { ReferenceID = "cust_2abc3def" }, + } + ); + + Console.WriteLine(profile.ID); + ``` + + ```go Go + client := anthropic.NewClient() + + profile, err := client.UserProfiles.New(context.Background(), anthropic.UserProfileNewParams{ + Name: anthropic.String("Example Customer Inc."), + ExternalUserDetails: anthropic.UserProfileExternalUserDetailsParams{ + ReferenceID: anthropic.String("cust_2abc3def"), + }, + }) + if err != nil { + log.Fatal(err) + } + + fmt.Println(profile.ID) + ``` + + ```java Java + import com.anthropic.models.userprofiles.UserProfileCreateParams; + import com.anthropic.models.userprofiles.UserProfileExternalUserDetailsParams; + + void main() { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + var params = UserProfileCreateParams.builder() + .name("Example Customer Inc.") + .externalUserDetails(UserProfileExternalUserDetailsParams.builder() + .referenceId("cust_2abc3def") + .build()) + .build(); + var profile = client.userProfiles().create(params); + + IO.println(profile.id()); + } + ``` + + ```php PHP + $client = new Client(); + + $profile = $client->userProfiles->create( + name: 'Example Customer Inc.', + externalUserDetails: ['referenceID' => 'cust_2abc3def'], + ); + + echo $profile->id, PHP_EOL; + ``` + + ```ruby Ruby + client = Anthropic::Client.new + + profile = client.user_profiles.create( + name: "Example Customer Inc.", + external_user_details: { reference_id: "cust_2abc3def" } + ) + + puts(profile.id) + ``` + + +The response holds the profile’s `id`, such as `uprof_01HV9Z`. + +### Send the customer to approve + +Add a [Link your Claude organization button](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button) to your product, where your customers manage billing or integrations. Its HTML, colors, and logo are ready to copy. + +The approval page offers only the organizations of the signed-in Claude account, and the organization that the customer selects pays. For what to show beside the button, see [What to tell your customers](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#what-to-tell-your-customers). + +When the customer clicks the button, do these three things in your back end: + +1. **Create a `state` value and a PKCE code verifier,** a random secret that proves your back end started this approval. Store both on your back end, tied to the browser session and the customer’s record. +2. **Send a pushed authorization request** to `auth.claude.com`, which passes the approval’s details from your back end instead of through the browser. +3. **Redirect the browser** to `https://auth.claude.com/oauth/authorize` with your `client_id` and the `request_uri` from the response. A `request_uri` works once and expires after 10 minutes, so send a new pushed authorization request for each click. + +No SDK covers `auth.claude.com`, so the samples for these steps call it over HTTP: + + + ```bash cURL + curl https://auth.claude.com/v1/oauth/par \ + -H "content-type: application/json" \ + -d @- <<'JSON' + { + "response_type": "code", + "client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV", + "redirect_uri": "https://app.example.com/claude/billing/callback", + "scope": "billing:attribution", + "connection_type": "organization_shared", + "connection_auth_target": "platform", + "user_profile_id": "uprof_01HV9Z", + "state": "RANDOM_STATE", + "code_challenge": "BASE64URL_SHA256_OF_VERIFIER", + "code_challenge_method": "S256", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": "YOUR_CLIENT_ASSERTION_JWT" + } + JSON + ``` + + + The `ant` CLI has no command for `auth.claude.com`. Send the request with cURL or in your application’s language. + + + ```python Python + import base64 + import hashlib + import os + import secrets + from pathlib import Path + from urllib.parse import urlencode + + import httpx2 # comes with the Anthropic SDK + + CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV" + + + def push_authorization_request(user_profile_id: str) -> dict[str, str]: + state = secrets.token_urlsafe(32) + code_verifier = secrets.token_urlsafe(64) + digest = hashlib.sha256(code_verifier.encode()).digest() + assertion_file = Path(os.environ["CLIENT_ASSERTION_FILE"]) + + response = httpx2.post( + "https://auth.claude.com/v1/oauth/par", + json={ + "response_type": "code", + "client_id": CLIENT_ID, + "redirect_uri": "https://app.example.com/claude/billing/callback", + "scope": "billing:attribution", + "connection_type": "organization_shared", + "connection_auth_target": "platform", + "user_profile_id": user_profile_id, + "state": state, + "code_challenge": base64.urlsafe_b64encode(digest).rstrip(b"=").decode(), + "code_challenge_method": "S256", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": assertion_file.read_text().strip(), + }, + timeout=10, + ) + if not response.is_success: + raise RuntimeError(f"Request failed: {response.status_code} {response.text}") + + query = {"client_id": CLIENT_ID, "request_uri": response.json()["request_uri"]} + return { + "approval_url": f"https://auth.claude.com/oauth/authorize?{urlencode(query)}", + "state": state, + "code_verifier": code_verifier, + } + ``` + + ```typescript TypeScript + import { createHash, randomBytes } from "node:crypto"; + import { readFile } from "node:fs/promises"; + + const CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV"; + + async function pushAuthorizationRequest(userProfileId: string) { + const state = randomBytes(32).toString("base64url"); + const codeVerifier = randomBytes(64).toString("base64url"); + const jwt = await readFile(process.env.CLIENT_ASSERTION_FILE!, "utf8"); + + const response = await fetch("https://auth.claude.com/v1/oauth/par", { + method: "POST", + redirect: "error", + signal: AbortSignal.timeout(10_000), + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + response_type: "code", + client_id: CLIENT_ID, + redirect_uri: "https://app.example.com/claude/billing/callback", + scope: "billing:attribution", + connection_type: "organization_shared", + connection_auth_target: "platform", + user_profile_id: userProfileId, + state, + code_challenge: createHash("sha256").update(codeVerifier).digest("base64url"), + code_challenge_method: "S256", + client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + client_assertion: jwt.trim() + }) + }); + if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); + } + + const { request_uri } = (await response.json()) as { request_uri: string }; + const query = new URLSearchParams({ client_id: CLIENT_ID, request_uri }); + return { + approvalUrl: `https://auth.claude.com/oauth/authorize?${query}`, + state, + codeVerifier + }; + } + ``` + + ```csharp C# + using System.Buffers.Text; + using System.Net.Http.Json; + using System.Security.Cryptography; + using System.Text; + using System.Text.Json; + + const string ClientId = "clid_01ABcDeFgHiJkLmNoPqRsTuV"; + using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) }; + + async Task<(string ApprovalUrl, string State, string CodeVerifier)> PushAuthorizationRequest( + string userProfileId + ) + { + var state = Base64Url.EncodeToString(RandomNumberGenerator.GetBytes(32)); + var codeVerifier = Base64Url.EncodeToString(RandomNumberGenerator.GetBytes(64)); + var digest = SHA256.HashData(Encoding.ASCII.GetBytes(codeVerifier)); + var assertionFile = Environment.GetEnvironmentVariable("CLIENT_ASSERTION_FILE")!; + var jwt = await File.ReadAllTextAsync(assertionFile); + + using var response = await http.PostAsJsonAsync( + "https://auth.claude.com/v1/oauth/par", + new Dictionary + { + ["response_type"] = "code", + ["client_id"] = ClientId, + ["redirect_uri"] = "https://app.example.com/claude/billing/callback", + ["scope"] = "billing:attribution", + ["connection_type"] = "organization_shared", + ["connection_auth_target"] = "platform", + ["user_profile_id"] = userProfileId, + ["state"] = state, + ["code_challenge"] = Base64Url.EncodeToString(digest), + ["code_challenge_method"] = "S256", + ["client_assertion_type"] = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + ["client_assertion"] = jwt.Trim(), + } + ); + if (!response.IsSuccessStatusCode) + { + var details = await response.Content.ReadAsStringAsync(); + throw new HttpRequestException($"Request failed: {(int)response.StatusCode} {details}"); + } + + var result = await response.Content.ReadFromJsonAsync(); + var requestUri = Uri.EscapeDataString(result.GetProperty("request_uri").GetString()!); + var query = $"client_id={ClientId}&request_uri={requestUri}"; + return ($"https://auth.claude.com/oauth/authorize?{query}", state, codeVerifier); + } + ``` + + ```go Go + import ( + "bytes" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "os" + "strings" + "time" + ) + + const clientID = "clid_01ABcDeFgHiJkLmNoPqRsTuV" + + var httpClient = &http.Client{Timeout: 10 * time.Second} + + type approval struct{ URL, State, CodeVerifier string } + + func pushAuthorizationRequest(userProfileID string) (*approval, error) { + state := rand.Text() + codeVerifier := rand.Text() + rand.Text() // PKCE needs at least 43 characters + digest := sha256.Sum256([]byte(codeVerifier)) + jwt, err := os.ReadFile(os.Getenv("CLIENT_ASSERTION_FILE")) + if err != nil { + return nil, err + } + + body, err := json.Marshal(map[string]string{ + "response_type": "code", + "client_id": clientID, + "redirect_uri": "https://app.example.com/claude/billing/callback", + "scope": "billing:attribution", + "connection_type": "organization_shared", + "connection_auth_target": "platform", + "user_profile_id": userProfileID, + "state": state, + "code_challenge": base64.RawURLEncoding.EncodeToString(digest[:]), + "code_challenge_method": "S256", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": strings.TrimSpace(string(jwt)), + }) + if err != nil { + return nil, err + } + + endpoint := "https://auth.claude.com/v1/oauth/par" + response, err := httpClient.Post(endpoint, "application/json", bytes.NewReader(body)) + if err != nil { + return nil, err + } + defer response.Body.Close() + if response.StatusCode/100 != 2 { + details, _ := io.ReadAll(response.Body) + return nil, fmt.Errorf("request failed: %d %s", response.StatusCode, details) + } + + var result struct { + RequestURI string `json:"request_uri"` + } + if err := json.NewDecoder(response.Body).Decode(&result); err != nil { + return nil, err + } + query := url.Values{"client_id": {clientID}, "request_uri": {result.RequestURI}} + approvalURL := "https://auth.claude.com/oauth/authorize?" + query.Encode() + return &approval{approvalURL, state, codeVerifier}, nil + } + ``` + + ```java Java + import module java.base; + import module java.net.http; + import com.fasterxml.jackson.databind.ObjectMapper; // Jackson comes with the Anthropic SDK + + static final String CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV"; + static final Base64.Encoder BASE64_URL = Base64.getUrlEncoder().withoutPadding(); + final HttpClient http = HttpClient.newHttpClient(); + final ObjectMapper mapper = new ObjectMapper(); + + record Approval(String url, String state, String codeVerifier) {} + + String randomValue(int size) { + var bytes = new byte[size]; + new SecureRandom().nextBytes(bytes); + return BASE64_URL.encodeToString(bytes); + } + + Approval pushAuthorizationRequest(String userProfileId) throws Exception { + var state = randomValue(32); + var codeVerifier = randomValue(64); + var digest = MessageDigest.getInstance("SHA-256") + .digest(codeVerifier.getBytes(StandardCharsets.US_ASCII)); + var jwt = Files.readString(Path.of(System.getenv("CLIENT_ASSERTION_FILE"))); + + var body = mapper.createObjectNode() + .put("response_type", "code") + .put("client_id", CLIENT_ID) + .put("redirect_uri", "https://app.example.com/claude/billing/callback") + .put("scope", "billing:attribution") + .put("connection_type", "organization_shared") + .put("connection_auth_target", "platform") + .put("user_profile_id", userProfileId) + .put("state", state) + .put("code_challenge", BASE64_URL.encodeToString(digest)) + .put("code_challenge_method", "S256") + .put("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") + .put("client_assertion", jwt.strip()); + + var request = HttpRequest.newBuilder(URI.create("https://auth.claude.com/v1/oauth/par")) + .header("content-type", "application/json") + .timeout(Duration.ofSeconds(10)) + .POST(HttpRequest.BodyPublishers.ofString(body.toString())) + .build(); + var response = http.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() / 100 != 2) { + throw new IOException("Request failed: " + response.statusCode() + " " + response.body()); + } + + var requestUri = mapper.readTree(response.body()).get("request_uri").asText(); + var query = "client_id=%s&request_uri=%s" + .formatted(CLIENT_ID, URLEncoder.encode(requestUri, StandardCharsets.UTF_8)); + return new Approval("https://auth.claude.com/oauth/authorize?" + query, state, codeVerifier); + } + ``` + + ```php PHP + const CLIENT_ID = 'clid_01ABcDeFgHiJkLmNoPqRsTuV'; + + function base64Url(string $bytes): string + { + return rtrim(strtr(base64_encode($bytes), '+/', '-_'), '='); + } + + /** @return array{approvalUrl: string, state: string, codeVerifier: string} */ + function pushAuthorizationRequest(string $userProfileId): array + { + $state = base64Url(random_bytes(32)); + $codeVerifier = base64Url(random_bytes(64)); + $jwt = file_get_contents((string) getenv('CLIENT_ASSERTION_FILE')) + ?: throw new \RuntimeException('Cannot read the client assertion file'); + + $body = json_encode([ + 'response_type' => 'code', + 'client_id' => CLIENT_ID, + 'redirect_uri' => 'https://app.example.com/claude/billing/callback', + 'scope' => 'billing:attribution', + 'connection_type' => 'organization_shared', + 'connection_auth_target' => 'platform', + 'user_profile_id' => $userProfileId, + 'state' => $state, + 'code_challenge' => base64Url(hash('sha256', $codeVerifier, binary: true)), + 'code_challenge_method' => 'S256', + 'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', + 'client_assertion' => trim($jwt), + ], JSON_THROW_ON_ERROR); + + $context = stream_context_create(['http' => [ + 'method' => 'POST', + 'header' => 'content-type: application/json', + 'content' => $body, + 'timeout' => 10, + 'ignore_errors' => true, // keep the body of an error response + ]]); + $response = file_get_contents('https://auth.claude.com/v1/oauth/par', context: $context); + $status = http_get_last_response_headers()[0] ?? ''; + if ($response === false || !preg_match('{^HTTP/\S+ 2}', $status)) { + throw new \RuntimeException("Request failed: {$status} {$response}"); + } + + /** @var array{request_uri: string} $result */ + $result = json_decode($response, associative: true, flags: JSON_THROW_ON_ERROR); + $query = http_build_query(['client_id' => CLIENT_ID, 'request_uri' => $result['request_uri']]); + + return [ + 'approvalUrl' => "https://auth.claude.com/oauth/authorize?{$query}", + 'state' => $state, + 'codeVerifier' => $codeVerifier, + ]; + } + ``` + + ```ruby Ruby + require "base64" + require "digest" + require "json" + require "net/http" + require "securerandom" + + CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV" + + def push_authorization_request(user_profile_id) + state = SecureRandom.urlsafe_base64(32) + code_verifier = SecureRandom.urlsafe_base64(64) + digest = Digest::SHA256.digest(code_verifier) + jwt = File.read(ENV.fetch("CLIENT_ASSERTION_FILE")) + + body = { + response_type: "code", + client_id: CLIENT_ID, + redirect_uri: "https://app.example.com/claude/billing/callback", + scope: "billing:attribution", + connection_type: "organization_shared", + connection_auth_target: "platform", + user_profile_id:, + state:, + code_challenge: Base64.urlsafe_encode64(digest, padding: false), + code_challenge_method: "S256", + client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + client_assertion: jwt.strip + } + response = Net::HTTP.start("auth.claude.com", 443, use_ssl: true, read_timeout: 10) do |http| + http.post("/v1/oauth/par", body.to_json, "content-type" => "application/json") + end + unless response.is_a?(Net::HTTPSuccess) + raise "Request failed: #{response.code} #{response.body}" + end + + request_uri = JSON.parse(response.body).fetch("request_uri") + query = URI.encode_www_form(client_id: CLIENT_ID, request_uri:) + { approval_url: "https://auth.claude.com/oauth/authorize?#{query}", state:, code_verifier: } + end + ``` + + +The pushed authorization request carries your client ID and a client assertion, the customer’s user profile ID, and the scope. It also carries your registered redirect URI, the `state`, and a code challenge made from the verifier. `connection_type` and `connection_auth_target` mark it as a Linked billing request. For each field and its value, see [OAuth endpoints and parameters](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#authorization-requests). + +The scope is `billing:attribution`. To also get a refresh token, ask for `billing:attribution offline_access`, which needs **Offline access** turned on for your app. Whether you need one depends on [how your back end bills](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#choose-whether-to-get-refresh-tokens). Adding `offline_access` for a customer who is already linked makes a new connection that replaces the earlier one: see [If a customer approves again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-a-customer-approves-again). + +On the approval page, the customer signs in to Claude if needed, selects the organization to link, and approves. Until your app is live, the person who approves must also set a spend cap for your app: see [Caps while testing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#caps-while-testing). + +### Save the connection and its OAuth tokens + +After the customer approves, `auth.claude.com` sends the browser to your redirect URI. Then, do these things in your back end: + +1. **Check the callback.** Check that its `state` matches the one you stored, which shows that the same browser came back. Check that its `iss` is `https://identity.anthropic.com/users`, which shows that the callback came from Claude. If either is missing or doesn’t match, stop. +2. **Check for an error.** If the callback carries an `error` parameter instead of a code, no connection was made. For the causes, see [Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#while-linking). +3. **Exchange the code at once.** Send it with the PKCE code verifier, the redirect URI from your pushed authorization request, and a client assertion. The code expires after 5 minutes. +4. **Store what the response returns.** The exchange returns the OAuth tokens only once. + +These samples send the code exchange to `auth.claude.com` over HTTP: + + + ```bash cURL + curl https://auth.claude.com/v1/oauth/token \ + -H "content-type: application/json" \ + -d @- <<'JSON' + { + "grant_type": "authorization_code", + "code": "AUTH_CODE", + "code_verifier": "ORIGINAL_CODE_VERIFIER", + "redirect_uri": "https://app.example.com/claude/billing/callback", + "client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": "YOUR_CLIENT_ASSERTION_JWT" + } + JSON + ``` + + + The `ant` CLI has no command for `auth.claude.com`. Send the request with cURL or in your application’s language. + + + ```python Python + import os + import secrets + from pathlib import Path + + import httpx2 # comes with the Anthropic SDK + + + def handle_callback(params: dict[str, str], state: str, code_verifier: str) -> dict: + if not secrets.compare_digest(params.get("state", "").encode(), state.encode()): + raise ValueError("state does not match") + if params.get("iss") != "https://identity.anthropic.com/users": + raise ValueError("iss does not match") + if "error" in params: + raise PermissionError(params["error"]) + + assertion_file = Path(os.environ["CLIENT_ASSERTION_FILE"]) + + response = httpx2.post( + "https://auth.claude.com/v1/oauth/token", + json={ + "grant_type": "authorization_code", + "code": params["code"], + "code_verifier": code_verifier, + "redirect_uri": "https://app.example.com/claude/billing/callback", + "client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": assertion_file.read_text().strip(), + }, + timeout=10, + ) + if not response.is_success: + raise RuntimeError(f"Exchange failed: {response.status_code} {response.text}") + return response.json() # connection_id and the tokens + ``` + + ```typescript TypeScript + import { timingSafeEqual } from "node:crypto"; + import { readFile } from "node:fs/promises"; + + async function handleCallback(params: URLSearchParams, state: string, codeVerifier: string) { + const received = new TextEncoder().encode(params.get("state") ?? ""); + const expected = new TextEncoder().encode(state); + if (received.length !== expected.length || !timingSafeEqual(received, expected)) { + throw new Error("state does not match"); + } + if (params.get("iss") !== "https://identity.anthropic.com/users") { + throw new Error("iss does not match"); + } + if (params.has("error")) { + throw new Error(`Linking failed: ${params.get("error")}`); + } + + const jwt = await readFile(process.env.CLIENT_ASSERTION_FILE!, "utf8"); + + const response = await fetch("https://auth.claude.com/v1/oauth/token", { + method: "POST", + redirect: "error", + signal: AbortSignal.timeout(10_000), + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + grant_type: "authorization_code", + code: params.get("code"), + code_verifier: codeVerifier, + redirect_uri: "https://app.example.com/claude/billing/callback", + client_id: "clid_01ABcDeFgHiJkLmNoPqRsTuV", + client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + client_assertion: jwt.trim() + }) + }); + if (!response.ok) { + throw new Error(`Exchange failed: ${response.status} ${await response.text()}`); + } + return response.json(); // connection_id and the tokens + } + ``` + + ```csharp C# + using System.Net.Http.Json; + using System.Security.Cryptography; + using System.Text; + using System.Text.Json; + + using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) }; + + async Task HandleCallback( + Dictionary parameters, + string state, + string codeVerifier + ) + { + var received = Encoding.UTF8.GetBytes(parameters.GetValueOrDefault("state", "")); + if (!CryptographicOperations.FixedTimeEquals(received, Encoding.UTF8.GetBytes(state))) + { + throw new InvalidOperationException("state does not match"); + } + if (parameters.GetValueOrDefault("iss") != "https://identity.anthropic.com/users") + { + throw new InvalidOperationException("iss does not match"); + } + if (parameters.TryGetValue("error", out var error)) + { + throw new InvalidOperationException($"Linking failed: {error}"); + } + + var assertionFile = Environment.GetEnvironmentVariable("CLIENT_ASSERTION_FILE")!; + var jwt = await File.ReadAllTextAsync(assertionFile); + + using var response = await http.PostAsJsonAsync( + "https://auth.claude.com/v1/oauth/token", + new Dictionary + { + ["grant_type"] = "authorization_code", + ["code"] = parameters["code"], + ["code_verifier"] = codeVerifier, + ["redirect_uri"] = "https://app.example.com/claude/billing/callback", + ["client_id"] = "clid_01ABcDeFgHiJkLmNoPqRsTuV", + ["client_assertion_type"] = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + ["client_assertion"] = jwt.Trim(), + } + ); + if (!response.IsSuccessStatusCode) + { + var details = await response.Content.ReadAsStringAsync(); + throw new HttpRequestException($"Exchange failed: {(int)response.StatusCode} {details}"); + } + + // connection_id and the tokens + return await response.Content.ReadFromJsonAsync(); + } + ``` + + ```go Go + import ( + "bytes" + "crypto/subtle" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "os" + "strings" + "time" + ) + + var httpClient = &http.Client{Timeout: 10 * time.Second} + + func handleCallback(params url.Values, state, codeVerifier string) (map[string]any, error) { + if subtle.ConstantTimeCompare([]byte(params.Get("state")), []byte(state)) != 1 { + return nil, errors.New("state does not match") + } + if params.Get("iss") != "https://identity.anthropic.com/users" { + return nil, errors.New("iss does not match") + } + if params.Has("error") { + return nil, fmt.Errorf("linking failed: %s", params.Get("error")) + } + + jwt, err := os.ReadFile(os.Getenv("CLIENT_ASSERTION_FILE")) + if err != nil { + return nil, err + } + + body, err := json.Marshal(map[string]string{ + "grant_type": "authorization_code", + "code": params.Get("code"), + "code_verifier": codeVerifier, + "redirect_uri": "https://app.example.com/claude/billing/callback", + "client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": strings.TrimSpace(string(jwt)), + }) + if err != nil { + return nil, err + } + + endpoint := "https://auth.claude.com/v1/oauth/token" + response, err := httpClient.Post(endpoint, "application/json", bytes.NewReader(body)) + if err != nil { + return nil, err + } + defer response.Body.Close() + if response.StatusCode/100 != 2 { + details, _ := io.ReadAll(response.Body) + return nil, fmt.Errorf("exchange failed: %d %s", response.StatusCode, details) + } + + var connection map[string]any // connection_id and the tokens + err = json.NewDecoder(response.Body).Decode(&connection) + return connection, err + } + ``` + + ```java Java + import module java.base; + import module java.net.http; + import com.fasterxml.jackson.databind.JsonNode; + import com.fasterxml.jackson.databind.ObjectMapper; // Jackson comes with the Anthropic SDK + + final HttpClient http = HttpClient.newHttpClient(); + final ObjectMapper mapper = new ObjectMapper(); + + JsonNode handleCallback(Map params, String state, String codeVerifier) + throws Exception { + var received = params.getOrDefault("state", "").getBytes(StandardCharsets.UTF_8); + if (!MessageDigest.isEqual(received, state.getBytes(StandardCharsets.UTF_8))) { + throw new IllegalStateException("state does not match"); + } + if (!"https://identity.anthropic.com/users".equals(params.get("iss"))) { + throw new IllegalStateException("iss does not match"); + } + if (params.containsKey("error")) { + throw new IllegalStateException("Linking failed: " + params.get("error")); + } + + var jwt = Files.readString(Path.of(System.getenv("CLIENT_ASSERTION_FILE"))); + + var body = mapper.createObjectNode() + .put("grant_type", "authorization_code") + .put("code", params.get("code")) + .put("code_verifier", codeVerifier) + .put("redirect_uri", "https://app.example.com/claude/billing/callback") + .put("client_id", "clid_01ABcDeFgHiJkLmNoPqRsTuV") + .put("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") + .put("client_assertion", jwt.strip()); + + var request = HttpRequest.newBuilder(URI.create("https://auth.claude.com/v1/oauth/token")) + .header("content-type", "application/json") + .timeout(Duration.ofSeconds(10)) + .POST(HttpRequest.BodyPublishers.ofString(body.toString())) + .build(); + var response = http.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() / 100 != 2) { + throw new IOException("Exchange failed: " + response.statusCode() + " " + response.body()); + } + return mapper.readTree(response.body()); // connection_id and the tokens + } + ``` + + ```php PHP + /** @param array $params */ + function handleCallback(array $params, string $state, string $codeVerifier): mixed + { + if (!hash_equals($state, $params['state'] ?? '')) { + throw new \RuntimeException('state does not match'); + } + if (($params['iss'] ?? '') !== 'https://identity.anthropic.com/users') { + throw new \RuntimeException('iss does not match'); + } + if (isset($params['error'])) { + throw new \RuntimeException("Linking failed: {$params['error']}"); + } + + $jwt = file_get_contents((string) getenv('CLIENT_ASSERTION_FILE')) + ?: throw new \RuntimeException('Cannot read the client assertion file'); + + $body = json_encode([ + 'grant_type' => 'authorization_code', + 'code' => $params['code'], + 'code_verifier' => $codeVerifier, + 'redirect_uri' => 'https://app.example.com/claude/billing/callback', + 'client_id' => 'clid_01ABcDeFgHiJkLmNoPqRsTuV', + 'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', + 'client_assertion' => trim($jwt), + ], JSON_THROW_ON_ERROR); + + $context = stream_context_create(['http' => [ + 'method' => 'POST', + 'header' => 'content-type: application/json', + 'content' => $body, + 'timeout' => 10, + 'ignore_errors' => true, // keep the body of an error response + ]]); + $response = file_get_contents('https://auth.claude.com/v1/oauth/token', context: $context); + $status = http_get_last_response_headers()[0] ?? ''; + if ($response === false || !preg_match('{^HTTP/\S+ 2}', $status)) { + throw new \RuntimeException("Exchange failed: {$status} {$response}"); + } + + // connection_id and the tokens + return json_decode($response, associative: true, flags: JSON_THROW_ON_ERROR); + } + ``` + + ```ruby Ruby + require "json" + require "net/http" + require "openssl" + + def handle_callback(params, state, code_verifier) + raise "state does not match" unless OpenSSL.secure_compare(params["state"].to_s, state) + raise "iss does not match" unless params["iss"] == "https://identity.anthropic.com/users" + raise "Linking failed: #{params["error"]}" if params.key?("error") + + jwt = File.read(ENV.fetch("CLIENT_ASSERTION_FILE")) + + body = { + grant_type: "authorization_code", + code: params.fetch("code"), + code_verifier:, + redirect_uri: "https://app.example.com/claude/billing/callback", + client_id: "clid_01ABcDeFgHiJkLmNoPqRsTuV", + client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + client_assertion: jwt.strip + } + response = Net::HTTP.start("auth.claude.com", 443, use_ssl: true, read_timeout: 10) do |http| + http.post("/v1/oauth/token", body.to_json, "content-type" => "application/json") + end + unless response.is_a?(Net::HTTPSuccess) + raise "Exchange failed: #{response.code} #{response.body}" + end + + JSON.parse(response.body) # connection_id and the tokens + end + ``` + + +The response holds these values: + +| Value | What it is | What to do with it | +| ----- | ----- | ----- | +| `connection_id` | The connection’s ID | Store it with the customer’s record, to end the connection from your back end later | +| `access_token` | The customer’s own token, separate from your service account’s: it can bill only this customer, for up to 1 hour | Store it as a secret | +| `refresh_token` | A token that gets new access tokens, if you asked for `offline_access` | Store it as a secret | + +The response doesn’t say which organization the customer linked. + +The requests on this page bill as your service account, so they don’t need the OAuth tokens. Store them anyway: you need them to [use a separate credential for each customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer). If you asked for a refresh token, you can’t get it again unless you unlink the customer and they link again. + +If the exchange fails, what you do depends on how: + +* **The exchange returns `unauthorized_client`:** Usually, your app has no operator service account or default workspace, or the workspace is archived. See [how to fix `unauthorized_client`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#code-exchange-unauthorized-client). +* **The exchange returns `invalid_grant`:** The redirect URI or the verifier was wrong, or the code expired or was already used. A wrong redirect URI or verifier uses up the code, so the customer has to approve again. For a customer who is already linked, see [If a customer approves again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-a-customer-approves-again). +* **The exchange timed out:** [Send the same code once more](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-the-code-exchange-times-out). + +## Bill a request + +Send every request for this customer as your operator service account, and put the customer’s user profile ID in the `anthropic-user-profile-id` header. The SDK sends that header for you from its user profile parameter. The header makes the request count in that profile’s usage, whoever pays. Then, choose on each request whether the customer or you pays. + +### Your customer pays + +To bill a request to the customer, name the profile that holds their connection in that header, and also send: + +* [`billing_policy`](https://platform.claude.com/docs/en/api/beta/messages/create) in the request body, set to `{"type": "billing_policy", "bill_to": "user_profile"}` +* the `user-profiles-billing-2026-10-01` beta header + + + If a request names another linked customer’s profile, Anthropic bills that customer’s organization, and no error tells you. + + +Check each request’s profile ID. Your test customer pays real money for these requests, as any customer would. + + + ```bash cURL + curl https://api.anthropic.com/v1/messages \ + -H "authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \ + -H "anthropic-version: 2026-10-21" \ + -H "anthropic-beta: user-profiles-billing-2026-10-01" \ + -H "anthropic-user-profile-id: uprof_01HV9Z" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-5-5", + "max_tokens": 1024, + "messages": [{"role": "user", "content": "Hello, Claude"}], + "billing_policy": {"type": "billing_policy", "bill_to": "user_profile"} + }' + ``` + + ```bash CLI + ant beta:messages create \ + --beta user-profiles-billing-2026-10-01 \ + --user-profile-id uprof_01HV9Z \ + --model claude-opus-5-5 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' \ + --billing-policy '{type: billing_policy, bill_to: user_profile}' + ``` + + ```python Python + client = anthropic.Anthropic() + + message = client.beta.messages.create( + model="claude-opus-5-5", + max_tokens=1024, + messages=[{"role": "user", "content": "Hello, Claude"}], + betas=["user-profiles-billing-2026-10-01"], + user_profile_id="uprof_01HV9Z", + billing_policy={"type": "billing_policy", "bill_to": "user_profile"}, + ) + + for block in message.content: + if block.type == "text": + print(block.text) + ``` + + ```typescript TypeScript + const client = new Anthropic(); + + const message = await client.beta.messages.create({ + model: "claude-opus-5-5", + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }], + betas: ["user-profiles-billing-2026-10-01"], + user_profile_id: "uprof_01HV9Z", + billing_policy: { type: "billing_policy", bill_to: "user_profile" } + }); + + for (const block of message.content) { + if (block.type === "text") { + console.log(block.text); + } + } + ``` + + ```csharp C# + using Anthropic.Models.Beta.Messages; + using Model = Anthropic.Models.Messages.Model; + + AnthropicClient client = new(); + + var message = await client.Beta.Messages.Create( + new MessageCreateParams + { + Model = Model.ClaudeOpus5_5, + MaxTokens = 1024, + Messages = [new BetaUserMessageParam { Content = "Hello, Claude" }], + Betas = ["user-profiles-billing-2026-10-01"], + UserProfileID = "uprof_01HV9Z", + BillingPolicy = new() { BillTo = BetaBillTo.UserProfile }, + } + ); + + foreach (var block in message.Content) + { + if (block.TryPickText(out var textBlock)) + { + Console.WriteLine(textBlock.Text); + } + } + ``` + + ```go Go + client := anthropic.NewClient() + + message, err := client.Beta.Messages.New(context.Background(), anthropic.BetaMessageNewParams{ + Model: anthropic.ModelClaudeOpus5_5, + MaxTokens: 1024, + Messages: []anthropic.BetaMessageParam{ + anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("Hello, Claude")), + }, + Betas: []anthropic.AnthropicBeta{"user-profiles-billing-2026-10-01"}, + UserProfileID: anthropic.String("uprof_01HV9Z"), + BillingPolicy: anthropic.BetaBillingPolicyParam{BillTo: anthropic.BetaBillToUserProfile}, + }) + if err != nil { + log.Fatal(err) + } + + for _, block := range message.Content { + if textBlock, ok := block.AsAny().(anthropic.BetaTextBlock); ok { + fmt.Println(textBlock.Text) + } + } + ``` + + ```java Java + import com.anthropic.models.beta.messages.BetaBillTo; + import com.anthropic.models.beta.messages.BetaBillingPolicy; + import com.anthropic.models.beta.messages.MessageCreateParams; + import com.anthropic.models.messages.Model; + + void main() { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + var params = MessageCreateParams.builder() + .model(Model.CLAUDE_OPUS_5_5) + .maxTokens(1024) + .addUserMessage("Hello, Claude") + .addBeta("user-profiles-billing-2026-10-01") + .userProfileId("uprof_01HV9Z") + .billingPolicy(BetaBillingPolicy.builder() + .billTo(BetaBillTo.USER_PROFILE) + .build()) + .build(); + var message = client.beta().messages().create(params); + + for (var block : message.content()) { + block.text().ifPresent(textBlock -> IO.println(textBlock.text())); + } + } + ``` + + ```php PHP + use Anthropic\Beta\Messages\BetaBillingPolicy; + use Anthropic\Beta\Messages\BetaBillTo; + use Anthropic\Beta\Messages\BetaTextBlock; + use Anthropic\Messages\Model; + + $client = new Client(); + + $message = $client->beta->messages->create( + maxTokens: 1024, + messages: [['role' => 'user', 'content' => 'Hello, Claude']], + model: Model::CLAUDE_OPUS_5_5, + betas: ['user-profiles-billing-2026-10-01'], + userProfileID: 'uprof_01HV9Z', + billingPolicy: BetaBillingPolicy::with(billTo: BetaBillTo::USER_PROFILE), + ); + + foreach ($message->content as $block) { + if ($block instanceof BetaTextBlock) { + echo $block->text, PHP_EOL; + } + } + ``` + + ```ruby Ruby + client = Anthropic::Client.new + + message = client.beta.messages.create( + model: Anthropic::Model::CLAUDE_OPUS_5_5, + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }], + betas: ["user-profiles-billing-2026-10-01"], + user_profile_id: "uprof_01HV9Z", + billing_policy: { type: :billing_policy, bill_to: :user_profile } + ) + + message.content.each do |block| + puts(block.text) if block.is_a?(Anthropic::Beta::BetaTextBlock) + end + ``` + + +The Claude API either bills the customer or refuses the request. It never bills you instead. On `/v1/messages`, a refused request carries its code in `error.details.error_code`. It can have these causes: + +* **A new connection:** A new connection can take about 10 seconds to work after the code exchange. If your first request is refused with `user_profile_billing_not_authorized` within those 10 seconds, send it again after they pass. If it’s still refused, see [how to fix `user_profile_billing_not_authorized`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-billing-not-authorized). +* **A customer who can’t be billed:** `user_profile_not_billable` can mean that the customer’s organization can’t be billed, for example because it has no billing set up. See [how to fix `user_profile_not_billable`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-not-billable). +* **A spend limit or no credit:** Requests are refused with `linked_organization_spend_limit_reached` when the customer’s spend through your app reaches their cap or their organization reaches its own monthly spend limit. The same happens when no credit on their account can pay. +* **Anything else:** See [Linked billing errors while billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#while-billing). + +### You pay + +To pay for a request yourself, keep sending the customer’s user profile ID in the header. Then, either leave `billing_policy` out or set its `bill_to` to `"self"`. + +Without `billing_policy`, the beta header is optional: + + + ```bash cURL + curl https://api.anthropic.com/v1/messages \ + -H "authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \ + -H "anthropic-version: 2026-10-21" \ + -H "anthropic-user-profile-id: uprof_01HV9Z" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-5-5", + "max_tokens": 1024, + "messages": [{"role": "user", "content": "Hello, Claude"}] + }' + ``` + + ```bash CLI + ant messages create \ + --user-profile-id uprof_01HV9Z \ + --model claude-opus-5-5 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' + ``` + + ```python Python + client = anthropic.Anthropic() + + message = client.messages.create( + model="claude-opus-5-5", + max_tokens=1024, + messages=[{"role": "user", "content": "Hello, Claude"}], + user_profile_id="uprof_01HV9Z", + ) + + for block in message.content: + if block.type == "text": + print(block.text) + ``` + + ```typescript TypeScript + const client = new Anthropic(); + + const message = await client.messages.create({ + model: "claude-opus-5-5", + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }], + user_profile_id: "uprof_01HV9Z" + }); + + for (const block of message.content) { + if (block.type === "text") { + console.log(block.text); + } + } + ``` + + ```csharp C# + using Anthropic.Models.Messages; + + AnthropicClient client = new(); + + var message = await client.Messages.Create( + new MessageCreateParams + { + Model = Model.ClaudeOpus5_5, + MaxTokens = 1024, + Messages = [new UserMessageParam { Content = "Hello, Claude" }], + UserProfileID = "uprof_01HV9Z", + } + ); + + foreach (var block in message.Content) + { + if (block.TryPickText(out var textBlock)) + { + Console.WriteLine(textBlock.Text); + } + } + ``` + + ```go Go + client := anthropic.NewClient() + + message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{ + Model: anthropic.ModelClaudeOpus5_5, + MaxTokens: 1024, + Messages: []anthropic.MessageParam{ + anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")), + }, + UserProfileID: anthropic.String("uprof_01HV9Z"), + }) + if err != nil { + log.Fatal(err) + } + + for _, block := range message.Content { + if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok { + fmt.Println(textBlock.Text) + } + } + ``` + + ```java Java + import com.anthropic.models.messages.MessageCreateParams; + import com.anthropic.models.messages.Model; + + void main() { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + var params = MessageCreateParams.builder() + .model(Model.CLAUDE_OPUS_5_5) + .maxTokens(1024) + .addUserMessage("Hello, Claude") + .userProfileId("uprof_01HV9Z") + .build(); + var message = client.messages().create(params); + + for (var block : message.content()) { + block.text().ifPresent(textBlock -> IO.println(textBlock.text())); + } + } + ``` + + ```php PHP + use Anthropic\Messages\Model; + use Anthropic\Messages\TextBlock; + + $client = new Client(); + + $message = $client->messages->create( + maxTokens: 1024, + messages: [['role' => 'user', 'content' => 'Hello, Claude']], + model: Model::CLAUDE_OPUS_5_5, + userProfileID: 'uprof_01HV9Z', + ); + + foreach ($message->content as $block) { + if ($block instanceof TextBlock) { + echo $block->text, PHP_EOL; + } + } + ``` + + ```ruby Ruby + client = Anthropic::Client.new + + message = client.messages.create( + model: Anthropic::Model::CLAUDE_OPUS_5_5, + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }], + user_profile_id: "uprof_01HV9Z" + ) + + message.content.each do |block| + puts(block.text) if block.is_a?(Anthropic::Models::TextBlock) + end + ``` + + +With `bill_to` set to `"self"`, the request needs the beta header: + + + ```bash cURL + curl https://api.anthropic.com/v1/messages \ + -H "authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \ + -H "anthropic-version: 2026-10-21" \ + -H "anthropic-beta: user-profiles-billing-2026-10-01" \ + -H "anthropic-user-profile-id: uprof_01HV9Z" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-5-5", + "max_tokens": 1024, + "messages": [{"role": "user", "content": "Hello, Claude"}], + "billing_policy": {"type": "billing_policy", "bill_to": "self"} + }' + ``` + + ```bash CLI + ant beta:messages create \ + --beta user-profiles-billing-2026-10-01 \ + --user-profile-id uprof_01HV9Z \ + --model claude-opus-5-5 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' \ + --billing-policy '{type: billing_policy, bill_to: self}' + ``` + + ```python Python + client = anthropic.Anthropic() + + message = client.beta.messages.create( + model="claude-opus-5-5", + max_tokens=1024, + messages=[{"role": "user", "content": "Hello, Claude"}], + betas=["user-profiles-billing-2026-10-01"], + user_profile_id="uprof_01HV9Z", + billing_policy={"type": "billing_policy", "bill_to": "self"}, + ) + + for block in message.content: + if block.type == "text": + print(block.text) + ``` + + ```typescript TypeScript + const client = new Anthropic(); + + const message = await client.beta.messages.create({ + model: "claude-opus-5-5", + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }], + betas: ["user-profiles-billing-2026-10-01"], + user_profile_id: "uprof_01HV9Z", + billing_policy: { type: "billing_policy", bill_to: "self" } + }); + + for (const block of message.content) { + if (block.type === "text") { + console.log(block.text); + } + } + ``` + + ```csharp C# + using Anthropic.Models.Beta.Messages; + using Model = Anthropic.Models.Messages.Model; + + AnthropicClient client = new(); + + var message = await client.Beta.Messages.Create( + new MessageCreateParams + { + Model = Model.ClaudeOpus5_5, + MaxTokens = 1024, + Messages = [new BetaUserMessageParam { Content = "Hello, Claude" }], + Betas = ["user-profiles-billing-2026-10-01"], + UserProfileID = "uprof_01HV9Z", + BillingPolicy = new() { BillTo = BetaBillTo.Self }, + } + ); + + foreach (var block in message.Content) + { + if (block.TryPickText(out var textBlock)) + { + Console.WriteLine(textBlock.Text); + } + } + ``` + + ```go Go + client := anthropic.NewClient() + + message, err := client.Beta.Messages.New(context.Background(), anthropic.BetaMessageNewParams{ + Model: anthropic.ModelClaudeOpus5_5, + MaxTokens: 1024, + Messages: []anthropic.BetaMessageParam{ + anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("Hello, Claude")), + }, + Betas: []anthropic.AnthropicBeta{"user-profiles-billing-2026-10-01"}, + UserProfileID: anthropic.String("uprof_01HV9Z"), + BillingPolicy: anthropic.BetaBillingPolicyParam{BillTo: anthropic.BetaBillToSelf}, + }) + if err != nil { + log.Fatal(err) + } + + for _, block := range message.Content { + if textBlock, ok := block.AsAny().(anthropic.BetaTextBlock); ok { + fmt.Println(textBlock.Text) + } + } + ``` + + ```java Java + import com.anthropic.models.beta.messages.BetaBillTo; + import com.anthropic.models.beta.messages.BetaBillingPolicy; + import com.anthropic.models.beta.messages.MessageCreateParams; + import com.anthropic.models.messages.Model; + + void main() { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + var params = MessageCreateParams.builder() + .model(Model.CLAUDE_OPUS_5_5) + .maxTokens(1024) + .addUserMessage("Hello, Claude") + .addBeta("user-profiles-billing-2026-10-01") + .userProfileId("uprof_01HV9Z") + .billingPolicy(BetaBillingPolicy.builder() + .billTo(BetaBillTo.SELF) + .build()) + .build(); + var message = client.beta().messages().create(params); + + for (var block : message.content()) { + block.text().ifPresent(textBlock -> IO.println(textBlock.text())); + } + } + ``` + + ```php PHP + use Anthropic\Beta\Messages\BetaBillingPolicy; + use Anthropic\Beta\Messages\BetaBillTo; + use Anthropic\Beta\Messages\BetaTextBlock; + use Anthropic\Messages\Model; + + $client = new Client(); + + $message = $client->beta->messages->create( + maxTokens: 1024, + messages: [['role' => 'user', 'content' => 'Hello, Claude']], + model: Model::CLAUDE_OPUS_5_5, + betas: ['user-profiles-billing-2026-10-01'], + userProfileID: 'uprof_01HV9Z', + billingPolicy: BetaBillingPolicy::with(billTo: BetaBillTo::SELF), + ); + + foreach ($message->content as $block) { + if ($block instanceof BetaTextBlock) { + echo $block->text, PHP_EOL; + } + } + ``` + + ```ruby Ruby + client = Anthropic::Client.new + + message = client.beta.messages.create( + model: Anthropic::Model::CLAUDE_OPUS_5_5, + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Claude" }], + betas: ["user-profiles-billing-2026-10-01"], + user_profile_id: "uprof_01HV9Z", + billing_policy: { type: :billing_policy, bill_to: :self } + ) + + message.content.each do |block| + puts(block.text) if block.is_a?(Anthropic::Beta::BetaTextBlock) + end + ``` + + +## Check the result + +First, check in the Claude Console that the customer is linked: + +* Your User profiles page displays the customer’s profile as **Linked**. Only members with the Admin role see this status. +* Your app’s **Overview** tab lists the customer under **Linked customers**, with the connection ID that you stored. + +Then, check the bill in the Console, because a billed request that succeeds returns a normal response that doesn’t say who paid. The test customer’s [Linked platforms](https://platform.claude.com/linked-platforms) page is open to members of that organization with the Admin or Billing role. + +| Where | What it displays | How soon | +| ----- | ----- | ----- | +| The test customer’s [Linked platforms](https://platform.claude.com/linked-platforms) page | Your app’s spend this month, against the cap | Within about a minute | +| The test customer’s Linked platforms page | Your app’s cost and usage this month | Every few hours | +| Your [User profiles](https://platform.claude.com/user-profiles) page | **Requests** and **Tokens** count the request. **Your spend** doesn’t. | About once an hour, though a request can take a few hours to appear | + +When the test works, [publish your app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#publish-the-app) so that your customers can link it. + +## What to tell your customers + +Before real customers link, tell them these things in your product: + +* **Who can approve:** A person with the Admin or Billing role in their Claude organization. +* **Which account in your product they’re linking:** Show it beside the button. +* **Which Claude account they’re using:** Ask them to check the account that the approval page displays. +* **That they’re linked:** After the code exchange, say that the customer is linked, not that billing is active. A customer’s organization can link before Anthropic can bill it, for example before it has billing set up. +* **What you bill them for:** Only the Claude usage that they and their users cause in your product. For the full rule, see [What you may bill](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#what-you-may-bill). + +## Rules and special cases + +These sections give the rules behind the earlier steps and what to do in particular cases. + +### If your federation rule and client authentication expect different audiences + +Your back end sends a JWT from your identity provider in two places: + +* **To federation, for the Claude API:** The JWT must have your federation rule’s audience. A rule that leaves its audience blank expects `https://api.anthropic.com`. +* **To `auth.claude.com`, as the client assertion:** The JWT must have exactly one audience, your app’s **Expected audience**, from its **Client authentication** tab. + +With a rule that leaves its audience blank, the two usually differ, so get a JWT for each audience from your identity provider. The SDK and CLI read the federation JWT from the file that `ANTHROPIC_IDENTITY_TOKEN_FILE` names. The client assertion goes in the file that `CLIENT_ASSERTION_FILE` names. + +### If the code exchange times out + +A code works once, but a retry after a timeout is safe. If the first try never reached `auth.claude.com`, a retry within the code’s 5 minutes succeeds. If it got through, the retry returns `invalid_grant` and changes nothing. In that case, [check whether the customer is linked](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#check-a-links-status): + +* **Not linked:** Start again from the pushed authorization request. +* **Linked:** You don’t have the connection ID or OAuth tokens that the lost response held. If you asked for `billing:attribution` alone, send the customer to approve again with the same scope. That returns the same connection ID and a new access token. If you also asked for `offline_access`, follow [Link a customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). + +### If you have a profile for each person + +You might already have a user profile for each person who uses your product, and several of them might work for one customer. Only one profile can link each organization, so Anthropic recommends that you create one more profile for the customer’s organization and link that one. Then, the profile ID that you send depends on who pays: + +* **Requests that the customer pays for:** Send the ID of the customer’s profile. To also tell Anthropic which person a request comes from, send an opaque ID for the person in `metadata.user_id`, never a name, email address, or phone number. See [Identify one person within a company](https://platform.claude.com/docs/en/manage-claude/user-profiles#identify-individual-users-within-a-company). +* **Requests that you pay for:** You can keep sending the person’s own profile ID. + +### If you resell API access + +If your organization resells API access, also send `"access_type": "passthrough"` when you create the customer’s profile. The samples leave `access_type` out, which creates an `application` profile. For the two types, see [Decide who gets a profile](https://platform.claude.com/docs/en/manage-claude/user-profiles#decide-who-gets-a-profile). + +### If a customer approves again + +A customer approves again when you send them to approve for a profile that already has a connection. What the code exchange does depends on the connection’s scopes and the scopes of the new approval: + +| The customer approves | What the code exchange does | What you do | +| ----- | ----- | ----- | +| `billing:attribution` again | Returns the same connection ID and a new access token | Store the new access token | +| `billing:attribution offline_access` again | Returns `invalid_grant`, and the connection stays as it was | To get new OAuth tokens, [unlink the customer and have them link again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again) | +| Other scopes, such as `offline_access` added to `billing:attribution` | Ends the earlier connection and its OAuth tokens and makes a new one with a new ID | Store the new connection ID and OAuth tokens | + +If the exchange for a change of scopes fails with a 5xx response, the earlier connection might have ended already. Requests that you bill to the customer are refused until a new exchange succeeds. To recover: + +1. Send the customer to approve again with the new scopes. +2. If that exchange returns `invalid_grant`, [unlink the customer and have them link again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again). + +### For agents + +* If the pushed authorization request fails, don’t redirect the browser. +* When you send a request with `bill_to: "user_profile"`, record it in your own logs: no response says who paid. + +## Next steps + + + + The approval page, spend caps, and emails that your customers see, so that you can support them + + diff --git a/content/en/manage-claude/oauth-apps/linked-billing/link-button.md b/content/en/manage-claude/oauth-apps/linked-billing/link-button.md new file mode 100644 index 0000000000..8b935c9920 --- /dev/null +++ b/content/en/manage-claude/oauth-apps/linked-billing/link-button.md @@ -0,0 +1,230 @@ +--- +title: Link your Claude organization button +url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button +description: Add the button that sends a customer from your product to Claude's approval page to start Linked billing. +featureMetadata: + status: beta + betaHeader: user-profiles-billing-2026-10-01 + supportedModels: + - claude-fable-5-2 + - claude-mythos-5-2 + - claude-fable-5-1 + - claude-mythos-5-1 + - claude-fable-5 + - claude-mythos-5 + - claude-mythos-preview + - claude-opus-5-5 + - claude-opus-5 + - claude-sonnet-5-5 + - claude-sonnet-5 + - claude-haiku-5-5 + - claude-haiku-4-5-20251001 + - claude-opus-4-8 + - claude-opus-4-7 + - claude-opus-4-6 + - claude-sonnet-4-6 + - claude-opus-4-5-20251101 + - claude-sonnet-4-5-20250929 + supportedPlatforms: + Claude API: + availability: beta + note: Only requests that send `billing_policy` need the beta header. +--- + + + Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use. + + +This page lists the HTML, CSS, colors, sizes, and logo of the **Link your Claude organization** button for [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing). + + + ![Link your Claude organization button, light and dark, with the Claude logo before its words](https://platform.claude.com/docs/images/claude-link-button.svg) + + +## HTML and CSS + +The only parts of the button’s look that you may change are its size and whether you use the light or the dark button. The font, the colors, and the logo’s size compared with the words stay as [Colors and sizes](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button#colors) shows them. + +The button’s CSS and HTML fit into your page like this: + +* **CSS:** The ` + ``` + + + + ```html link-your-claude-organization.html + + + Link your Claude organization + + ``` + + +If your route needs a form submission, such as a `POST`, use a `