Create a Source
const url = 'https://api.pocketbell.dev/v1/sources';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Production Servers","kind":"api","default_priority":"silent"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pocketbell.dev/v1/sources \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Production Servers", "kind": "api", "default_priority": "silent" }'Returns the new Source’s API key. It is shown only this once.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
Production ServersDefaults to api.
Defaults to normal.
Responses
Section titled “Responses”Created.
object
object
Api: sends with an API key. webhook: another service posts events to its URL.
Webhook only: the title, with {{field}} placeholders.
Webhook only: the message; empty means a summary of the event.
Webhook only: when the latest event arrived.
Webhook only: the field whose value sets the priority; null: always the default.
Webhook only: the priority for each value of priority_field, the first match winning. Any other value gets the default.
object
Webhook only: the field whose value is the replace key, so a later event with the same value replaces the earlier notification; null: none.
The devices it sends to, of those still receiving; null: every device, including new ones. If every chosen device is removed, it sends to every device.
Identifies the key without revealing it.
The sound its notifications play; null: the device’s own.
Always null: every Critical notification plays the Critical sound.
Notifications sent in the last 24 hours.
Webhook only: the tool its latest event is from, when Pocketbell writes its notifications (no template of its own); null otherwise.
When it last sent a notification that was taken, within the plan’s history.
The last notification it sent that was refused, and why: the sender alone saw the error.
object
The error the sender got: monthly_limit_reached, rate_limited, pro_required or question_limit.
API Sources. Shown once: only its hash is kept.
Webhook Sources. Shown once. The URL is /v1/hooks/{webhook_token} on this server.
Example
{ "source": { "id": "src_01jz9k6q8r3tfv0x2m4n5p7s8a", "name": "Production Servers", "kind": "api", "priority_field": "status", "priority_values": [ { "value": "down", "priority": "silent" } ], "replace_field": "check", "api_key_hint": "pb_live_8fK2…Qx4a", "default_priority": "silent", "sound": "default", "critical_sound": "default", "automatic_tool": "Uptime Kuma", "last_refused": { "code": "monthly_limit_reached" } }, "api_key": "pb_live_…", "webhook_token": "pbw_…"}The request was invalid.
object
object
Which fields were wrong, for invalid_request.
object
Example
{ "error": { "code": "invalid_request" }}Missing or ended session.
object
object
Which fields were wrong, for invalid_request.
object
Example
{ "error": { "code": "invalid_request" }}The plan’s Source limit is reached.
object
object
Which fields were wrong, for invalid_request.
object
Example
{ "error": { "code": "invalid_request" }}