Subscription Webhooks

Subscriptions allow you to subscribe to changes on an entity. Currently we only support subscriptions to Document changes.

In the list of constants below, you can find Subscription Callback Events , which lists the callback events.

Callback Event

Description

entity_updated document_status_changed final_document_generated

Data on the entity was updated.
Document Status changed
Final pdf document has finiset

To subscribe to changes on an entity, see the Create Subscription below.

You will specify a callback url, where we will POST updates when the entity is updated.
Note: The callback url must return 200 status code for success.
The post body contains a raw text JSON body with the entity_key of the entity that was updated.
The post to your callback url will look something like this:

{
                        "subscription_key":"your subscription key”,
                        "entity_key":"key of the entity that was update",
                        "entity_type": "Type of entity that was updated e.g. Document",
                        "callback_event":"One of the Callback event constants"
}

Client_id and client_secret are required for all Subscription calls

To test callbacks, subscribe to document changes (using create subscription endpoint), then make changes to the document using the frontend and you will receive a POST on the callback url you specified when you created the subscription.

📘

Debugging callback events

If you want to see what events were generated and sent to your server you can look at the the logs here callback logs

Create Subscription

POST /subscriptions
Creates a new subscription.

The callback url is where callbacks must be sent to.
entity_key is the entity to you wish to subscribe to. Currently only documents are supported. Use the key property returned in the document object as the entity_key in queries.
The callback url must return 200 response on successful call. Find out more about subscriptions here.

Note: Callback subscriptions are currently only supported for documents.

"client_id":"{{client_id}}",
  "client_secret":"{{client_secret}}",
  "subscription":{"entity_key":"{{document_key}}",   
  "callback":"http://api.127.0.0.1.xip.io:8080/v0/test_callback"  
}

Response

{
    "status": {
        "status_code": 200
    },
    "data": {
        "subscription": {
            "entity_key": "ahNkZXZ-cXVpY2tseXNpZ24tZGV2chULEghEb2N1bWVudBiAgICAgMDvCww",
            "date_updated": 1401645889795,
            "subscriber_key": null,
            "callback": "http://api.127.0.0.1.xip.io:8080/v0/test_callback",
            "key": "ahNkZXZ-cXVpY2tseXNpZ24tZGV2chkLEgxTdWJzY3JpcHRpb24YgICAgIDwiwoM",
            "date_created": 1401645889795
        }
    }
}

Get Subscription

GET
/subscriptions/<subscription_key>?client_id=<client_id>&client_secret=<client_secret>

Gets the subscription for the given key

Get Subscriptions

Get
/subscriptions?client_id=<client_id>&client_secret=<client_secret>

Specify query string parameter entity_key=<subscribed_to_entity_key> and all your subscriptions for that entity will be returned. An example of an entity_key would be a document's key. Any changes to the document will trigger a callback.

Unsubscribe by subscription key

Delete&#xA;/subscriptions/<subscription_key>?client_id={{client_id}}&client_secret={{client_secret}}**

Unsubscribe by entity key

Delete /subscriptions?client_id={{client_id}}&client_secret={{client_secret}}&entity_key={{entity_key}}