Annotation

Search annotations

Search for annotations matching a complex filter.

<Callout type="info"> Please beware that updates of the annotation search data are done asynchronously and are eventually consistent. Search endpoint may return inconsistent results temporarily (for a few seconds). </Callout> <Callout type="info"> Please note that only objects of category `datapoint` are returned when sideloading for `content` is active. Objects of other categories are ignored. </Callout> <Callout type="info"> Sideloading content for this endpoint is deprecated and will be removed in the near future. </Callout>

Search Query

A subset of MongoDB Query Language. Query expressions should be defined as a list under a $and key. The following can be used:

  • <meta_field> - Matches against annotation attributes according to the <meta_field> - see options below.
  • field.<schema_id>.<type> - Matches against annotation content value according to <schema_id> treating it as a <type>. Possible types: string | number | date (in ISO 8601 format). Max. 256 characters long strings are allowed.

The meta_field can be one of:

Meta FieldType
annotationURL
arrived_atdate
assigned_atdate
assigneesURL
automatedbool
automatically_rejectedbool
confirmed_atdate
confirmed_by__usernamestring
confirmed_byURL
created_atdate
creator__usernamestring
creatorURL
deleted_atdate
deleted_by__usernamestring
deleted_byURL
documentURL
exported_atdate
exported_by__usernamestring
exported_byURL
has_email_thread_with_new_repliesbool
has_email_thread_with_repliesbool
has_notebool
has_suggested_editbool
labelsURL
messagesstring
modified_atdate
modifier__usernamestring
modifierURL
original_file_namestring
purged_atdate
purged_by__usernamestring
purged_byURL
queueURL
rejected_atdate
rejected_by__usernamestring
rejected_byURL
relations__keystring
relations__parentURL
relations__typestring
restricted_accessbool
rir_poll_idstring
statusstring
workspaceURL
email_threadURL
email_senderstring

Search Query Objects

KeyTypeDescription
$startsWithstringMatches the start of a value. Must be at least 2 characters long.
$anyTokenStartsWithstringMatches the start of each token within a string. Must be at least 2 characters long.
$containsPrefixesstringSame as $anyTokenStartsWith but query is split into tokens (words). Must be at least 2 characters long. Example query quick brown matches quick brown fox but also brown quick dog or quickiest brown fox, but not quick dog.
$emptyOrMissingboolMatches values that are empty or missing. When false, matches existing non-empty values.
$eq | $nenumber | string | date | URLDefault MQL behavior
$gt | $lt | $gte | $ltenumber | string | dateDefault MQL behavior
$in | $ninlist[number | string | URL]Default MQL behavior
post/api/v1/annotations/search

Query parameters

ordering'id' | '-id' | 'arrived_at' | '-arrived_at' | 'assigned_at' | '-assigned_at' | 'assignees' | '-assignees' | 'automated' | '-automated' | 'confirmed_at' | '-confirmed_at' | 'confirmed_by__username' | '-confirmed_by__username' | 'confirmed_by' | '-confirmed_by' | 'created_at' | '-created_at' | 'creator__username' | '-creator__username' | 'creator' | '-creator' | 'deleted_at' | '-deleted_at' | 'deleted_by__username' | '-deleted_by__username' | 'deleted_by' | '-deleted_by' | 'document' | '-document' | 'exported_at' | '-exported_at' | 'exported_by__username' | '-exported_by__username' | 'exported_by' | '-exported_by' | 'export_failed_at' | '-export_failed_at' | 'has_email_thread_with_new_replies' | '-has_email_thread_with_new_replies' | 'has_email_thread_with_replies' | '-has_email_thread_with_replies' | 'has_note' | '-has_note' | 'has_suggested_edit' | '-has_suggested_edit' | 'labels' | '-labels' | 'modified_at' | '-modified_at' | 'modifier__username' | '-modifier__username' | 'modifier' | '-modifier' | 'original_file_name' | '-original_file_name' | 'purged_at' | '-purged_at' | 'purged_by__username' | '-purged_by__username' | 'purged_by' | '-purged_by' | 'queue' | '-queue' | 'rejected_at' | '-rejected_at' | 'rejected_by__username' | '-rejected_by__username' | 'rejected_by' | '-rejected_by' | 'relations__key' | '-relations__key' | 'relations__parent' | '-relations__parent' | 'relations__type' | '-relations__type' | 'rir_poll_id' | '-rir_poll_id' | 'status' | '-status' | 'workspace' | '-workspace' | 'email_thread' | '-email_thread' | 'email_sender' | '-email_sender'

Result ordering. Note: field.<schema_id>.<format> is also supported (where format is one of number, date, string).

page_sizeinteger

Number of results per page. The maximum value is 500. For requests that sideload content, the maximum value is limited to 100. Sideloading content for this endpoint is deprecated and will be removed in the near future.

search_afterstring

Encoded value acting as a cursor (do not try to modify, only for internal purposes).

fieldsstring

Comma-separated list of attributes to be included in the response. See the Query Field Filtering section for detailed explanation and available options.

fields!string

Comma-separated list of attributes to be excluded from the response. See the Query Field Filtering section for detailed explanation and available options.

sideloadstring

Comma-separated list of related objects to sideload (e.g., modifiers,documents,content). See the Sideloading section for detailed explanation and available options.

content.schema_idstring

Filter sideloaded content by schema_id (comma-separated list).

Request body

Example request

{
  "query": {
    "$and": [
      {
        "field.vendor_name.string": {
          "$eq": "ACME corp"
        }
      },
      {
        "labels": {
          "$in": [
            "https://example.rossum.app/api/v1/labels/12",
            "https://example.rossum.app/api/v1/labels/34"
          ]
        }
      }
    ]
  },
  "query_string": {
    "string": "Large drink"
  }
}

Response

OK

Example response

{
  "pagination": {
    "total": 1,
    "total_pages": 1
  },
  "results": [
    {
      "id": 314528,
      "url": "https://example.rossum.app/api/v1/annotations/314159",
      "status": "to_review",
      "document": "https://example.rossum.app/api/v1/documents/456700",
      "queue": "https://example.rossum.app/api/v1/queues/8198",
      "schema": "https://example.rossum.app/api/v1/schemas/31336",
      "relations": [],
      "pages": [
        "https://example.rossum.app/api/v1/pages/558598"
      ],
      "creator": "https://example.rossum.app/api/v1/users/10775",
      "created_at": "2021-04-26T10:08:03.856648Z",
      "modified_by": "https://example.rossum.app/api/v1/users/10775",
      "modified_at": "2021-04-26T10:08:03.856648Z",
      "rir_poll_id": "54f6b9ecfa751789f71ddf12",
      "content": "https://example.rossum.app/api/v1/annotations/314159",
      "metadata": {
        "some_key": "some_value"
      },
      "related_emails": [],
      "email": "https://example.rossum.app/api/v1/emails/1234",
      "email_thread": "https://example.rossum.app/api/v1/email_threads/456",
      "has_email_thread_with_replies": true,
      "organization": "https://example.rossum.app/api/v1/organizations/406",
      "assignees": [
        "https://example.rossum.app/api/v1/users/1",
        "https://example.rossum.app/api/v1/users/2"
      ],
      "labels": [],
      "training_enabled": true
    }
  ]
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.