Skip to main content

Overview

At this time, Deck must manually configure jobs to fetch documents and extract data.
Deck supports the fetching of raw documents from sources (PDF, Excel, CSV, etc.) In some cases, data extraction from those documents is also possible.
Once your fetching job is completed, the webhook will return with information to help you take action on said documents.
Example of a successful webhook
{
  "job_guid": "b35aa2af-41e4-4833-95c9-9efd2069e70c",
  "output": {
     "success": true,
     "document_list_url": "https://live.deck.co/api/v1/jobs/b35aa2af-41e4-4833-95c9-9efd2069e70c/documents",
     "document_count": 12
  },
  "webhook_type": "Job",
  "webhook_code": "FetchBills",
  "environment": "Production"
}

Fetch a list of documents

You can get the list of all documents fetched during a session by calling the List documents endpoint.
curl --request GET \
  --url https://live.deck.co/api/v1/jobs/{jobGuid}/documents \
  --header 'x-deck-client-id: <api-key>' \
  --header 'x-deck-secret: <api-key>'
You will receive a response like this:
{
  "documents": [
    {
      "document_id": "<string>",
      "file_type": "<string>",
      "metadata": {},
      "file_name": "<string>",
      "file_size": 123,
      "fetch_date": "2023-11-07T05:31:56Z"
    }
  ]
}

Download documents

You can download the raw files fetched by a job by calling the Download a document endpoint. Note that you can only download one document at a time.
curl --request GET \
  --url https://live.deck.co/api/v1/jobs/documents/{documentId} \
  --header 'x-deck-client-id: <api-key>' \
  --header 'x-deck-secret: <api-key>'
The document will be automatically downloaded.

Data extraction from files

