---
name: feedback-zenodo-api-user-agent-required
description: "2026-07-26 判明 — Zenodo API (`zenodo.org/api/deposit/depositions`) は User-Agent header 未設定の Node.js デフォルト UA (`node/x.y.z`) を bot 判定して 403 Forbidden \"unusual traffic from your network\" を返す (web UI は影響なし、 API 経路のみ)。 修正 = polite convention の `User-Agent: rei-aios-publisher/1.0 (+https://github.com/fc0web/rei-aios; mailto:fc2webb@gmail.com)` 追加で即解決。 新規 publish script 作成時 (Zenodo 系) は `req()` 関数 内 headers に User-Agent 追加を必須テンプレート化。 2026-07-26 に既存 47/53 zenodo publish script に prophylactic 適用済 (残 6 = 2 non-zenodo + 4 paper-144/153/154/155 variant multi-line signature、 別 session で fix 予定)。"
metadata: 
  node_type: memory
  type: feedback
  originSessionId: d0523f45-e31f-4a20-bce8-df75dfd35b7e
  modified: 2026-07-25T20:38:57.019Z
---

Rule: Zenodo API (と類似 API) を叩く publish script は必ず polite User-Agent header を設定すること。 具体的には:

```typescript
function req(url, method, headers, body?, to = 180000) {
  const finalHeaders = {
    'User-Agent': 'rei-aios-publisher/1.0 (+https://github.com/fc0web/rei-aios; mailto:fc2webb@gmail.com)',
    'Accept': 'application/json',
    ...headers,
  };
  return new Promise(...)
}
```

**Why**: 2026-07-26 に Zenodo API が 403 Forbidden "Access to this resource has been restricted due to unusual traffic from your network" を返す事象が発生。 判明した診断結果:
- Web UI (login + dashboard + upload UI) は完全正常 = IP block ではない
- API 経路のみ block = **bot / User-Agent 検出**
- Node.js `https.request` の default UA は `node/x.y.z` = Cloudflare/WAF の bot filter に引っかかる
- Token 変更でも解決せず (別 ref ID で同じ 403 継続) = **token / account 側原因 100% 除外**
- User-Agent header 追加 で即 3/3 step 全通過、 DOI 取得成功

**How to apply**:
- **新規 Zenodo publish script 作成時**: `req()` 関数 template に User-Agent header inject を必須 (上記コード)
- **既存 script 修正時**: `req()` 関数の headers 部分に `...headers` spread と併用で default UA を先出し
- **User-Agent の書式**: polite convention (RFC 7231 + 慣習) 準拠:
  - Product name + version: `rei-aios-publisher/1.0`
  - Contact URL (comment 括弧内): `(+https://github.com/fc0web/rei-aios; mailto:fc2webb@gmail.com)`
  - mailto は 障害時の contact 経路 (Zenodo support が Rei 側 identify 可能)
- **Also add `Accept: application/json`** — 一部 API で JSON 明示指定が必要

## 適用範囲

Zenodo 系 script 53 個中:
- **47 fixed** (prophylactic 2026-07-26): `publish-paper-026v2-zenodo.ts` + `publish-paper-026v2-v03-zenodo.ts` + 45 他 zenodo script (paper-33, 39, 40, 63v02, 103, 104, 133-171 系)
- **2 skip** (non-zenodo, 適用外): `publish-paper-100v2-non-zenodo.ts`, `publish-paper-107-non-zenodo.ts`
- **4 pending** (variant multi-line signature + `resolve/reject` naming): `publish-paper-144/153/154/155-zenodo.ts` — 別 session で fix (scratchpad batch script v3 で正規表現拡張、 現時点 defer)

## 類似 API への波及検討

同様の bot 検出 filter を持つ可能性がある API (未確認、 将来 403 発生時にこの feedback を想起する用):
- IA (Internet Archive) — 2026-07-26 では影響なし
- Harvard Dataverse — 2026-07-26 では影響なし
- Notion API — 2026-07-26 では影響なし
- Dev.to / HackMD / Hatena / Livedoor / Mastodon / Nostr — 2026-07-26 では影響なし

**予防原則**: 新規 API integration 時、 default UA でなく polite UA を最初から設定する `req()` template 使い回し推奨。

## 障害切り分けのチェックリスト (403 発生時)

1. **web UI 動作確認** — user が browser で対象サービスに login + dashboard access できるか? Yes なら token / account 側でなく API 側 filter
2. **token 変更試行** — 新 token 作成 + retry。 別 ref ID で同じ error なら token 側原因 100% 除外
3. **User-Agent header 追加** — polite UA + retry。 これで通れば bot 検出確定
4. **依然 fail の場合** — support 申請 / 別 network / support 経由 whitelist

## 関連 memory

- [[project-session-2026-07-26-paper26v2-v03-corrigendum-arc]] (2026-07-26 Zenodo 403 発生 → root cause 特定 → 47/53 fix の session)
- [[feedback-paper-publish-verification-discipline]] publish 後 verify 必須
- [[feedback-deploy-verify-http-200-plus-content-grep-required]] HTTP 200 + content grep
- [[feedback-publish-channels-11]] 11 platform stack
- [[feedback-publishing-rate-limit-platform-side-risk-2026-06-27]] platform 側 rate limit 注意
