Insight Management

Submit an annotation

The annotation can be submitted as an anonymous user or as a registered user. If the user is anonymous, the annotation will be accounted as a vote, and several identical anonymous votes are required to apply the insight. If the vote is sent from a registered user, it is applied directly.

To send the annotation as a registered user, send Open Food Facts credentials to the API using Basic Authentication: add a Authorization: basic {ENCODED_BASE64} header where {ENCODED_BASE64} is an base64-encoded string of user:password. Don't provide an authentication header for anonymous users.

The annotation is an integer that can take 4 values: 0, 1, 2, -1. 0 means the insight is incorrect (so it won't be applied), 1 means it is correct (so it will be applied) and -1 means the insight won't be returned to the user (skip). 2 is used when user submit some data to the annotate endpoint (for example in some cases of category annotation or ingredients spellcheck).

We use the voting mecanism system to remember which insight to skip for a user (authenticated or not).

post/insights/annotate

Request

  • Base URL
    https://robotoff.openfoodfacts.org/api/v1
  • URL
    https://robotoff.openfoodfacts.org/api/v1/insights/annotate
  • Auth
    • HTTP basic
    • or none

Request body application/x-www-form-urlencoded

insight_idstring uuid required

ID of the insight

annotation0 | 1 | -1 | 2 required

Annotation of the prediction: 1 to accept the prediction, 0 to refuse it, and -1 for skip, 2 to accept and add data

update0 | 1

Send the update to Openfoodfacts if update=1, don't send the update otherwise. This parameter is useful if the update is performed client-side

dataobject nullable

Additional data provided by the user as key-value pairs (required when annotation=2)

device_idstring

Device identifier for tracking anonymous votes

Example request

{
  "insight_id": "3cd5aecd-edcc-4237-87d0-6595fc4e53c9"
}

Response

Annotation successfully processed

status_codeinteger

Status code of the annotation result

statusstring

Status name of the annotation result

descriptionstring

Description of the annotation result

Changes

No recorded changes to this operation across all 4 revisions of this API.