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

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

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

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

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

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