Documents: General documents

Show examples in: cURL Ruby

List ids and versions of general documents

Returns all documents in the administration. The list contains the document id and the version of the document. Check if the version of the document is newer than the version you have stored locally, use the POST variant for fetching documents with the given ids.

Parameters

Parameter Type Description
filter String

String terms, example: key1:value1,key2:value2.

Example: retrieves all ids for synchronization

Request

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

Response

Status: 200 OK
[
  {
    "id": "181903471053636733",
    "version": 1487696690
  },
  {
    "id": "181903471109211263",
    "version": 1487696690
  },
  {
    "id": "181903471158494337",
    "version": 1487696690
  }
]

Example: retrieves all ids for synchronization using a filter

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XGET \
  https://moneybird.com/api/v2/123/documents/general_documents/synchronization.json?filter=period%3Athis_month

Response

Status: 200 OK
[
  {
    "id": "181903471445804171",
    "version": 1487696690
  },
  {
    "id": "181903471499281549",
    "version": 1487696690
  },
  {
    "id": "181903471561147535",
    "version": 1487696690
  }
]

Fetch general documents with given ids

Given a list of document ids, returns the document information belonging to the documents. Returns a maximum of 100 documents, even if more ids are provided.

Parameters

Parameter Type Description
ids Array[integer]

Required

Example: retrieves documents for given ids

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"ids":[181903472127378587,181903472186098845]}' \
  https://moneybird.com/api/v2/123/documents/general_documents/synchronization.json

Response

Status: 200 OK
[
  {
    "id": "181903472127378587",
    "administration_id": 123,
    "contact_id": null,
    "contact": null,
    "reference": "Contract",
    "date": "2017-02-21",
    "due_date": null,
    "entry_number": 3,
    "state": "saved",
    "exchange_rate": "1.0",
    "created_at": "2017-02-21T17:04:51.151Z",
    "updated_at": "2017-02-21T17:04:51.151Z",
    "notes": [

    ],
    "attachments": [

    ],
    "events": [
      {
        "administration_id": 123,
        "user_id": 14876966215920,
        "action": "document_saved",
        "link_entity_id": null,
        "link_entity_type": null,
        "data": null,
        "created_at": "2017-02-21T17:04:51.163Z",
        "updated_at": "2017-02-21T17:04:51.163Z"
      }
    ]
  },
  {
    "id": "181903472186098845",
    "administration_id": 123,
    "contact_id": null,
    "contact": null,
    "reference": "Contract",
    "date": "2017-02-21",
    "due_date": null,
    "entry_number": 4,
    "state": "saved",
    "exchange_rate": "1.0",
    "created_at": "2017-02-21T17:04:51.209Z",
    "updated_at": "2017-02-21T17:04:51.209Z",
    "notes": [

    ],
    "attachments": [

    ],
    "events": [
      {
        "administration_id": 123,
        "user_id": 14876966215920,
        "action": "document_saved",
        "link_entity_id": null,
        "link_entity_type": null,
        "data": null,
        "created_at": "2017-02-21T17:04:51.216Z",
        "updated_at": "2017-02-21T17:04:51.216Z"
      }
    ]
  }
]

Get general documents

Returns a paginated list of documents of this type in the administration.

The filter argument allows you to filter on the list of documents. Filters are a combination of keys and values, separated by a comma: key:value,key2:value2. The most common filter method will be period: period:this_month. Filtering works the same as in the web application, for more advanced examples, change the filtering in the web application and learn from the resulting URI.

Parameters

Parameter Type Description
filter String

Required

String terms, example: key1:value1,key2:value2.

page Integer
per_page Integer

Example: returns a list of general_documents

Request

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

Response

