PijonDocumentationOpen app โ†—
Pijon / GuidesRead Markdown

Script API reference

The supported script surface contains two authenticated POST operations. API base: https://api.pijon.fyi/api/v1.

Download the OpenAPI specification. It is extracted with Scribe and checked against the request validators and response contract. Account APIs are intentionally outside this script-key specification; use the app for setup, approval, History, and usage.

POST /notifications

Headers: Authorization: Bearer <application key>, Accept: application/json, Content-Type: application/json. Send Idempotency-Key for retry safety.

JSON fieldConstraints
application_idRequired application ULID, owned by the key owner and matching its exact scope.
recipient_idRequired receiving user ULID with active subscription/category approval.
bodyRequired string; maximum 10,000 characters.
titleOptional/nullable string; maximum 120 characters; defaults to application name.
body_formatplain (default) or markdown.
categoryActive category key belonging to this application. Default general; lowercase letters/digits/underscores, starting with a letter, at most 64 characters. No global enum.
prioritynormal (default), silent, low, or high.
device_idsOptional/null for all eligible endpoints; otherwise 1 to 100 device ULIDs. Empty array rejected.
urlOptional/nullable HTTP/HTTPS URL; maximum 2,048 characters, no embedded credentials.
url_titleOptional/nullable string; maximum 80 characters.
attachment_idOptional/nullable uploaded image ULID belonging to the sender.
external_idOptional/nullable string; maximum 128 characters, unique per application while history remains.
event_atOptional/nullable date-time for the original event.
ttlInteger, 1 to 604,800 seconds; defaults to 86,400.

Success envelope: {"data":{"notification":{...},"replayed":false}}. First acceptance: 202; identical replay: 200 with replayed: true. Notification fields include id, source/application/recipient IDs, content, status, endpoint_count, and timestamps. Delivery rows may be included. Never infer device display from the acceptance response.

POST /attachments

Use multipart application_id (ULID) and image (JPEG/PNG/WebP, at most 5 MiB and 4096 by 4096 pixels). Authorization is the same scoped bearer key. 201 returns data.id, mime_type, size, width, height, and expires_at. Use data.id as a notification's attachment_id. See image workflow.

Errors

Validation: 422 with message and field errors. Domain errors carry reason and message; authentication/throttling errors may only carry message. Check HTTP status first and tolerate an absent reason. 429 includes Retry-After. Foreign private resources can return 404.

Common reasons: application_scope_required, application_paused, recipient_not_authorized, invalid_category, invalid_destinations, invalid_attachment, idempotency_conflict, daily_quota_exceeded, monthly_quota_exceeded, queue_full, attachment_storage_full. Follow Troubleshooting and retry guidance.