Documents

Upload bills and statements, read what was extracted and file them into companies.


Upload a bill or a statement, read what AutoTally extracted, and file it into a company. Use a key with writes allowed for uploads and changes. Here company takes a GUID, not a name. For conventions, read the API overview.

Library

List documents

GET /v1/documents

Returns documents newest first. Filters combine with AND. Follow nextCursor for the next page. It is absent on the last page. Rows carry no file links: use GET /v1/documents/{id} for those.

Parameters

Name In Type Required Description
company Query string No Company GUID. Cannot be combined with filed=none.
filed Query string No none selects documents with no filing. One of: none.
kind Query string No Only this kind of document. One of: purchase-invoice, sales-invoice, bank-statement, receipt, other, bill-of-supply, proforma-invoice, purchase-order, delivery-challan, quotation, unknown.
channel Query string No Only documents that arrived this way. One of: chat, email, whatsapp, telegram, slack.
from Query string No Earliest received date. This is when it reached AutoTally, not the date printed on it.
to Query string No Latest received date.
q Query string No Text to find in the supplier, document number or file name.
cursor Query string No The nextCursor from the previous page.
limit Query integer No Rows per page, up to 100. Default 50.

Response fields

Field Type Description
documents[] array of object Documents.
documents[].documentId UUID Document ID.
documents[].companies[] array of string Every company it is filed into. Empty when unfiled.
documents[].entryCount integer Entries made from this document.
documents[].kind string One of: purchase-invoice, sales-invoice, bank-statement, receipt, other, bill-of-supply, proforma-invoice, purchase-order, delivery-challan, quotation, unknown.
documents[].title string Document number, when one was read.
documents[].supplier string Who issued it, as read. Null if nothing was read.
documents[].documentDate string The date printed on the document. Null if none was found.
documents[].mime string MIME type.
documents[].sizeBytes integer Size bytes.
documents[].sourceChannel string One of: chat, email, whatsapp, telegram, slack.
documents[].state string One of: received, extracting, extracted, failed, proposed, deleted.
documents[].createdAt date-time When it reached AutoTally.
documents[].bundleId UUID The approval bundle proposed from it, if any.
documents[].postingState string What became of that bundle. One of: pending, approved, applied, rejected, failed.
documents[].hasThumb boolean true if a thumbnail exists.
nextCursor string Pass this as cursor. Absent on the last page.

Status codes

Status Error Meaning
200 Success.
400 bad_request An unknown kind, channel or filed, company with filed=none, or a malformed cursor.
401 unauthorized The key is missing, invalid or revoked.

Example request

curl -sG "https://relay.autotally.ai/v1/documents" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  --data-urlencode "limit=50" \
  --data-urlencode "kind=purchase-invoice"

Upload a document

POST /v1/documents

Stores a document and reads it. With company, it is filed into that company. Without it, it is stored unfiled and supplier matching waits until you file it. Uploading the same bytes again returns the existing document with duplicate: true. Use a key with writes allowed for uploads and changes.

Body fields

Send as multipart/form-data.

Field Type Required Description
file string Yes The document.
company string No Company GUID to file it into. Optional.
channel string No How it arrived. Default chat. One of: chat, email, whatsapp, telegram, slack.

Response fields

