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",
        ],
      },
      
      // Example: feature type with content flag `date`.
      {
        "uuid": "d90f584a-fe8b-4f0f-a60b-e7e6d563c9b1",
        "label": "Bill Due At",
        "page": 0,
        "location": {
          "type": "box",
          "top": 1162,
          "left": 564,
          "width": 122,
          "height": 54,
        },
        "text": "03/05/2020",
        "date": {
          "year": "2020",
          "month": "03",
          "day": "05",
        },
        "refs": [],
      },
      
      // Example: feature type with content flag `money`.
      {
        "uuid": "e74114fd-c1f1-47cd-8cf9-ab6cc4524208",
        "label": "Total Amount",
        "page": 0,
        "location": {
          "type": "box",
          "top": 251,
          "left": 343,
          "width": 74,
          "height": 32,
        },
        "text": "$53.50",
        "money": {
          "amount": "53.50",
        },
        "refs": [],
      },
    ],
    "values": [
      {
        "field_id": "flash",
        "selected": ["na"],
      },
    ],
  },
    
  "document_pages": [
    {
      "width": 600,
      "height": 1200,
      "url": "https://api.scale.com/v1/task/5774cc78b01249ab09f089dd/..."
    },
  ],
  // additional fields
}

Field

Type

Description

response

object

A Document Transcription Response. See below.

document_pages

object array

A list of Document Page objects. See the Task Document Pages section.

Document Transcription Response

Field

Type

Description

annotations

object array

List of DocumentTranscriptionAnnotation objects.

values

object array

List of DocumentTranscriptionValue objects.

Document Transcription Annotation

Field

Type

Description

uuid

string

Unique identifier of the annotation

page

number

The 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

label

string

This field references the label specified in DocumentTranscriptionFeature

location

object

The location of the annotation in the attachment. See the Box or Polygon definitions below.

text (optional)

string

Text transcribed from the attachment. Only for text features.

refs

string array

This field references other annotations by uuid for related data that does not physically overlap.

date (optional)

object

The parsed date. Only for features with the date content flag. See the DateComponents definition below.

money (optional)

object

The parsed money amount. Only for features with the money content flag. See the MoneyComponents definition below.

checked (optional)

boolean

If the checkbox is checked. Only for features with the checkbox content flag. Returns a boolean true or false value.

selected (optional)

string array

The selected values from available options in FeatureSelectParams.

obfuscated (optional)

boolean

If 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.

Field

Type

Description

type

constant

box

left

number

The distance in pixels from the left edge of the attachment

top

number

The distance in pixels from the top edge of the attachment

width

number

The width in pixels of the annotation

height

number

The 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.

Field

Type

Description

type

constant

polygon

vertices

object array

An 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.

Field

Type

Description

x

number

The distance in pixels from the left edge of the attachment

y

number

The distance in pixels from the top edge of the attachment

Document Transcription Value

Field

Type

Description

field_id

string

Corresponds to field_id in the Field definition.

selected (conditional)

string array

Only for select fields. List of selected values. Corresponds to the value in the OptionType definition.

Date Components

Field

Type

Description

year

string

The year in YYYY format

month

string

The month inMM format

day

string

The 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" }

Money Components

Field

Type

Description

amount

string

The money amount containing only numbers with two decimal points.

📘

See the Callback section for more details about callbacks.