Attaching document to the email using API

Hi. Can someone give me a hint why, when I run this script, it sends the email but without the attachment? Attachments UUID is valid, and it exists.

import requests

url = “https://api.servicem8.com/platform_service_email”

payload = {
“to”: “email@email.ca”,
“subject”: “test”,
“htmlBody”: “dummy text”,
“regardingJobUUID”: “f665765d-2b0e-4c24-a28c-23f5ee04a7fb”,
“attachments”: “bc55a2fb-86eb-4072-839c-23f5eb131d9b”
}
headers = {
“accept”: “application/json”,
“X-Api-Key”: “my key”,
“content-type”: “application/json”
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

Also i tried as it is recommended in tutorial and used “attachments”: [“bc55a2fb-86eb-4072-839c-23f5eb131d9b”]. But then it just gives an error message “{“errorCode”:420,“message”:“Attachment UUID [bc55a2fb-86eb-4072-839c-23f5eb131d9b] does not exist”,“messageID”:“3b5c0c19-9656-4bb4-ba22-23f5e07969eb”,“submittedAt”:“2026-03-16T18:58:20+00:00”}“

Good afternoon. I am following up on my request earlier. can you please point out where I should search for the answer on my question? I saw some similar topics with similar requests dated in 2018-2020, and none of them were answered. Does this mean there is no solution for it yet?

Hi Vitaliy,

For /platform_service_email, the attachments field needs to be a JSON array of attachment UUIDs (not a single string), and each UUID must reference an existing attachment in ServiceM8.

Also worth noting: the ServiceM8 Messaging API (including /platform_service_email) is only available to Public Applications, and it requires OAuth 2.0 (access token) rather than API-key auth.

A good way to sanity-check the UUID you’re passing is to fetch the attachment record via the Attachments API (attachments include photos, PDFs and other user-attached files) and confirm it exists in the same account you’re sending the email from. For example, try retrieving it with GET /dboattachment/{uuid}.json.

Once you’ve done that, reply here with the response you get from GET https://api.servicem8.com/api_1.0/dboattachment/bc55a2fb-86eb-4072-839c-23f5eb131d9b.json (remove anything sensitive) so we can confirm why the Messaging API isn’t recognising it.

Thanks,
Cody