Field Type Description
documentId UUID Document ID.
state string One of: received, extracting, extracted, failed, proposed, deleted.
extraction object What was read from it.
extraction.kind string Kind of document, as read.
extraction.fields object The fields read, by name.
extraction.fields.<field>.value any String or number. Null means the document does not print it.
extraction.fields.<field>.confidence number Confidence from 0 to 1.
extraction.fields.<field>.method string How the value was obtained. disputed means two readers disagree: show both. One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.fields.<field>.alternative object The other reading. Present when method is disputed.
extraction.fields.<field>.alternative.value any Value.
extraction.fields.<field>.alternative.confidence number Confidence of the other reading.
extraction.fields.<field>.alternative.method string One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.pages integer Page count.
extraction.lineItems[] array of object Line items, as read.
extraction.lineItems[].description string Description.
extraction.lineItems[].quantity number Quantity.
extraction.lineItems[].rate number Rate.
extraction.lineItems[].amount number Amount.
extraction.lineItems[].hsn string HSN or SAC code.
extraction.guards[] array of object Checks the reading failed.
extraction.guards[].code string One of: gstin-invalid, tax-arithmetic, line-item-arithmetic, required-field-missing.
extraction.guards[].field string Field.
extraction.guards[].message string Message.
errorMessage string Why reading failed, if it did.
bundleId UUID The approval bundle proposed from it, if any.
duplicate boolean true if these exact bytes were already on file. documentId then names the existing document.
deepRead object Whether a second read is worth buying.
deepRead.available boolean true if a second read is on offer.
deepRead.credits integer Estimated credits. Absent when not available.
deepRead.reasons[] array of string Why it is offered.
deepRead.alreadyRead boolean true once paid for. Asking again charges nothing.

Status codes

Status Error Meaning
201 Stored and read.
400 bad_request No file part, or an unknown channel.
401 unauthorized The key is missing, invalid or revoked.
402 insufficient_credits The workspace has no credits for reading.
413 payload_too_large The file is over the size limit.
413 quota_exceeded The workspace is out of document storage.
415 unsupported_media_type The body is not multipart/form-data.
502 Stored, but reading failed. The body has state: failed.

Example request

curl -s -X POST "https://relay.autotally.ai/v1/documents" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  -F "file=@bill.pdf" \
  -F "company=9f3a1c52-7b1e-4d60-a2f4-6c1e8d0b7a11"

Example response

{
  "documentId": "7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381",
  "state": "extracted",
  "bundleId": null
}

Get a document

GET /v1/documents/{id}

Returns a document's details and what was extracted, with a link to open it that lasts 60 seconds.

Parameters

Name In Type Required Description
id Path string Yes The documentId.

Response fields

Field Type Description
documentId UUID Document ID.
companies[] array of string Every company it is filed into. Empty when unfiled.
kind string One of: purchase-invoice, sales-invoice, bank-statement, receipt, other, bill-of-supply, proforma-invoice, purchase-order, delivery-challan, quotation, unknown.
title string Document number, when one was read.
mime string MIME type.
sizeBytes integer Size bytes.
sourceChannel string One of: chat, email, whatsapp, telegram, slack.
state string One of: received, extracting, extracted, failed, proposed, deleted.
createdAt date-time Created at.
extraction object What was read from it.
extraction.kind string Kind of document, as read.
extraction.fields object The fields read, by name.
extraction.fields.<field>.value any String or number. Null means the document does not print it.
extraction.fields.<field>.confidence number Confidence from 0 to 1.
extraction.fields.<field>.method string How the value was obtained. disputed means two readers disagree: show both. One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.fields.<field>.alternative object The other reading. Present when method is disputed.
extraction.fields.<field>.alternative.value any Value.
extraction.fields.<field>.alternative.confidence number Confidence of the other reading.
extraction.fields.<field>.alternative.method string One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.pages integer Page count.
extraction.lineItems[] array of object Line items, as read.
extraction.lineItems[].description string Description.
extraction.lineItems[].quantity number Quantity.
extraction.lineItems[].rate number Rate.
extraction.lineItems[].amount number Amount.
extraction.lineItems[].hsn string HSN or SAC code.
extraction.guards[] array of object Checks the reading failed.
extraction.guards[].code string One of: gstin-invalid, tax-arithmetic, line-item-arithmetic, required-field-missing.
extraction.guards[].field string Field.
extraction.guards[].message string Message.
bundleId UUID The approval bundle proposed from it, if any.
url string A link to the file, valid for urlExpiresInSeconds.
urlExpiresInSeconds integer How long url lasts.
deepRead object Whether a second read is worth buying.
deepRead.available boolean true if a second read is on offer.
deepRead.credits integer Estimated credits. Absent when not available.
deepRead.reasons[] array of string Why it is offered.
deepRead.alreadyRead boolean true once paid for. Asking again charges nothing.

