Skip to main content
POST
/
notifications
Create notification
curl --request POST \
  --url https://api.wacht.dev/notifications \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_id": "1234567890123456789",
  "title": "Welcome!",
  "body": "You have successfully signed up.",
  "action_url": "https://example.com/dashboard",
  "action_label": "View Dashboard",
  "ctas": {},
  "severity": "info",
  "metadata": {},
  "expires_hours": 24
}
'
{
  "id": "1234567890123456789",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z",
  "deployment_id": "9876543210987654321",
  "user_id": "1234567890123456789",
  "title": "Welcome!",
  "body": "You have successfully signed up.",
  "action_url": "https://example.com/dashboard",
  "read_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "severity": "info",
  "metadata": {}
}

Authorizations

Authorization
string
header
required

API key authentication (format: Bearer {api_key})

Body

application/json
user_id
string
required

User ID to send notification to

Example:

"1234567890123456789"

title
string
required

Notification title

Example:

"Welcome!"

body
string
required

Notification message content

Example:

"You have successfully signed up."

action_url
string<uri>

Optional action URL

Example:

"https://example.com/dashboard"

action_label
string

Label for action button (defaults to "View" if action_url is provided)

Example:

"View Dashboard"

ctas
object

Call-to-action buttons (JSON format)

severity
enum<string>

Notification severity level

Available options:
info,
warning,
error,
success
Example:

"info"

metadata
object

Additional metadata

expires_hours
integer

Expiry time in hours

Example:

24

Response

Notification created

id
string

Notification ID

Example:

"1234567890123456789"

created_at
string<date-time>

Creation timestamp

Example:

"2024-01-15T10:30:00Z"

updated_at
string<date-time>

Last update timestamp

Example:

"2024-01-15T10:30:00Z"

deployment_id
string

Deployment ID

Example:

"9876543210987654321"

user_id
string

User ID

Example:

"1234567890123456789"

title
string

Notification title

Example:

"Welcome!"

body
string

Notification message

Example:

"You have successfully signed up."

action_url
string<uri> | null

Action URL

Example:

"https://example.com/dashboard"

read_at
string<date-time> | null

When notification was read

expires_at
string<date-time> | null

When notification expires

severity
enum<string>

Notification severity

Available options:
info,
warning,
error,
success
Example:

"info"

metadata
object

Additional metadata