Status: 200 OK
[
  {
    "id": "181903464620623864",
    "administration_id": 123,
    "contact_id": null,
    "contact": null,
    "reference": "Contract",
    "date": "2017-02-21",
    "due_date": null,
    "entry_number": 5,
    "state": "saved",
    "exchange_rate": "1.0",
    "created_at": "2017-02-21T17:04:43.994Z",
    "updated_at": "2017-02-21T17:04:43.994Z",
    "notes": [

    ],
    "attachments": [

    ],
    "events": [
      {
        "administration_id": 123,
        "user_id": 14876966215920,
        "action": "document_saved",
        "link_entity_id": null,
        "link_entity_type": null,
        "data": null,
        "created_at": "2017-02-21T17:04:44.001Z",
        "updated_at": "2017-02-21T17:04:44.001Z"
      }
    ]
  },
  {
    "id": "181903464561903606",
    "administration_id": 123,
    "contact_id": null,
    "contact": null,
    "reference": "Contract",
    "date": "2017-02-21",
    "due_date": null,
    "entry_number": 4,
    "state": "saved",
    "exchange_rate": "1.0",
    "created_at": "2017-02-21T17:04:43.938Z",
    "updated_at": "2017-02-21T17:04:43.938Z",
    "notes": [

    ],
    "attachments": [

    ],
    "events": [
      {
        "administration_id": 123,
        "user_id": 14876966215920,
        "action": "document_saved",
        "link_entity_id": null,
        "link_entity_type": null,
        "data": null,
        "created_at": "2017-02-21T17:04:43.959Z",
        "updated_at": "2017-02-21T17:04:43.959Z"
      }
    ]
  },
  {
    "id": "181903464522057716",
    "administration_id": 123,
    "contact_id": null,
    "contact": null,
    "reference": "Contract",
    "date": "2017-02-21",
    "due_date": null,
    "entry_number": 3,
    "state": "saved",
    "exchange_rate": "1.0",
    "created_at": "2017-02-21T17:04:43.900Z",
    "updated_at": "2017-02-21T17:04:43.900Z",
    "notes": [

    ],
    "attachments": [

    ],
    "events": [
      {
        "administration_id": 123,
        "user_id": 14876966215920,
        "action": "document_saved",
        "link_entity_id": null,
        "link_entity_type": null,
        "data": null,
        "created_at": "2017-02-21T17:04:43.906Z",
        "updated_at": "2017-02-21T17:04:43.906Z"
      }
    ]
  }
]

Example: returns paginated general documents on page 1

Request

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

Response

Status: 200 OK
[
  {
    "id": "181903465094579208",
    "administration_id": 123,
    "contact_id": null,
    "contact": null,
    "reference": "Contract",
    "date": "2017-02-21",
    "due_date": null,
    "entry_number": 5,
    "state": "saved",
    "exchange_rate": "1.0",
    "created_at": "2017-02-21T17:04:44.446Z",
    "updated_at": "2017-02-21T17:04:44.446Z",
    "notes": [

    ],
    "attachments": [

    ],
    "events": [
      {
        "administration_id": 123,
        "user_id": 14876966215920,
        "action": "document_saved",
        "link_entity_id": null,
        "link_entity_type": null,
        "data": null,
        "created_at": "2017-02-21T17:04:44.452Z",
        "updated_at": "2017-02-21T17:04:44.452Z"
      }
    ]
  }
]

Example: returns paginated general documents on page 2

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XGET \
  https://moneybird.com/api/v2/123/documents/general_documents.json?page=2&per_page=1

Response

Status: 200 OK
[
  {
    "id": "181903465469969430",
    "administration_id": 123,
    "contact_id": null,
    "contact": null,
    "reference": "Contract",
    "date": "2017-02-21",
    "due_date": null,
    "entry_number": 4,
    "state": "saved",
    "exchange_rate": "1.0",
    "created_at": "2017-02-21T17:04:44.804Z",
    "updated_at": "2017-02-21T17:04:44.804Z",
    "notes": [

    ],
    "attachments": [

    ],
    "events": [
      {
        "administration_id": 123,
        "user_id": 14876966215920,
        "action": "document_saved",
        "link_entity_id": null,
        "link_entity_type": null,
        "data": null,
        "created_at": "2017-02-21T17:04:44.811Z",
        "updated_at": "2017-02-21T17:04:44.811Z"
      }
    ]
  }
]

Example: returns an error when too many general documents are requested

Request

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

Response

Status: 400 Bad Request
{
  "error": "Per Page is too big",
  "symbolic": {
    "per_page": "max"
  }
}

Get general documents

Example: returns the wanted general_document

Request

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

Response