Status codes

Status Error Meaning
200 Success.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.

Example request

curl -s "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN"

Download a document

GET /v1/documents/{id}/content

Returns the stored bytes of an uploaded document, or of a generated one (an id from GET /v1/documents/generated). This route serves files up to 15 MB. For anything larger, use the url from GET /v1/documents/{id} or GET /v1/documents/generated/{id}.

Parameters

Name In Type Required Description
id Path UUID Yes The documentId.

The response is the file itself.

Status codes

Status Error Meaning
200 Success.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.
413 too_large The document is over 15 MB.

Example request

curl -s "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/content" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  -o bill.pdf

Get a thumbnail

GET /v1/documents/{id}/thumb

Redirects to a thumbnail image through a link that lasts 60 seconds.

Parameters

Name In Type Required Description
id Path string Yes The documentId.

The response is a redirect.

Status codes

Status Error Meaning
302 Redirect to the thumbnail.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No thumbnail, or no such document.

Example request

curl -s "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/thumb" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  -o thumb.png \
  -L

List generated documents

GET /v1/documents/generated

Returns the files generated in your workspace, newest first: reports and documents printed from your books. Filters combine with AND. Follow nextCursor for the next page. It is absent on the last page. Rows carry no file links: use GET /v1/documents/generated/{id} for those.

Parameters

Name In Type Required Description
company Query string No Company GUID.
q Query string No Text to find in the title.
cursor Query string No The nextCursor from the previous page.
limit Query integer No Rows per page, up to 100. Default 50.

Response fields

Field Type Description
documents[] array of object Documents.
documents[].id UUID ID.
documents[].kind string What produced it: render is a report, script is a file an analysis wrote, book is a document printed from the books, such as an invoice. One of: render, script, book.
documents[].format string One of: xlsx, pdf, docx, png, md.
documents[].title string Title.
documents[].bytes integer Bytes.
documents[].companyGuid string Company GUID, from GET /v1/companies. Required to commit.
documents[].createdAt date-time Created at.
documents[].threadId string The chat thread it was generated in.
documents[].hasThumb boolean Whether a page-one preview exists. A boolean.
nextCursor string Next cursor.

Status codes

Status Error Meaning
200 Success.
400 bad_request A malformed cursor.
401 unauthorized The key is missing, invalid or revoked.

Example request

curl -sG "https://relay.autotally.ai/v1/documents/generated" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  --data-urlencode "limit=50"

Get a generated document

GET /v1/documents/generated/{id}

Returns a fresh link to a report a member of your workspace generated. A key can read these, not create them.

Parameters

Name In Type Required Description
id Path string Yes The generated document's id.

Response fields

Field Type Description
id UUID ID.
format string File format. One of: xlsx, pdf, docx, png, md.
bytes integer Bytes.
title string Title.
url string A short-lived link to the file. Call this route again for a new one.
expiresAt date-time When url stops working.
kind string What produced it: a report, a script, or a document printed from the books. One of: render, script, book.
companyGuid string The company the document belongs to.

Status codes

Status Error Meaning
200 Success.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such generated document in this workspace.

Example request

curl -s "https://relay.autotally.ai/v1/documents/generated/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN"

Get a generated document's thumbnail

GET /v1/documents/generated/{id}/thumb

Redirects to a preview of the first page through a link that lasts 60 seconds.

Parameters

Name In Type Required Description
id Path string Yes The generated document's id.

The response is a redirect.

Status codes

Status Error Meaning
302 Redirect to the thumbnail.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No thumbnail, or no such generated document.

Example request

curl -s "https://relay.autotally.ai/v1/documents/generated/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/thumb" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  -o thumb.webp \
  -L

Text and statement rows

Read a document's text

GET /v1/documents/{id}/text

