Pushary Docs
Pushary Docs
DashboardPricingGetting Started

Client SDK

InstallationAPI Reference

Server SDK

InstallationAuthenticationSubscribersCampaignsTemplatesSend NotificationsREST API Reference

REST API Reference

Direct HTTP API access for server-side integrations

Use the REST API to integrate Pushary with any language or platform. All endpoints require authentication via API key.

Base URL

https://pushary.com/api/v1/server

Authentication

All server API endpoints require a full API key passed via the Authorization header:

Authorization: Bearer pk_xxx.sk_xxx

The API key consists of two parts:

  • pk_xxx - Public prefix (site key)
  • sk_xxx - Secret portion (never expose client-side)

Example Request

curl -X GET https://pushary.com/api/v1/server/subscribers \
  -H "Authorization: Bearer pk_abc123.sk_secret456"

Authentication Errors

StatusErrorDescription
401UnauthorizedMissing or invalid API key
{
  "error": "Unauthorized",
  "message": "Invalid or missing API key. Use Authorization: Bearer pk_xxx.sk_xxx"
}

Rate Limiting

Rate limits vary by plan and are applied per API key:

PlanRequests/minute
Free5
Starter25
Growth100
Enterprise500

Rate Limit Headers

Every response includes rate limit information:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1704067200

Rate Limit Exceeded

{
  "error": "Too Many Requests",
  "message": "Rate limit exceeded. Please retry after 60 seconds.",
  "retryAfter": 60
}

Pagination

List endpoints support cursor-based pagination:

ParameterTypeDefaultMaxDescription
limitinteger100500Number of items per page
cursorstring--Cursor for next page

Response Format

{
  "data": [...],
  "hasMore": true,
  "nextCursor": "abc123"
}

Paginating Results

curl "https://pushary.com/api/v1/server/subscribers?limit=50&cursor=abc123" \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Send Notifications

Send push notifications directly to subscribers.

POST /send

curl -X POST https://pushary.com/api/v1/server/send \
  -H "Authorization: Bearer pk_xxx.sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "New Message",
    "body": "You have a new notification",
    "url": "https://example.com/messages"
  }'

Request Body

FieldTypeRequiredDescription
titlestringYesNotification title
bodystringYesNotification body text
urlstringNoClick action URL
iconUrlstringNoCustom icon URL
imageUrlstringNoLarge image URL
subscriberIdsstring[]NoTarget specific subscribers
externalIdsstring[]NoTarget by external user IDs
tagsstring[]NoTarget by subscriber tags

Targeting

If no targeting parameters are provided, the notification is sent to all active subscribers.

curl -X POST https://pushary.com/api/v1/server/send \
  -H "Authorization: Bearer pk_xxx.sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Welcome Back!",
    "body": "We missed you",
    "externalIds": ["user_123", "user_456"]
  }'

Response

{
  "success": true,
  "campaignId": "camp_abc123",
  "sent": 150,
  "limits": {
    "remaining": 9850,
    "limit": 10000
  }
}

Subscribers

Manage push notification subscribers.

List Subscribers

GET /subscribers

Query Parameters

ParameterTypeDescription
limitintegerItems per page (default: 100, max: 500)
cursorstringPagination cursor
statusstringFilter by status: active, unsubscribed, expired, bounced
externalIdstringFilter by external ID
tagsstringComma-separated tags filter

Example

curl "https://pushary.com/api/v1/server/subscribers?status=active&limit=50" \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Response

{
  "data": [
    {
      "id": "sub_abc123",
      "siteId": "site_xyz",
      "status": "active",
      "externalId": "user_123",
      "tags": ["premium", "newsletter"],
      "browser": "Chrome",
      "os": "Windows",
      "country": "US",
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z"
    }
  ],
  "hasMore": true,
  "nextCursor": "sub_def456"
}

Get Subscriber

GET /subscribers/:id
curl https://pushary.com/api/v1/server/subscribers/sub_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Update Subscriber

PATCH /subscribers/:id
curl -X PATCH https://pushary.com/api/v1/server/subscribers/sub_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["premium", "early-access"],
    "externalId": "user_456",
    "customData": {"plan": "pro"}
  }'

Request Body

FieldTypeDescription
tagsstring[]Update subscriber tags
externalIdstringUpdate external identifier
customDataobjectCustom metadata

Delete Subscriber

DELETE /subscribers/:id
curl -X DELETE https://pushary.com/api/v1/server/subscribers/sub_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Response

{
  "success": true
}

Get Subscriber Count

GET /subscribers/count
curl https://pushary.com/api/v1/server/subscribers/count \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Response

{
  "total": 1500,
  "active": 1200,
  "unsubscribed": 300
}

Campaigns

Create and manage notification campaigns.

List Campaigns

GET /campaigns
curl "https://pushary.com/api/v1/server/campaigns?limit=20" \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Response

