When given an integer as option_id, the API path /answers/{id}/flags/add raises the flag corresponding to option_id on a specific answer (same goes for its counterpart for questions). Are these option_ids guaranteed to refer to one specific flag for eternity?

For example, does the option_id 46534 always refer to the spam flag as defined in the documentation?


In general, no they are not guaranteed to be the same. And like badges, the id's are not consistent across sites.
The docs say as much:

The available flag_options on a answer are not constant, and must be fetched from /answers/{id}/flag/options.

And this:

An application should not assume that... particular option_ids are stable.

EXCEPT: It may be that the two most egregious flags (Spam and Rude/Abusive) ARE consistent. Also, the generic flags might be consistent for sites in English.

I picked 3 sites (Stack Overflow, Japanese Stack Overflow, and Sitecore). Choosing (A) the oldest site, (B) a non English site, (C) the newest site.
This kind of choice seems to produce the widest variation in badge ID's, and I posit that the same might be true for flag options.

Here are the results for question flags:

                                  ID in           ID in           ID in
Flag reason          Flag Class   Stack Overflow  Japanese SO     Sitecore SE
------------------   -----------  --------------  --------------  -----------
Spam                 Auto mdrtng      46534           46534           46534
Rude or Abusive      Auto mdrtng       7852            7852            7852
Duplicate            Specific        varies          varies          varies
Off-Topic            Specific        varies          varies          varies
Migration            Specific        varies          varies          varies
Unclear what asking  Generic          44684           16055           44684
Too broad            Generic           8175           29650            8175
Opinion-based        Generic           1529           62000            1529
Vey low quality      Generic          36772           36772           36772
Problem not listed‡  Generic          22992           34976           22992

‡ Value not constant, often shows as 34976 on English sites.

Based on that, I'd say it's safe to assume that the 2 "critical" flags will probably not change, but everything else is either only semi-fixed or completely fluid.

Also note that the spam and abuse flag ID's are the same for answer flags (That is: 46534 and 7852), but not comment flags.

  • do note this sentence in the api doc: The available flag_options on a answer are not constant, and must be fetched from /answers/{id}/flag/options. – rene Dec 17 '16 at 7:53
  • @rene yes, but that's probably just a CYA due to the unpredictability of the close-reason flags. In practice, I've yet to find a site that had different spam or abuse constants. ... I haven't checked as many non-close flags, but so far they only seem to differ on non-English sites. – Awesome Poodles Dec 17 '16 at 8:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .