Oneclick Studio
🔔 Notifications

Using API

The OneClick Studio API allows you to send notifications programmatically to users in your project. This API powers the NotifyClient in @oneclick.dev/sdk.

📡 Endpoint

POST https://cms.yourdomain.com/api/v1/projects/:id/notifications

🔐 Authentication

All API calls require a valid Project API Key.
Include it as a Bearer token in the Authorization header:

Authorization: Bearer <PROJECT_API_KEY>

📥 Request Body

Send JSON payloads with the following structure:

FieldTypeRequiredDescription
titlestringThe title of the notification.
messagestringThe body content of the notification.
userIdstring, array(Optional) Target specific users by their ID.

Example Request

POST /api/v1/projects/my-project/notifications HTTP/1.1
Host: cms.yourdomain.com
Authorization: Bearer sk_live_abc123xyz
Content-Type: application/json

{
  "title": "New Feature Available!",
  "message": "Try out the brand new dashboard today.",
  "userId": "user_789"
}

If userId is omitted, the notification will be sent to all users in the project.

📤 Response

Success (200 OK)

{
  "success": true,
  "message": "Notification sent successfully."
}

Error Responses

Status CodeMessage
400Invalid payload or missing required fields.
401Unauthorized – Invalid or missing API key.
404Project not found for the provided id.
500Internal server error.

🔥 Example: cURL

Send a broadcast notification:

curl -X POST https://cms.yourdomain.com/api/v1/projects/my-project/notifications \
  -H "Authorization: Bearer sk_live_abc123xyz" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "System Maintenance",
    "message": "The platform will be unavailable at 1 AM UTC."
  }'

🧑‍💻 Tip

Prefer using the NotifyClient from @oneclick.dev/sdk for easier integration.