Returns the document's text, page by page. By default it returns a few pages from from, not the whole document.

Parameters

Name In Type Required Description
id Path string Yes The documentId.
from Query integer No First page, from 1. Default 1.
to Query integer No Last page, inclusive. Default two pages after from.

Response fields

Field Type Description
documentId string Document ID.
pageCount integer Pages of text stored. 0 means none.
pages[] array of object The pages you asked for.
pages[].pageNo integer Page number, from 1.
pages[].text string The page's text. An empty string is a real answer.

Status codes

Status Error Meaning
200 Success.
400 bad_request to is before from.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.

Example request

curl -sG "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/text" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  --data-urlencode "from=1" \
  --data-urlencode "to=3"

Read statement rows

GET /v1/documents/{id}/rows

Returns the transactions recorded for a statement, and whether they reconcile against the statement's running balance. Only post from a statement when mayPost is true.

Parameters

Name In Type Required Description
id Path string Yes The documentId.
from Query integer No First page whose rows to return, from 1.
to Query integer No Last page whose rows to return, inclusive.

Response fields

Field Type Description
documentId string Document ID.
totalRows integer Rows recorded for the whole document.
progress object Progress.
progress.pageCount integer Pages of text stored for this document.
progress.pagesRecorded[] array of integer Pages that have rows.
progress.pagesRemaining[] array of integer Pages that do not.
progress.nextPage integer The first page with no rows, or null when none remain.
reconciliation object Reconciliation.
reconciliation.status string Only reconciled is safe to post from. One of: reconciled, partial, broken, unverifiable.
reconciliation.rows integer Rows checked against.
reconciliation.verifiedRows integer With reconciled: rows whose amount was checked.
reconciliation.polarity string Which side raises the balance on this statement. One of: CR_INCREASES, DR_INCREASES.
reconciliation.opening number With reconciled: opening balance.
reconciliation.closing number With reconciled: closing balance.
reconciliation.checkedPairs integer With partial: pairs of rows that could be checked.
reconciliation.rowsWithoutBalance[] array of integer With partial: rows with no balance, so never checked.
reconciliation.breaks[] array of object With broken: where the running balance fails.
reconciliation.breaks[].pageNo integer Page number.
reconciliation.breaks[].rowNo integer Row number.
reconciliation.breaks[].date date Date.
reconciliation.breaks[].description string Row narration, cut to 80 characters.
reconciliation.breaks[].drcr string One of: DR, CR.
reconciliation.breaks[].amount number Amount.
reconciliation.breaks[].previousBalance number Previous balance.
reconciliation.breaks[].expectedBalance number Expected balance.
reconciliation.breaks[].actualBalance number Actual balance.
reconciliation.breaks[].delta number Actual minus expected balance.
reconciliation.reason string With unverifiable: why there was nothing to check.
mayPost boolean true only when reconciliation.status is reconciled.
refusal string Why not, naming the page and row. Empty when mayPost is true.
rows[] array of object Rows.
rows[].rowNo integer Position within the page, from 1. Omit to use the array order.
rows[].date date Value date, YYYY-MM-DD.
rows[].description string The narration as printed. Use an empty string if none.
rows[].drcr string The statement's own Dr or Cr marker, copied as printed. One of: DR, CR.
rows[].amount number Positive, with no grouping. drcr carries the direction.
rows[].balance number The balance printed after this row, signed. Negative when overdrawn. Without balances the rows cannot be checked.
rows[].pageNo integer Page number.

Status codes

Status Error Meaning
200 Success.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.

Example request

curl -s "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/rows" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN"

Record statement rows

PUT /v1/documents/{id}/rows

Records the transactions on one page of a statement and returns how the whole document now reconciles. Use a key with writes allowed for uploads and changes.

Parameters

Name In Type Required Description
id Path string Yes The documentId.

Body fields