Status: 200 OK
{
  "id": "181903466314073138",
  "administration_id": 123,
  "contact_id": null,
  "contact": null,
  "reference": "Contract",
  "date": "2017-02-21",
  "due_date": null,
  "entry_number": 2,
  "state": "saved",
  "exchange_rate": "1.0",
  "created_at": "2017-02-21T17:04:45.608Z",
  "updated_at": "2017-02-21T17:04:45.608Z",
  "notes": [

  ],
  "attachments": [

  ],
  "events": [
    {
      "administration_id": 123,
      "user_id": 14876966215920,
      "action": "document_saved",
      "link_entity_id": null,
      "link_entity_type": null,
      "data": null,
      "created_at": "2017-02-21T17:04:45.622Z",
      "updated_at": "2017-02-21T17:04:45.622Z"
    }
  ]
}

Example: only returns general_documents

Request

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

Response

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

Create a new general documents

Parameters

Parameter Type Description
general_document[reference] String

Required.

general_document[date] String

Required

Required.

general_document[due_date] String
general_document[reminder_date] String
general_document[contact_id] Integer

Should be a valid contact id.

general_document[reminder][date] String

Required

general_document[reminder][message] String

Example: creates the general_document

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"general_document":{"reference":"foobar","contact_id":181903467013473344}}' \
  https://moneybird.com/api/v2/123/documents/general_documents.json

Response

Status: 201 Created
{
  "id": "181903467373134920",
  "administration_id": 123,
  "contact_id": "181903467013473344",
  "contact": {
    "id": "181903467013473344",
    "administration_id": 123,
    "company_name": "Foobar Holding B.V.",
    "firstname": "",
    "lastname": "",
    "address1": "Hoofdstraat 12",
    "address2": "",
    "zipcode": "1234AB",
    "city": "Amsterdam",
    "country": "NL",
    "phone": "",
    "delivery_method": "Email",
    "customer_id": "1",
    "tax_number": "",
    "chamber_of_commerce": "",
    "bank_account": "",
    "attention": "",
    "email": "info@example.com",
    "email_ubl": true,
    "send_invoices_to_attention": "",
    "send_invoices_to_email": "info@example.com",
    "send_estimates_to_attention": "",
    "send_estimates_to_email": "info@example.com",
    "sepa_active": false,
    "sepa_iban": "",
    "sepa_iban_account_name": "",
    "sepa_bic": "",
    "sepa_mandate_id": "",
    "sepa_mandate_date": null,
    "sepa_sequence_type": "FRST",
    "credit_card_number": "",
    "credit_card_reference": "",
    "credit_card_type": null,
    "tax_number_validated_at": null,
    "created_at": "2017-02-21T17:04:46.275Z",
    "updated_at": "2017-02-21T17:04:46.275Z",
    "sales_invoices_url": "http://moneybird.dev/123/sales_invoices/171a73958036d043d0f0b2293be85e3cb13e4e626be7eb8d6156f2f4cc5a21e0/all",
    "notes": [

    ],
    "custom_fields": [

    ]
  },
  "reference": "foobar",
  "date": "2017-02-21",
  "due_date": null,
  "entry_number": 3,
  "state": "saved",
  "exchange_rate": "1.0",
  "created_at": "2017-02-21T17:04:46.619Z",
  "updated_at": "2017-02-21T17:04:46.619Z",
  "notes": [

  ],
  "attachments": [

  ],
  "events": [
    {
      "administration_id": 123,
      "user_id": 14876966215920,
      "action": "document_saved",
      "link_entity_id": null,
      "link_entity_type": null,
      "data": null,
      "created_at": "2017-02-21T17:04:46.626Z",
      "updated_at": "2017-02-21T17:04:46.626Z"
    }
  ]
}

Example: requires all input

Request

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

Response

Status: 400 Bad Request
{
  "error": "General Document is required",
  "symbolic": {
    "general_document": "required"
  }
}

Delete a general documents

Example: deletes the general_document

Request

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

Response

Status: 200 OK
200

Update a general documents

Parameters

Parameter Type Description
general_document[reference] String

Required.

general_document[date] String

Required

Required.

general_document[due_date] String
general_document[reminder_date] String
general_document[contact_id] Integer

Should be a valid contact id.

general_document[reminder][date] String

Required

general_document[reminder][message] String

Example: updates the general_document

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPATCH \
  -d '{"general_document":{"reference":"updated reference"}}' \
  https://moneybird.com/api/v2/123/documents/general_documents/181903468078826588.json

Response

Status: 200 OK
200

Add attachment to general document

Example: uploads an attachment

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -F file=@/tmp/upload.pdf \
  https://moneybird.com/api/v2/123/documents/general_documents/181903469083362418/attachments.json

Response

Status: 200 OK
200

Top