Error 404 when sending invoice via Moneybird API

Hi everyone!

I’m fairly new to Make and I’m trying to build an automated connection between Wix and Moneybird.

Goal of the automation:

  • Customer books a photoshoot in Wix and pays

  • Contact details are sent to Moneybird

  • Moneybird automatically creates an invoice

  • The invoice is automatically sent to the customer

Creating the customer and generating the draft invoice works correctly.
However, the last step (sending the invoice) fails.

I’m getting the following error in Module 12 (Make an API call): RuntimeError [404] Not Found

I have used the following settings in Module 12:

My question:
Where does this error come from, and what is the correct URL/settings to automatically send the invoice via Moneybird?

Here is my total scenario:

Any help or suggestions are greatly appreciated, thanks!

Hello,

Welcome to the Community!

It looks like you missed part of the URL.

According to the documentation:
source
and helper text in module settings

Zrzut ekranu 2025-11-12 o 13.08.24

The correct endpoint for this method is:

PATCH
https://moneybird.com/api/v2
/{administration_id}/sales_invoices/{id}/send_invoice{format}

so you should add /v2/{administration_id/ before existing /sales_invoices... and {format} at the end.

Remember to change {administration_id} and {format} to your values.

Thanks for your help! I have adjusted the URL and did a new run using existing data. But now I received an error for module 11:

Should i include {format} behind my URL? However, I don’t have any {format} fields. And if so, should I adjust the content of the body?

My body now contains the following text:
{
“sales_invoice_sending”: {
“delivery_method”: “Email”,
“email_address”: “{{1.data.contact.email}}”,
“email_message”: “Beste {{1.data.contact.name.first}},
Bedankt voor je reservering! Hierbij de factuur.
Met vriendelijke groet,
Mari”
}
}

I used the following settings:

Thanks again for your help!

Yes, {format} also should be provided

Whenever I use API calls where I have to supply the body text, especially if I’m using variables, I like to use a Create JSON module first, then use that output in the body of the API call. Create JSON module will basically guarantee you submit a correctly-formatted JSON so long as you get the keys and data types correct.

Also, if you use the Make Dev Tool to inspect a call, you might be able to get a little more info about the error and maybe even tell you exactly where the error was in your body.

Should I just type {format} behind my URL? Or should it contain a field? I cannot seem to locate a field for that.

Thanks Donald! It’s still a little too technical for me at this stage, but I’m learning :blush:

Could you tell me how I can create a JSON module in Make? And how do I know if my request body is set up correctly?

I tried using the Make Dev Tool, but I still find it quite challenging. I’m hoping to get a better understanding of all this step-by-step.

Thanks again for your help!

Welcome to the Make community!

Beste {{1.data.contact.name.first}},
Bedankt voor je reservering! Hierbij de factuur.
Met vriendelijke groet,
Mari

You cannot have special characters like newlines and double-quotes in JSON, without escaping (encoding) them first.

Escaping strings before mapping into another JSON string

Most of the time, you cannot directly map variables containing text content into another JSON string without escaping them, as the variable might contain special characters that are reserved. Special characters in JSON needs to be escaped (encoded) as a “literal” character, otherwise they make the whole JSON invalid when you map the variable value when creating another JSON string.

You can escape string variables by passing the text into the “Transform to JSON” module. You can also build a valid JSON string by using a Data Structure with the “Create JSON” module. Then, you can map the output of the Transform module into another JSON string, or simply use the whole output of the Create module.

:warning: Note:

When using the “Transform to JSON” module, the output should already contain the double quotes " " around your text, so when you map this output into your JSON, you should not need to wrap another pair of double quotes around it.

Alternatively, you can use the built-in function replace to replace those special characters with their escaped versions. To do this, simply paste this into the field, and replace the 1.text variable:

{{ replace(replace(1.text; "/([""\\])/g"; "\$1"); "/\r?\n\r?/g"; "\n") }}

For more information on JSON and escaping JSON strings, see:

Hope this helps! If you are still having trouble, please provide more details.

@samliew

1 Like