Documents Webhooks
Learn about documents webhooks.
Documents webhooks notify your system in these scenarios:
- Document objects are added. This happens when the API finds and retrieves documents from a newly-created user account, or when it finds new documents during periodic scanning.
- Document objects are updated. Periodic scans detect when a document object is updated with new information.
- Document objects are removed. This happens when the user or their employer deletes the documents from a payroll account and the Argyle API does not find them during a periodic scan of the account, or when the user or their employer deletes the payroll account that holds the documents.
- Data extraction has completed for a payroll document scanned by Argyle from a connected account.
- Data extraction has failed for a payroll document scanned by Argyle from a connected account.
#Added
Implement the documents.added
webhook to know when a document object is added.
- Document objects are added when the API finds and retrieves documents from a newly-created user account, or when it finds new documents during periodic scanning.
- #eventsarray of stringsrequired
documents.added
- #namestringrequired
Your name for the webhook subscription.
- #urlstringrequired
Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.
- #secretstringoptional
Optional secret used to verify webhooks.
1curl --request POST \
2 --url https://api.argyle.com/v1/webhooks \
3 --header 'accept: application/json' \
4 --header 'content-type: application/json' \
5 --data '{
6 "events": ["documents.added"],
7 "name": "name-for-the-webhook-subscription",
8 "url": "https://your-webhook-backend.com",
9 "secret": "optional-secret"
10 }'
1{
2 "event": "documents.added",
3 "name": "A document was added",
4 "data": {
5 "account": "ada143be-3c90-4534-b7ea-9899674dc6e0",
6 "user": "3823026e-a964-45f6-b201-6b8c096b30d3",
7 "document": "4334r6e-a964-45eef6-b201-64464"
8 }
9}
#Updated
Implement the documents.updated
webhook to know when a document object is updated.
- Document objects are updated through periodic scanning.
- #eventsarray of stringsrequired
documents.updated
- #namestringrequired
Your name for the webhook subscription.
- #urlstringrequired
Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.
- #secretstringoptional
Optional secret used to verify webhooks.
1curl --request POST \
2 --url https://api.argyle.com/v1/webhooks \
3 --header 'accept: application/json' \
4 --header 'content-type: application/json' \
5 --data '{
6 "events": ["documents.updated"],
7 "name": "name-for-the-webhook-subscription",
8 "url": "https://your-webhook-backend.com",
9 "secret": "optional-secret"
10 }'
1{
2 "event": "documents.updated",
3 "name": "A document was updated",
4 "data": {
5 "account": "ada143be-3c90-4534-b7ea-9899674dc6e0",
6 "user": "3823026e-a964-45f6-b201-6b8c096b30d3",
7 "document": "4334r6e-a964-45eef6-b201-64464"
8 }
9}
#Removed
Implement the documents.removed
webhook to know when a document object is removed.
Document objects are removed when:
- The user or their employer deletes the documents from a payroll account and the Argyle API does not find them during a periodic scan of the account.
- The user or their employer deletes the payroll account that holds the documents.
- #eventsarray of stringsrequired
documents.removed
- #namestringrequired
Your name for the webhook subscription.
- #urlstringrequired
Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.
- #secretstringoptional
Optional secret used to verify webhooks.
1curl --request POST \
2 --url https://api.argyle.com/v1/webhooks \
3 --header 'accept: application/json' \
4 --header 'content-type: application/json' \
5 --data '{
6 "events": ["documents.removed"],
7 "name": "name-for-the-webhook-subscription",
8 "url": "https://your-webhook-backend.com",
9 "secret": "optional-secret"
10 }'
1{
2 "event": "documents.removed",
3 "name": "A document was removed",
4 "data": {
5 "account": "ada143be-3c90-4534-b7ea-9899674dc6e0",
6 "user": "3823026e-a964-45f6-b201-6b8c096b30d3",
7 "document": "4334r6e-a964-45eef6-b201-64464"
8 }
9}
#OCR completed
Implement the documents.ocr_completed
webhook to know when OCR is completed for scanned documents.
- The
documents.ocr_completed
webhook notifies your system when data retrieval through OCR is completed for a document scanned by Argyle from a connected account. - Use this webhook to get updates when OCR is completed for documents that are initially scanned from a newly connected account, or when OCR is completed for documents that are added or updated through periodic scanning.
The payload provided by this webhook does not include the actual metadata contents of the document. You can request this through the /documents
endpoint, by calling GET /documents/{id}
with the document ID received in the documents.ocr_completed
webhook. For more information, refer to the OCR Data fields page.
- #eventsarray of stringsrequired
documents.ocr_completed
- #namestringrequired
Your name for the webhook subscription.
- #urlstringrequired
Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.
- #secretstringoptional
Optional secret used to verify webhooks.
1curl --request POST \
2 --url https://api.argyle.com/v1/webhooks \
3 --header 'accept: application/json' \
4 --header 'content-type: application/json' \
5 --data '{
6 "events": ["documents.ocr_completed"],
7 "name": "name-for-the-webhook-subscription",
8 "url": "https://your-webhook-backend.com",
9 "secret": "optional-secret"
10 }'
1{
2 "event": "documents.ocr_completed",
3 "name": "OCR is completed",
4 "data": {
5 "account": "ada143be-3c90-4534-b7ea-9899674dc6e0",
6 "user": "3823026e-a964-45f6-b201-6b8c096b30d3",
7 "document": "4334r6e-a964-45eef6-b201-64464"
8 }
9}
#OCR failed
Implement the documents.ocr_failed
webhook to know when OCR fails for a scanned document.
- The
documents.ocr_failed
webhook notifies your system when data retrieval through OCR has failed for a document scanned by Argyle from a connected account. - If OCR fails, the scanned document's
metadata
field returns anocr_data
object with the specific type oferror
. Consult OCR data fields for more information about possible error types.
- #eventsarray of stringsrequired
documents.ocr_failed
- #namestringrequired
Your name for the webhook subscription.
- #urlstringrequired
Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.
- #secretstringoptional
Optional secret used to verify webhooks.
1curl --request POST \
2 --url https://api.argyle.com/v1/webhooks \
3 --header 'accept: application/json' \
4 --header 'content-type: application/json' \
5 --data '{
6 "events": ["documents.ocr_failed"],
7 "name": "name-for-the-webhook-subscription",
8 "url": "https://your-webhook-backend.com",
9 "secret": "optional-secret"
10 }'
1{
2 "event": "documents.ocr_failed",
3 "name": "OCR has failed",
4 "data": {
5 "account": "ada143be-3c90-4534-b7ea-9899674dc6e0",
6 "user": "3823026e-a964-45f6-b201-6b8c096b30d3",
7 "document": "4334r6e-a964-45eef6-b201-64464"
8 }
9}