Extraction is currently limited to utility bills.
If your team has extraction enabled, jobs fetching documents will automatically parse the data and create a JSON file for every file found. Deck can easily turn this feature on or off for you. Once the extraction is complete, a DocumentExtractionSuccess webhook will be sent with a document_id and a document_extraction_id. Successful Document Extraction webhook:
{
  "webhook_type": "Document",
  "webhook_code": "DocumentExtractionSuccess",
  "environment": "Production",
  "job_guid": "65e038fd-3fdc-4f45-3029-08de33819524",
  "document_id": "15e038fd-3fdc-4f45-3029-08de33819525",
  "document_extraction_id": "65e038fd-3fdc-4f45-3029-08de33819524"
}
Failed Document Extraction webhook:
(Note how document_extraction_id is missing)
{
  "webhook_type": "Document",
  "webhook_code": "DocumentExtractionFailed",
  "environment": "Production",
  "job_guid": "65e038fd-3fdc-4f45-3029-08de33819524",
  "document_id": "15e038fd-3fdc-4f45-3029-08de33819525"
}
The document_id represents the original statement whereas the document_extraction_id denotes the extraction result of that document. Here are examples of extraction payloads:
{
  "company_name": "energylink",
  "account_number": "58291-44720",
  "billing_date": "2025-01-22",
  "next_billing_date": "2025-02-22",
  "billing_period": {
    "start_date": "2024-12-18",
    "end_date": "2025-01-20",
    "total_days": 33
  },
  "balance_forward": 32.74,
  "previous_payments": 6892.44,
  "previous_amount_due": 6925.18,
  "new_charges": 8214.67,
  "amount_due": 8247.41,
  "payment_due_date": "2025-02-14",
  "auto_pay_date": "2025-02-07",
  "currency": "USD",
  "billing_address": {
    "name": "HARBORVIEW PROPERTIES LLP",
    "street": "217 MAPLE RIDGE AVE",
    "city": "BOSTON",
    "state": "MA",
    "postal_code": "02123-5521"
  },
  "service_locations": [
    {
      "service_type": "Fuel",
      "service_address": {
        "street": "4421 OAK VIEW LN UNIT 3A",
        "city": "CAMBRIDGE",
        "state": "MA",
        "postal_code": "02140"
      },
      "total_usage": 5348,
      "total_usage_unit": "Therms",
      "service_plan": "SC5 - Commercial Heating",
      "total_charges": 8214.67,
      "meters": [
        {
          "meter_number": "89314472",
          "usage_unit": "Therms",
          "reading_cycle": "14",
          "meter_reading": {
            "start_date": "2024-12-18",
            "end_date": "2025-01-20",
            "total_days": 33,
            "start_value": 38412,
            "end_value": 43716,
            "delta": 5304,
            "multiplier_conversion": 1.00829,
            "reading_type": "actual",
            "usage": 5348,
            "additional_data": [
              {
                "key": "Measured CCF",
                "value": "5304"
              },
              {
                "key": "Therm Factor",
                "value": "1.00829"
              }
            ]
          },
          "demand_meter_reading": {}
        }
      ],
      "charges": [
        {
          "group": "Delivery Services",
          "details": "Basic Service Charge (including first 3.3 therms)",
          "amount": 48.32
        },
        {
          "group": "Delivery Services",
          "details": "Next 1022.4 Therms",
          "amount": 678.11,
          "usage_unit": "therms",
          "usage": 1022.4,
          "usage_unit_rate": 0.663
        },
        {
          "group": "Delivery Services",
          "details": "Over/Last 4325 Therms",
          "amount": 2431.67,
          "usage_unit": "therms",
          "usage": 4325,
          "usage_unit_rate": 0.5623
        },
        {
          "group": "Delivery Services",
          "details": "delivery_rate_adj",
          "amount": 82.46,
          "usage_unit": "therms",
          "usage": 5348,
          "usage_unit_rate": 0.01542
        },
        {
          "group": "Delivery Services",
          "details": "billing_charge",
          "amount": 1.12
        },
        {
          "group": "Delivery Services",
          "details": "state_local_surcharges",
          "amount": 152.94
        },
        {
          "group": "Delivery Services",
          "details": "state_sales_tax_4_5_pct",
          "amount": 158.23
        },
        {
          "group": "Supply Services",
          "details": "gas_supply",
          "amount": 3497.28,
          "usage_unit": "therms",
          "usage": 5348,
          "usage_unit_rate": 0.65399
        },
        {
          "group": "Supply Services",
          "details": "state_local_surcharges",
          "amount": 91.77
        },
        {
          "group": "Supply Services",
          "details": "state_sales_tax_4_5_pct",
          "amount": 172.45
        }
      ]
    }
  ],
  "payments": [
    {
      "amount": 6892.44,
      "date": "2025-01-08",
      "details": "Payment Received on JAN 8 (Direct Deposit)"
    }
  ]
}

Extraction Data Dictionary

Top-level fields

Field nameTypeDescriptionExample
company_namestringName of the utility provider.”energylink”
account_numberstringUnique identifier for the account.”58291-44720”
billing_datestringDate the bill was sent.”2025-01-22”
next_billing_datestringDate the next bill is stated to be sent.”2025-02-22”
billing_periodobjectObject containing details about the billing period.
balance_forwardnumberBalance carried over from the previous billing period minus any payments or credits. This may have to be calculated based on previous balance plus payments made.When there is a previous balance and a payment but no balance forward provided, then it should be inferred on the basis of what was previously owed and what was paid. For example, if the previous balance was 52.96 and there is a payment of 52.96 (sometimes listed as a credit - CR), then the balance forward is 0, not 52.96.32.74
previous_paymentsnumberAmount paid for last billing.6892.44
previous_amount_duenumberAmount due at the time of last billing.6925.18
new_chargesnumberNew charges for the current billing period.8214.67
amount_duenumberAmount due for the current billing period.8247.41
payment_due_datestringDue date for the payment of this statement.”2025-02-14”
auto_pay_datestringDate on which automatic payment is set to trigger.”2025-02-07”
currencystringCurrency used in the statement. (Enum: “USD”, “CAD”, “EUR”, “GBP”, “MXN”, “JPY”, “AUD”, “CNY”, “KRW”, “THB”, “INR”, “BRL”, “CHF”, “RUB”, “SGD”, “HKD”, “SEK”, “NZD”, “ZAR”, “AED”)“USD”
billing_addressobjectObject containing details about the billing address.
service_locationsarrayArray containing details about the service locations.
paymentsarrayArray containing details about the payments.

