Replace a Source's API key
const url = 'https://api.pocketbell.dev/v1/sources/src_01jz9k6q8r3tfv0x2m4n5p7s8a/key';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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/src_01jz9k6q8r3tfv0x2m4n5p7s8a/key \ --header 'Authorization: Bearer <token>'The old key stops working at once. The new one is shown only this once.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
src_01jz9k6q8r3tfv0x2m4n5p7s8aResponses
Section titled “Responses”The new key.
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_…"}Missing or ended session.
object
object
Which fields were wrong, for invalid_request.
object
Example
{ "error": { "code": "invalid_request" }}No such Source on this account.
object
object
Which fields were wrong, for invalid_request.
object
Example
{ "error": { "code": "invalid_request" }}