Field Type Required Description
pageNo integer Yes Which page of the document these rows are printed on.
rows[] array of object Yes Every transaction on this page, in the order the page prints them.
rows[].rowNo integer No Position within the page, from 1. Omit to use the array order.
rows[].date date Yes Value date, YYYY-MM-DD.
rows[].description string Yes The narration as printed. Use an empty string if none.
rows[].drcr string Yes The statement's own Dr or Cr marker, copied as printed. One of: DR, CR.
rows[].amount number Yes Positive, with no grouping. drcr carries the direction.
rows[].balance number No The balance printed after this row, signed. Negative when overdrawn. Without balances the rows cannot be checked.

Response fields

Field Type Description
documentId string Document ID.
pageNo integer Page number.
storedRows integer How many rows this call stored for that page.
totalRows integer Rows now recorded for the whole document.
progress object Progress.
progress.pageCount integer Pages of text stored for this document.
progress.pagesRecorded[] array of integer Pages that have rows.
progress.pagesRemaining[] array of integer Pages that do not.
progress.nextPage integer The first page with no rows, or null when none remain.
reconciliation object Reconciliation.
reconciliation.status string Only reconciled is safe to post from. One of: reconciled, partial, broken, unverifiable.
reconciliation.rows integer Rows checked against.
reconciliation.verifiedRows integer With reconciled: rows whose amount was checked.
reconciliation.polarity string Which side raises the balance on this statement. One of: CR_INCREASES, DR_INCREASES.
reconciliation.opening number With reconciled: opening balance.
reconciliation.closing number With reconciled: closing balance.
reconciliation.checkedPairs integer With partial: pairs of rows that could be checked.
reconciliation.rowsWithoutBalance[] array of integer With partial: rows with no balance, so never checked.
reconciliation.breaks[] array of object With broken: where the running balance fails.
reconciliation.breaks[].pageNo integer Page number.
reconciliation.breaks[].rowNo integer Row number.
reconciliation.breaks[].date date Date.
reconciliation.breaks[].description string Row narration, cut to 80 characters.
reconciliation.breaks[].drcr string One of: DR, CR.
reconciliation.breaks[].amount number Amount.
reconciliation.breaks[].previousBalance number Previous balance.
reconciliation.breaks[].expectedBalance number Expected balance.
reconciliation.breaks[].actualBalance number Actual balance.
reconciliation.breaks[].delta number Actual minus expected balance.
reconciliation.reason string With unverifiable: why there was nothing to check.
mayPost boolean May post.
refusal string Refusal.

Status codes

Status Error Meaning
200 Success.
400 bad_request A row is malformed. The message names the row.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.

Example request

curl -s -X PUT "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/rows" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  -H "content-type: application/json" \
  -d '{
  "pageNo": 1,
  "rows": [
    {
      "date": "2026-10-03",
      "description": "NEFT MEHTA HARDWARE",
      "drcr": "CR",
      "amount": 11800,
      "balance": 254300.5
    }
  ]
}'

Filing and re-reading

File a document into a company

POST /v1/documents/{id}/companies

Files a document into a company. Safe to repeat: filing it twice changes nothing. Use a key with writes allowed for uploads and changes.

Parameters

Name In Type Required Description
id Path string Yes The documentId.

Body fields

Field Type Required Description
companyGuid string Yes Company GUID.

Response fields

Field Type Description
documentId UUID Document ID.
companies[] array of string Companies.

Status codes

Status Error Meaning
200 Already filed there. Nothing changed.
201 Filed.
400 bad_request companyGuid is missing or blank.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.

Example request

curl -s -X POST "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/companies" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  -H "content-type: application/json" \
  -d '{
  "companyGuid": "9f3a1c52-7b1e-4d60-a2f4-6c1e8d0b7a11"
}'

Remove a filing

DELETE /v1/documents/{id}/companies/{companyGuid}

Removes a document from a company and withdraws the entries made from it that can still be withdrawn. retained[] reports the rest. Do not assume a bill left the books: check retained. Use a key with writes allowed for uploads and changes.

Parameters