billing_period object

Field nameTypeDescriptionExample
start_datestringStart date of the billing period.”2024-12-18”
end_datestringEnd date of the billing period.”2025-01-20”
total_daysnumberTotal number of days elapsed during the billing period.33

billing_address object

Field nameTypeDescriptionExample
namestringName of the paying entity.”HARBORVIEW PROPERTIES LLP”
streetstringStreet number of the paying entity.”217 MAPLE RIDGE AVE”
citystringCity of the paying entity.”BOSTON”
statestringAbbreviation of the state or province of the paying entity.”MA”
postal_codestringPostal code of the paying entity.”02123-5521”

service_locations array

Field nameTypeDescriptionExample
service_typestringType of service.”Fuel”
service_addressobjectObject containing details about the service location.
total_usagenumberTotal usage of all meters for this service location.5348
total_usage_unitstringTotal usage units of all meters for this service location.”Therms”
service_planstringName of the service plan.”SC5 - Commercial Heating”
total_chargesnumberTotal dollar amount of all charges for this service location.8214.67
metersarrayArray containing details about the meters of the service location.
chargesarrayArray containing details about the charges for the service location.

service_address object

Field nameTypeDescriptionExample
streetstringStreet number of the location using the service.”4421 OAK VIEW LN UNIT 3A”
citystringCity of the location using the service.”CAMBRIDGE”
statestringAbbreviation of the state or province of the location using the service.”MA”
postal_codestringPostal code of the location using the service.”02140”

meters array

Field nameTypeDescriptionExample
meter_numberstringNumber for the meter, as registered on the statement.”89314472”
usage_unitstringUnit of measure for the utility used.”Therms”
reading_cyclestringRecurring timeframe during which the utility company reads the meter to measure consumption.”14”
meter_readingobjectObject containing details about the meter readings.
demand_meter_readingobjectObject containing details about the peak rate of the meter.

meter_reading object

Field nameTypeDescriptionExample
start_datestringThe start date of the date range for the meter reading.”2024-12-18”
end_datestringThe end date of the date range for the meter reading.”2025-01-20”
total_daysnumberTotal number of days elapsed during the billing period.33
start_valuenumberThe value of the meter at the start of the date range.38412
end_valuenumberThe value of the meter at the end of the date range.43716
deltanumberThe difference between the end_value and the start_value.5304
multiplier_conversionnumberThis adjusts the raw reading from the meter to account for larger consumption units.1.00829
reading_typestringThe type of reading for the meter (actual, estimate or null).“actual”
usagenumberTotal utility used for this meter reading. This is an amount based on the units of utility, not a dollar amount.5348
additional_dataarrayArray of additional data related to the location.

additional_data array

Field nameTypeDescriptionExample
keystringKey of the additional data.”Measured CCF”
valuestringValue of the additional data.”5304”

charges array

Field nameTypeDescriptionExample
groupstringCategory of the charge.”Delivery Services”
detailsstringDetails about the charge.”delivery_rate_adj”
amountnumberSpecific dollar amount for the indicated line item.82.46
usage_unitstringUnit of measure for the utility used.”therms”
usagenumberThis is an amount based on the units of utility, not a dollar amount.5348
usage_unit_ratenumberAn amount in dollars indicating the price of how much each usage unit costs. Normally, the total utility used for this meter reading is multiplied by this rate for calculating the total consumption billed for the meter reading.0.01542

payments array

Field nameTypeDescriptionExample
amountnumberAmount paid.6892.44
datestringDate of payment.”2025-01-08”
detailsstringDescription of payment.”Payment Received on JAN 8 (Direct Deposit)”