Webhooks

List all webhooks

Example: returns all webhooks of an administration

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XGET \
  https://moneybird.com/api/v2/123/webhooks.json?
    

Response

        
          
          Status: 200 OK
        
      
[
  {
    "id": "433546379183260833",
    "administration_id": 123,
    "url": "http://example.com/create_webhook",
    "events": [

    ],
    "enabled_events": [

    ],
    "last_http_status": null,
    "last_http_body": null,
    "token": "SbhzwAjBQuUjUJqDs3iJkFR5"
  }
]
      

Create a webhook

Creates a new webhook. The provided URL should respond with a 200 HTTP status. After creation, the URL will receive notifications when events on documents in the administration occur. It is also possible to subscribe to certain events by adding an array with events you would like to receive notifications from.

We strongly recommend that you use a secure HTTPS endpoint for receiving payload from Moneybird.
If you use unencrypted HTTP, anyone on the network may be able to listen in on sensitive information like contacts and invoices.

Parameters

Parameter Type Description
url String

Required

events Array[string]
enabled_events Array[string]

Example: creates a webhook

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"url":"http://www.mocky.io/v2/5185415ba171ea3a00704eed"}' \
  https://moneybird.com/api/v2/123/webhooks.json
    

Response

        
          
          Status: 201 Created
        
      
{
  "id": "433546379320624293",
  "administration_id": 123,
  "url": "http://www.mocky.io/v2/5185415ba171ea3a00704eed",
  "events": [

  ],
  "enabled_events": [

  ],
  "last_http_status": null,
  "last_http_body": null,
  "token": "gX3Bo7mGu39ySHpA84qRUtM1"
}
      

Example: creates a webhook that is subscribed to events

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"url":"http://www.mocky.io/v2/5185415ba171ea3a00704eed","events":["contact_created"]}' \
  https://moneybird.com/api/v2/123/webhooks.json
    

Response

        
          
          Status: 201 Created
        
      
{
  "id": "433546379401364649",
  "administration_id": 123,
  "url": "http://www.mocky.io/v2/5185415ba171ea3a00704eed",
  "events": [
    "contact_created"
  ],
  "enabled_events": [
    "contact_created"
  ],
  "last_http_status": null,
  "last_http_body": null,
  "token": "gyKNevDWjrfaz2QgiZyB9jkH"
}
      

Example: creates a webhook that is subscribed to enabled_events

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"url":"http://www.mocky.io/v2/5185415ba171ea3a00704eed","enabled_events":["contact_created"]}' \
  https://moneybird.com/api/v2/123/webhooks.json
    

Response

        
          
          Status: 201 Created
        
      
{
  "id": "433546379495736493",
  "administration_id": 123,
  "url": "http://www.mocky.io/v2/5185415ba171ea3a00704eed",
  "events": [
    "contact_created"
  ],
  "enabled_events": [
    "contact_created"
  ],
  "last_http_status": null,
  "last_http_body": null,
  "token": "bdJV1X4gbs37UmJpAiNQJhZ1"
}
      

Example: returns an error when both events and enabled_events are provided

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"url":"http://www.mocky.io/v2/5185415ba171ea3a00704eed","events":["contact_created"],"enabled_events":["contact_created"]}' \
  https://moneybird.com/api/v2/123/webhooks.json
    

Response

        
          
          Status: 400 Bad Request
        
      
{
  "error": "Cannot provide both 'events' and 'enabled_events', use non-deprecated 'enabled_events'",
  "symbolic": {
    "events": "conflict"
  }
}
      

Example: returns an error when fields are not provided

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{}' \
  https://moneybird.com/api/v2/123/webhooks.json
    

Response

        
          
          Status: 400 Bad Request
        
      
{
  "error": "Url is required",
  "symbolic": {
    "url": "required"
  }
}
      

Delete a webhook

Example: deletes a webhook

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XDELETE \
  -d '{}' \
  https://moneybird.com/api/v2/123/webhooks/433546379670848691.json
    

Response

Example: returns a 404 when the webhook cannot be found

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XDELETE \
  -d '{}' \
  https://moneybird.com/api/v2/123/webhooks/99999.json
    

Response

        
          
          Status: 404 Not Found
        
      
{
  "error": "record not found",
  "symbolic": {
    "id": "not_found"
  }
}