{
  "data": [
    {
      "id": "camp_abc123",
      "name": "Welcome Campaign",
      "title": "Welcome!",
      "body": "Thanks for subscribing",
      "status": "draft",
      "totalTargeted": 0,
      "totalSent": 0,
      "totalDelivered": 0,
      "totalClicked": 0,
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ],
  "hasMore": false,
  "nextCursor": null
}

Create Campaign

POST /campaigns
curl -X POST https://pushary.com/api/v1/server/campaigns \
  -H "Authorization: Bearer pk_xxx.sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Launch",
    "title": "New Feature Available!",
    "body": "Check out our latest update",
    "actionUrl": "https://example.com/new-feature"
  }'

Request Body

FieldTypeRequiredDescription
namestringYesInternal campaign name
titlestringYesNotification title
bodystringYesNotification body
iconUrlstringNoCustom icon URL
imageUrlstringNoLarge image URL
actionUrlstringNoClick action URL
scheduledAtstringNoISO 8601 schedule time
segmentIdstringNoTarget segment ID

Response

Returns the created campaign object with status 201.

Get Campaign

GET /campaigns/:id
curl https://pushary.com/api/v1/server/campaigns/camp_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Update Campaign

PATCH /campaigns/:id
curl -X PATCH https://pushary.com/api/v1/server/campaigns/camp_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Title",
    "body": "Updated body text"
  }'

Request Body

FieldTypeDescription
namestringCampaign name
titlestringNotification title
bodystringNotification body
iconUrlstringCustom icon URL
imageUrlstringLarge image URL
actionUrlstringClick action URL
scheduledAtstringISO 8601 schedule time
statusstringCampaign status

Delete Campaign

DELETE /campaigns/:id
curl -X DELETE https://pushary.com/api/v1/server/campaigns/camp_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Send Campaign

POST /campaigns/:id/send

Send an existing campaign to all active subscribers.

curl -X POST https://pushary.com/api/v1/server/campaigns/camp_abc123/send \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Requirements

  • Campaign must have status draft or scheduled
  • Site must have VAPID keys configured

Response

Returns the updated campaign object with status sending.


Templates

Create reusable notification templates.

List Templates

GET /templates
curl "https://pushary.com/api/v1/server/templates" \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Response

{
  "data": [
    {
      "id": "tmpl_abc123",
      "name": "Welcome Template",
      "title": "Welcome to {{siteName}}!",
      "body": "Thanks for subscribing, {{userName}}",
      "iconUrl": null,
      "imageUrl": null,
      "actionUrl": "https://example.com/welcome",
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z"
    }
  ],
  "hasMore": false,
  "nextCursor": null
}

Create Template

POST /templates
curl -X POST https://pushary.com/api/v1/server/templates \
  -H "Authorization: Bearer pk_xxx.sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Order Confirmation",
    "title": "Order Confirmed!",
    "body": "Your order #{{orderId}} has been confirmed",
    "actionUrl": "https://example.com/orders/{{orderId}}"
  }'

Request Body

FieldTypeRequiredDescription
namestringYesTemplate name
titlestringYesNotification title
bodystringYesNotification body
iconUrlstringNoCustom icon URL
imageUrlstringNoLarge image URL
actionUrlstringNoClick action URL

Get Template

GET /templates/:id
curl https://pushary.com/api/v1/server/templates/tmpl_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Update Template

PATCH /templates/:id
curl -X PATCH https://pushary.com/api/v1/server/templates/tmpl_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Title",
    "body": "Updated body with {{variable}}"
  }'

Delete Template

DELETE /templates/:id
curl -X DELETE https://pushary.com/api/v1/server/templates/tmpl_abc123 \
  -H "Authorization: Bearer pk_xxx.sk_xxx"

Error Responses

All errors follow a consistent format:

{
  "error": "Error Type",
  "message": "Human-readable description"
}

Error Codes

StatusErrorDescription
400Bad RequestMissing required fields or invalid request body
401UnauthorizedInvalid or missing API key
403ForbiddenPlan limit exceeded or permission denied
404Not FoundResource does not exist
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server error

Plan Limit Error

{
  "error": "Notification limit exceeded",
  "message": "You've reached your monthly notification limit",
  "upgradeUrl": "https://pushary.com/pricing"
}

Missing Fields Error

{
  "error": "Missing required fields: title, body"
}

On this page

Base URLAuthenticationExample RequestAuthentication ErrorsRate LimitingRate Limit HeadersRate Limit ExceededPaginationResponse FormatPaginating ResultsSend NotificationsPOST /sendRequest BodyTargetingResponseSubscribersList SubscribersQuery ParametersExampleResponseGet SubscriberUpdate SubscriberRequest BodyDelete SubscriberResponseGet Subscriber CountResponseCampaignsList CampaignsResponseCreate CampaignRequest BodyResponseGet CampaignUpdate CampaignRequest BodyDelete CampaignSend CampaignRequirementsResponseTemplatesList TemplatesResponseCreate TemplateRequest BodyGet TemplateUpdate TemplateDelete TemplateError ResponsesError CodesPlan Limit ErrorMissing Fields Error