Email Invoice via API

Hello,

I am trying to test emailing an invoice through the API. I keep getting an error when using the https://bluemoonbcdev.sfprocessing.com/api/v1/invoices/“invoice hash”/email endpoint. The error is “You are not authorized to view or perform this action”. Does this API request not work?

Additionally, I attempted to send an email through the bulk request. I am getting a Server Down error on that one.

Thank you,

Cameron Williams

Hi,

It may help to compare the request you’re sending to the request sent by the web app using the network tab in the browser.

I followed that request exactly and got a Server Down error as well.

Can you post a sample curl request?

Here is the one I saw in the web app I tried to copy:

curl -X POST https://<hosted url>/api/v1/emails -H "Content-Type: application/json" -H "X-API-TOKEN: <Token>" -H "X-Requested-With: XMLHttpRequest" -d '{"entity":"invoice","entity_id":"WJxbojagwO","template":"email_template_invoice","body":"<p>To view your invoice for $amount, click the link below.</p><div class=\"center\">$view_link</div>","subject":"New invoice $number from $company.name"}'

Here is the bulk API:

curl -X POST https://<Hosted URL>/api/v1/invoices/bulk -H "Content-Type: application/json" -H "X-API-TOKEN: <Token>" -H "X-Requested-With: XMLHttpRequest" -d '{"action":"email","ids":["WJxbojagwO"]}'

Here is the invoice email API:

curl -X GET https://<hosted URL>/api/v1/invoices/WJxbojagwO/email -H "Content-Type: application/json" -H "X-API-TOKEN: <Token>" -H "X-Requested-With: XMLHttpRequest"

@david do you have any thoughts?

@pats721

I have a fix in for this, it will be available in our Sunday release.

for reference this curl will work as expected:

curl -X GET https://<hosted URL>/api/v1/invoices/WJxbojagwO/email -H "Content-Type: application/json" -H "X-API-TOKEN: <Token>" -H "X-Requested-With: XMLHttpRequest"

@david

Was this fix released? I am still getting the same error on my end.

Thank you,

Cameron Williams

Was this fixed released? I just tried again and I am still getting the same error.

Thank you,

Cameron Williams

@pats721

this endpoint is reporting normally for me

curl -X GET 'https://invoicing.co/api/v1/invoices/invoice_hashed_id/email'