Skip to content

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/messages

Authentication

Required

Include one of these headers in your request:

  • Token: <your-api-key> — Get it from API Keys
  • Authorization: Bearer <jwt-token> — From Login

Request

Headers

HeaderRequiredDescription
Content-Typemultipart/form-data
TokenYour API key

Body Parameters (multipart/form-data)

ParameterTypeRequiredDescription
titlestringNotification title
messagestringNotification body text
application_idstringApplication TID
device_idstringDevice TID (omit for all)
filefileImage 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

FieldTypeDescription
tidstringUnique message identifier
titlestringMessage title
messagestringMessage body
attachmentobjectAttachment details
attachment.tidstringAttachment identifier
attachment.file_namestringStored file name
attachment.content_typestringMIME type
attachment.file_sizeintegerFile 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

StatusDescription
401Unauthorized — Invalid or missing token
403Forbidden — Feature requires paid plan
422Validation Error — Invalid file type or missing fields

Pocket Alert Documentation