Callback Format

The response object is part of the callback POST request and is permanently stored as part of the task object.

{
  "task_id": "5774cc78b01249ab09f089dd",
  "response": {
    "annotations": [
      // Example: feature type `block` with geometry `box`. 
      {
        "uuid": "bacb580c-20f8-457d-863c-9a240ef24910",
        "label": "barcode",
        "page": 0,
        "location": {
          "type": "box",
          "top": 80,
          "left": 120,
          "width": 40,
          "height": 24,
        },
      },

      // Example: feature type `text` with geometry `polygon`.
      {
        "uuid": "bacb580c-20f8-457d-863c-9a240ef24910",
        "label": "merchantName",
        "page": 0,
        "location": {
          "type": "polygon",
          "vertices": [
            { "x": 100, "y": 80 },
            { "x": 160, "y": 80 },
            { "x": 160, "y": 104 },
            { "x": 100, "y": 104},
          ],
        },
        "text": "Liren’s Diner",
      },

      // Example: linked table header and table value.
      {
        "uuid": "ef673c64-a3f7-4dd8-b931-8ed699337cd7",
        "label": "item.price.key",
        "page": 0,
        "location": {
          "type": "box",
          "top": 160,
          "left": 420,
          "width": 64,
          "height": 24,
        },
        "text": "Cost (per)",
        "refs": [
          "0e7ad2f5-d0cb-4005-baef-444b374e3040",
        ],
      },
      {
        "uuid": "0e7ad2f5-d0cb-4005-baef-444b374e3040",
        "label": "item.price.value",
        "page": 0,
        "location": {
          "type": "box",
          "top": 188,
          "left": 420,
          "width": 42,
          "height": 24,
        },
        "text": "16.50",
        "refs": [
          "ef673c64-a3f7-4dd8-b931-8ed699337cd7",
        ],
      },
    ],
    "values": [
      {
        "field_id": "flash",
        "selected": ["na"],
      },
    ],
  },
    
  "document_pages": [
    {
      "width": 600,
      "height": 1200,
      "url": "https://api.scale.com/v1/task/5774cc78b01249ab09f089dd/..."
    },
  ],
  // additional fields
}
FieldTypeDescription
responseobjectA Document Transcription Response. See below.
document_pagesobject arrayA list of Document Page objects. See the Task Document Pages section.

Document Transcription Response

FieldTypeDescription
annotationsobject arrayList of DocumentTranscriptionAnnotation objects.
valuesobject arrayList of DocumentTranscriptionValue objects.

Document Transcription Annotation

FieldTypeDescription
uuidstringUnique identifier of the annotation
pagenumberThe page number. References PageDimensions by array index. Either the index of the attachment in the attachments array or the constant value 0 for a single attachment provided in the task parameters
labelstringThis field references the label specified in DocumentTranscriptionFeature
locationobjectThe location of the annotation in the attachment. See the Box or Polygon definitions below.
text (optional)stringText transcribed from the attachment. Only for text features.
refsstring arrayThis field references other annotations by uuid for related data that does not physically overlap.
date (optional)objectThe parsed date. Only for features with the date content flag. See the DateComponents definition below
checked (optional)booleanIf the checkbox is checked. Only for features with the checkbox content flag. Returns a boolean true or false value.
selected (optional)string arrayThe selected values from available options in FeatureSelectParams.
obfuscated (optional)booleanIf the annotation was redacted or replaced with synthetic information.

Box

If the task specifies box geometry then all annotations in the response will have Box locations.

FieldTypeDescription
typeconstantbox
leftnumberThe distance in pixels from the left edge of the attachment
topnumberThe distance in pixels from the top edge of the attachment
widthnumberThe width in pixels of the annotation
heightnumberThe height in pixels of the annotation

Polygon

If the task specifies polygon geometry then all annotations in the response will have Polygon locations. A Polygon is a quadrilateral with exactly four vertices, no holes, auto-closes, edges are perpendicular, and the points are arranged in clockwise order.

FieldTypeDescription
typeconstantpolygon
verticesobject arrayAn array of Point objects. See the Point definition below

Order of polygon vertices in compass directions.

NorthWest, NorthEast, SouthEast, SouthWest

Order of polygon vertices in box directions.

TopLeft, TopRight, BottomRight, BottomLeft

Point

Points are two-dimensional with percent values.

FieldTypeDescription
xnumberThe distance in pixels from the left edge of the attachment
ynumberThe distance in pixels from the top edge of the attachment

Document Transcription Value

FieldTypeDescription
field_idstringCorresponds to field_id in the Field definition.
selected (conditional)string arrayOnly for select fields. List of selected values. Corresponds to the value in the OptionType definition.

Date Components

FieldTypeDescription
yearstringThe year in YYYY format
monthstringThe month inMM format
daystringThe day in DD format

Example: Scale was founded on June 1st, 2016. In date components that would be the following object:

{ "year": "2016", "month": "06", "day": "01" }

📘

See the Callback section for more details about callbacks.