Webhooks

Show examples in: cURL Ruby

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

Parameters

Parameter Type Description
url String

Required

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": "181903583637145061",
  "administration_id": 123,
  "url": "http://www.mocky.io/v2/5185415ba171ea3a00704eed",
  "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/181903583767168487.json

Response

Status: 204 No Content

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"
  }
}

Top