Skip to main content

Sync Annotations

POST/v1/datasets/<dataset_owner>/<dataset_name>/sync-annotations
Permissions required: Review and label
curl -X POST 'https://<mydomain>.reinfer.io/v1/datasets/<dataset_owner>/<dataset_name>/sync-annotations' \
-H "Authorization: Bearer $REINFER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"annotations": [
{
"comment_uid": "<source_id>.<comment_id>",
"labels": {
"assigned": [
{
"external_id": "8d59822a-af84-4f5d-9dd4-6b0e8e76d3c5",
"name": "Some Parent"
},
{
"external_id": "298f5e0f-a52a-42b2-87b3-050ad3ed262b",
"name": "Some Parent > Some Child"
}
]
}
},
{
"comment_uid": "<source_id>.<comment_id>",
"labels": {
"assigned": [
{
"external_id": "8d59822a-af84-4f5d-9dd4-6b0e8e76d3c5"
},
{
"name": "Some Parent > Some Child"
}
]
}
}
]
}'

Allows for programatically applying label annotations via the API. A comment's uid uniquely identifies it within a source. For each comment being annotated, at least one of external_id and name should be provided:

  • Where only a name is provided, a label annotation with that name will be applied to the comment.
  • Where only an external_id is provided, the label to annotate will be looked up within the existing taxonomy. If no label already exists with the same external_id an error response will be returned.
  • Where both an external_id and name are provided, the label to annotate will be looked up within the existing taxonomy. If there is no existing label with the same external_id and name an error will be returned.
nametyperequireddescription
comment_uidstringyesThe uid of the comment that should be annotated.
external_idstringnoThe external_id of the existing label definition to annotate.
namestringnoThe name of the label to annotate.