>  Switch To Link 5 and API v2 Documentation

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

post/v1/webhooks

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.
Request body
  • #
    eventsarray of strings
    required

    documents.added

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    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.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    documents.added

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    documentstring (uuid)

    ID of the document.

Example Subscription
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     }'
Example Webhook
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

post/v1/webhooks

Implement the documents.updated webhook to know when a document object is updated.

  • Document objects are updated through periodic scanning.
Request body
  • #
    eventsarray of strings
    required

    documents.updated

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    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.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    documents.updated

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    documentstring (uuid)

    ID of the document.

Example Subscription
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     }'
Example Webhook
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

post/v1/webhooks

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.
Request body
  • #
    eventsarray of strings
    required

    documents.removed

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    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.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    documents.removed

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    documentstring (uuid)

    ID of the document.

Example Subscription
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     }'
Example Webhook
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

post/v1/webhooks

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.

Request body
  • #
    eventsarray of strings
    required

    documents.ocr_completed

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    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.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    documents.ocr_completed

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    documentstring (uuid)

    ID of the document.

Example Subscription
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     }'
Example Webhook
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

post/v1/webhooks

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 an ocr_data object with the specific type of error. Consult OCR data fields for more information about possible error types.
Request body
  • #
    eventsarray of strings
    required

    documents.ocr_failed

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    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.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    documents.ocr_failed

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    documentstring (uuid)

    ID of the document.

Example Subscription
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     }'
Example Webhook
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}
Updating Argyle status...
© 2024 Argyle Systems Inc.argyle.com