Api/v1/invoices/[id]/[action] returns 400

I have been using a GET request to api/v1/invoices/[id]/email for over a year to send emails. Today I first noticed that request returning this error:

Exception: Request failed for https://invoicing.co returned code 400. Truncated server response: {"message":"The requested action email is not available."}

Looking at the docs page I now see that the custom invoice action route has been deprecated.

Is the deprecation why this route is returning a 400?

What is the recommended replacement approach for sending an email via /api/v1?

Thanks for any insight!

Hi,

I’m not sure, I wouldn’t expect to be able to send an email using a GET request.

I believe you can use the bulk action route to send an email. I suggest sending an email in the app and using the network tab in the browser console to see a sample API request.

1 Like

I wouldn’t expect to be able to send an email using a GET request

Perhaps, but it had previously worked for hundreds of emails!

Using the web app was a great suggestion. The invoicing.co/api/v1/emails route is used there and I was able to replicate that request with the same payload.

One suggestion is to update the API docs for api/v1/emails to provide more information on the required template field. It is difficult to find the available template values and snooping in the web app seemed the only way to find a valid value (in this case template: "email_template_invoice",).

@jj_software

I have been working on a new version of the APi docs, and have updated the documentation around this.

1 Like

Thanks @david

When I was testing this endpoint the values that are now in the enum for the docs site returned errors. How would one learn what the possible template values are?

Which values are not passing for you?

My tests for that route and those enums are passing.