Announcing an API Deprecation
废弃接口的公告怎么写才不炸锅
读完你能写出一份不炸锅的接口废弃公告:日期放最前并刻意重复一次、理由讲技术不讲商业、把迁移工作量量化成『大多数人一天搞定』、按 90/30/7 天分级提醒并附上对方自己的调用量,以及主动给出有范围限定的延期。文末还有一份语气清单:别用被动语态推诿,别在别人的活前面加『只需』。
当前浏览器暂不支持语音朗读
Retiring a public API is less an engineering task than a diplomatic one. Somewhere out there, a team you have never met has built their revenue on the endpoint you are about to switch off. The announcement you write decides whether they migrate quietly or escalate to your CEO. The rule is blunt: give them dates, give them a path, and never let them discover the change from a failing build on a Monday morning.
"Subject: Deprecating the v1 Search API — sunset on 1 March 2027. We are deprecating the v1 Search API. It will keep working, unchanged and fully supported, until 1 March 2027, twelve months from today. After that date, requests to /v1/search will return a 410 and will no longer be served. The replacement, v2, is available now and is documented at the link below."
Lead with the date, not the reasoning. A developer skimming this needs one fact before anything else: when does my code break? Notice the deliberate redundancy — the sunset date appears in the subject line and again in the first sentence, because half your readers will only ever see one of the two. Twelve months is generous; anything shorter than a quarter reads as a decision made without you in the room.
"Why we are doing this: v1 cannot express filters across multiple indexes, and every workaround we ship makes the next one harder. v2 replaces it with a single query grammar. Most integrations migrate in under a day. The mapping between old and new parameters is documented endpoint by endpoint, and our migration guide covers the three cases that are not a straight swap."
The rationale belongs here, after the facts, and it should be honest without being self-flagellating. Notice that the reason given is technical rather than commercial: nobody resents a limit they can verify, but everyone resents being moved so that you can upsell them. Then quantify the effort. "Most integrations migrate in under a day" converts a vague dread into a task someone can schedule, and it is the single sentence most likely to defuse an angry reply.
"What we will do for you: we will email every account still calling v1 at ninety, thirty, and seven days before the sunset, with the exact call volumes we see from your keys. We are running two open office hours in September for anyone who wants help. If the deadline is genuinely unworkable for you, reply to this thread — we would rather grant a scoped extension than break you silently."
This paragraph is the one that keeps the announcement out of an angry forum thread. Reminders tied to a customer's own traffic tell them you know exactly who is affected, which is far more reassuring than a broadcast. The offer of an extension costs you little — few teams take it — and it converts the loudest objection into a private conversation. Just never promise an extension you will not honour; a deadline you roll back is worse than a firm one.
A final note on tone. Avoid the passive voice that developers read as evasion: "the endpoint will be retired" hides the fact that a team chose to do it. Say we. Avoid softening words like minor or simply in front of work you are not doing yourself. And publish the notice in every channel your users actually read — changelog, dashboard banner, email — because a deprecation nobody saw is an outage with a nicer name.