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": "426664308421690566",
    "administration_id": 123,
    "url": "http://example.com/create_webhook",
    "events": [

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

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]

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": "426664308573734088",
  "administration_id": 123,
  "url": "http://www.mocky.io/v2/5185415ba171ea3a00704eed",
  "events": [

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

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": "426664308656571594",
  "administration_id": 123,
  "url": "http://www.mocky.io/v2/5185415ba171ea3a00704eed",
  "events": [
    "contact_created"
  ],
  "last_http_status": null,
  "last_http_body": null,
  "token": "oBkT6aWoLwJEJB677MynsaDC"
}
      

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/426664308758283468.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"
  }
}