Name In Type Required Description
id Path string Yes The documentId.
companyGuid Path string Yes Company GUID.

Response fields

Field Type Description
documentId UUID Document ID.
companies[] array of string Filings that remain.
withdrawn[] array of UUID Ids of the writes withdrawn.
retained[] array of object Entries that could not be withdrawn.
retained[].intentId UUID The write.
retained[].state string State of the write. One of: applied, pending, claimed, submitted, failed.
retained[].reason string Why it could not be withdrawn. One of: already-applied, approved-and-in-flight, failed.
retained[].voucherNumber string With already-applied, once known. For display only.
retained[].masterId integer With already-applied: Tally's numeric id for the voucher.
retained[].appliedAt date-time When it last changed state.

Status codes

Status Error Meaning
200 Success.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.

Example request

curl -s -X DELETE "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/companies/9f3a1c52-7b1e-4d60-a2f4-6c1e8d0b7a11" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN"

Deep read a document

POST /v1/documents/{id}/deep-read

Reads the document a second time with an independent reader and merges the result. This spends workspace credits. Where the readings disagree the field becomes disputed. Settle it with /resolve. Asking again serves the stored result and charges nothing. Use a key with writes allowed for uploads and changes.

Parameters

Name In Type Required Description
id Path string Yes The documentId.

Body fields

Field Type Required Description
companyGuid string No Which company to rebuild the posting in. Needed when it is filed into more than one.

Response fields

Field Type Description
documentId string Document ID.
extraction object Extraction.
extraction.kind string Kind of document, as read.
extraction.fields object The fields read, by name.
extraction.fields.<field>.value any String or number. Null means the document does not print it.
extraction.fields.<field>.confidence number Confidence from 0 to 1.
extraction.fields.<field>.method string How the value was obtained. disputed means two readers disagree: show both. One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.fields.<field>.alternative object The other reading. Present when method is disputed.
extraction.fields.<field>.alternative.value any Value.
extraction.fields.<field>.alternative.confidence number Confidence of the other reading.
extraction.fields.<field>.alternative.method string One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.pages integer Page count.
extraction.lineItems[] array of object Line items, as read.
extraction.lineItems[].description string Description.
extraction.lineItems[].quantity number Quantity.
extraction.lineItems[].rate number Rate.
extraction.lineItems[].amount number Amount.
extraction.lineItems[].hsn string HSN or SAC code.
extraction.guards[] array of object Checks the reading failed.
extraction.guards[].code string One of: gstin-invalid, tax-arithmetic, line-item-arithmetic, required-field-missing.
extraction.guards[].field string Field.
extraction.guards[].message string Message.
bundleId string Bundle ID.
deepRead object Always available: false, alreadyRead: true here.
deepRead.available boolean Available.
deepRead.reasons[] array of string Reasons.
deepRead.alreadyRead boolean Already read.

Status codes

Status Error Meaning
200 Success.
401 unauthorized The key is missing, invalid or revoked.
402 insufficient_credits The workspace has no credits. Nothing was spent.
404 not_found No such document in this workspace.
409 nothing_to_reconcile The document has no first reading to compare with.
503 reader_unavailable The second reader is not available.

Example request

curl -s -X POST "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/deep-read" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN"

Settle a disputed field

POST /v1/documents/{id}/resolve

Picks one reading of each disputed field, then rebuilds the proposed posting. Only fields that are currently disputed can be named. Use a key with writes allowed for uploads and changes.

Parameters

Name In Type Required Description
id Path string Yes The documentId.

Body fields

Field Type Required Description
resolutions object Yes Field name to the reading that wins: ours keeps the current value, deep takes the second reading.
companyGuid string No Which company to rebuild the posting in. Needed when it is filed into more than one.

Response fields

