Create with Attachment POST Paid
Send a push notification with an attached image file.
Paid Feature
This endpoint is only available on paid plans.
Endpoint
POST https://api.pocketalert.app/v1/messagesAuthentication
Required
Include one of these headers in your request:
Request
Headers
| Header | Required | Description |
|---|---|---|
Content-Type | ✅ | multipart/form-data |
Token | ✅ | Your API key |
Body Parameters (multipart/form-data)
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | ✅ | Notification title |
message | string | ✅ | Notification body text |
application_id | string | ❌ | Application TID |
device_id | string | ❌ | Device TID (omit for all) |
file | file | ❌ | Image attachment (.png, .jpg, .jpeg, .gif) |
Example Request
bash
curl -X POST "https://api.pocketalert.app/v1/messages" \
-H "Token: your-api-key" \
-F "title=Screenshot Alert" \
-F "message=New screenshot captured" \
-F "file=@/path/to/screenshot.png"javascript
const formData = new FormData();
formData.append('title', 'Screenshot Alert');
formData.append('message', 'New screenshot captured');
formData.append('file', fileInput.files[0]);
const response = await fetch('https://api.pocketalert.app/v1/messages', {
method: 'POST',
headers: { 'Token': 'your-api-key' },
body: formData
});python
import requests
with open('screenshot.png', 'rb') as f:
response = requests.post(
'https://api.pocketalert.app/v1/messages',
headers={'Token': 'your-api-key'},
data={
'title': 'Screenshot Alert',
'message': 'New screenshot captured'
},
files={'file': f}
)
print(response.json())php
$response = Http::withHeaders([
'Token' => 'your-api-key',
])->attach(
'file', file_get_contents('/path/to/screenshot.png'), 'screenshot.png'
)->post('https://api.pocketalert.app/v1/messages', [
'title' => 'Screenshot Alert',
'message' => 'New screenshot captured',
]);
return $response->json();Response
Success Response
201 Created
Message with attachment created successfully
| Field | Type | Description |
|---|---|---|
tid | string | Unique message identifier |
title | string | Message title |
message | string | Message body |
attachment | object | Attachment details |
attachment.tid | string | Attachment identifier |
attachment.file_name | string | Stored file name |
attachment.content_type | string | MIME type |
attachment.file_size | integer | File size in bytes |
json
{
"tid": "zvtfxzk55fpqugz7ueslmse2a",
"title": "Screenshot Alert",
"message": "New screenshot captured",
"application": "Monitoring",
"device": "iPhone",
"created_at": "04.01.2025 09:12:08",
"attachment": {
"tid": "i6k4b8un79otbcbdkmavmf4ha",
"file_name": "5bd64bb3b76df1be1fc7f41eeb5078ca.jpg",
"content_type": "image/jpeg",
"file_size": 247421
}
}Error Responses
| Status | Description |
|---|---|
401 | Unauthorized — Invalid or missing token |
403 | Forbidden — Feature requires paid plan |
422 | Validation Error — Invalid file type or missing fields |