Field Type Description
documentId UUID Document ID.
companies[] array of string Every company it is filed into. Empty when unfiled.
kind string One of: purchase-invoice, sales-invoice, bank-statement, receipt, other, bill-of-supply, proforma-invoice, purchase-order, delivery-challan, quotation, unknown.
title string Document number, when one was read.
mime string MIME type.
sizeBytes integer Size bytes.
sourceChannel string One of: chat, email, whatsapp, telegram, slack.
state string One of: received, extracting, extracted, failed, proposed, deleted.
createdAt date-time Created at.
extraction object What was read from it.
extraction.kind string Kind of document, as read.
extraction.fields object The fields read, by name.
extraction.fields.<field>.value any String or number. Null means the document does not print it.
extraction.fields.<field>.confidence number Confidence from 0 to 1.
extraction.fields.<field>.method string How the value was obtained. disputed means two readers disagree: show both. One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.fields.<field>.alternative object The other reading. Present when method is disputed.
extraction.fields.<field>.alternative.value any Value.
extraction.fields.<field>.alternative.confidence number Confidence of the other reading.
extraction.fields.<field>.alternative.method string One of: labelled, heuristic, model, deep, corroborated, disputed, absent.
extraction.pages integer Page count.
extraction.lineItems[] array of object Line items, as read.
extraction.lineItems[].description string Description.
extraction.lineItems[].quantity number Quantity.
extraction.lineItems[].rate number Rate.
extraction.lineItems[].amount number Amount.
extraction.lineItems[].hsn string HSN or SAC code.
extraction.guards[] array of object Checks the reading failed.
extraction.guards[].code string One of: gstin-invalid, tax-arithmetic, line-item-arithmetic, required-field-missing.
extraction.guards[].field string Field.
extraction.guards[].message string Message.
bundleId UUID The approval bundle proposed from it, if any.
url string A link to the file, valid for urlExpiresInSeconds.
urlExpiresInSeconds integer How long url lasts.
deepRead object Whether a second read is worth buying.
deepRead.available boolean true if a second read is on offer.
deepRead.credits integer Estimated credits. Absent when not available.
deepRead.reasons[] array of string Why it is offered.
deepRead.alreadyRead boolean true once paid for. Asking again charges nothing.

Status codes

Status Error Meaning
200 Success.
400 bad_request resolutions is missing or malformed.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.
409 not_disputed A named field is not disputed.
409 nothing_to_resolve No field is disputed.
409 not_filed The document is filed into no company.
409 not_filed_there The document is not filed into that company.
409 ambiguous_company It is filed into several companies. Send companyGuid.

Example request

curl -s -X POST "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/resolve" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN" \
  -H "content-type: application/json" \
  -d '{
  "resolutions": {
    "supplierGstin": "deep"
  }
}'

Rebuild a posting

POST /v1/documents/{id}/repropose

Rebuilds the proposed posting for a document that ended up without one. bundleId can be null even on success: read flags. Use a key with writes allowed for uploads and changes.

Parameters

Name In Type Required Description
id Path string Yes The documentId.

Body fields

Field Type Required Description
force boolean No Post it even though the document's kind says it should not be. Other checks still apply.
companyGuid string No Which company to rebuild the posting in. Needed when it is filed into more than one.

Response fields

Field Type Description
documentId UUID Document ID.
bundleId UUID Bundle ID.
flags[] array of object Flags.
flags[].code string Code.
flags[].field string The extracted field this concerns.
flags[].message string Message.

Status codes

Status Error Meaning
200 Success.
401 unauthorized The key is missing, invalid or revoked.
404 not_found No such document in this workspace.
409 nothing_to_propose The document was never read.
409 not_filed The document is filed into no company.
409 not_filed_there The document is not filed into that company.
409 ambiguous_company It is filed into several companies. Send companyGuid.
409 already_proposed It already has an entry.
409 already_posting An entry is approved or on its way to Tally.

Example request

curl -s -X POST "https://relay.autotally.ai/v1/documents/7d2b8c14-96ae-4f03-b1c7-52e0a9d6f381/repropose" \
  -H "authorization: Bearer $AUTOTALLY_TOKEN"