> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daftplug.com/llms.txt
> Use this file to discover all available pages before exploring further.

# REST API

> The progressify/v1 endpoints, their permissions, and their parameters.

Progressify registers its endpoints under the `progressify/v1` namespace. They exist to serve the plugin's own admin screen and front-end scripts, so treat them as an internal API: they are documented here for debugging and integration, but they are not a versioned public contract and may change between releases.

```
https://example.com/wp-json/progressify/v1/
```

## Authentication

Administrative endpoints require the `manage_options` capability and a valid `X-WP-Nonce` header. Public endpoints exist because visitors who are not logged in have to be able to subscribe to notifications and be counted in analytics.

> [!WARNING]
>
> Do not request a nonce from `/nonce` while logged in and reuse it for an administrative call. A nonce minted for an anonymous request belongs to user 0 and will be rejected. That endpoint exists to give front-end scripts a fresh nonce on cached pages.

## Endpoints

| Endpoint | Method | Access |
| - | - | - |
| `/settings` | PUT | `manage_options` |
| `/nonce` | GET | Public |
| `/pwa-score/fetch` | GET | `manage_options` |
| `/pwa-users/upsert` | PUT | Public |
| `/pwa-users/fetch` | GET | `manage_options` |
| `/pwa-assets/check` | POST | `manage_options` |
| `/pwa-assets/save` | POST | `manage_options` |
| `/service-worker/generate` | POST | `manage_options` |
| `/push-subscription/add` | POST | Public |
| `/push-subscription/update` | PUT | Public |
| `/push-subscription/sync` | POST | Public |
| `/push-subscription/remove` | DELETE | Public |
| `/push-subscribers/fetch` | GET | `manage_options` |
| `/push-subscribers/send` | POST | `manage_options` |

## Settings

### Update settings

**PUT /settings** `endpoint`

Merges the supplied values over the stored settings. Only send the keys you want to change; anything you omit keeps its current value.

```bash theme={null}
curl -X PUT https://example.com/wp-json/progressify/v1/settings \
  -H "X-WP-Nonce: $NONCE" \
  -H "Content-Type: application/json" \
  --cookie "$COOKIE_JAR" \
  -d '{"settings": {"offlineCacheStrategy": "StaleWhileRevalidate"}}'
```

Fires [`progressify_settings_update:before`](https://docs.daftplug.com/progressify/reference/hooks#progressify_settings_updatebefore) and `:after` around the write.

> [!NOTE]
>
> There is no GET counterpart. Read settings in PHP with `get_option('progressify_settings')`.

## Metrics

### Fetch the PWA score

**GET /pwa-score/fetch** `endpoint`

Returns the score shown on the overview page.

```json theme={null}
{
  "status": "success",
  "data": {
    "scoreResult": "Good",
    "scorePercent": 75,
    "actionItems": []
  }
}
```

`scoreResult` is `Excellent` at 100, `Good` from 50, `Average` from 25, and `Bad` below that. `actionItems` lists what is still missing and is only present with an active Pro license.

### PWA users

**PUT /pwa-users/upsert** `endpoint`

Public. Records or updates the current visitor as a PWA user. Called automatically by the front-end script.

**GET /pwa-users/fetch** `endpoint`

Returns the install and usage analytics behind the overview page.

## Generated files

### Generate the service worker

**POST /service-worker/generate** `endpoint`

Rebuilds `/wp-content/uploads/progressify/scripts/serviceworker.js` from the current settings. Use this after changing the [`progressify_serviceworker`](https://docs.daftplug.com/progressify/reference/hooks#progressify_serviceworker) filter, or when the scorecard reports the file is missing.

### PWA assets

**POST /pwa-assets/check** `endpoint`

Reports whether the icon set and splash screens exist.

**POST /pwa-assets/save** `endpoint`

Regenerates them from the configured app icon and background color.

## Push notifications

### Subscriptions

The four subscription endpoints are public because they are called by visitors' browsers.

**POST /push-subscription/add** `endpoint`

Stores a new Web Push subscription. Sends the welcome notification if that automation is enabled.

**PUT /push-subscription/update** `endpoint`

Updates an existing subscription, which browsers rotate periodically.

**POST /push-subscription/sync** `endpoint`

Re-binds an existing subscription to the currently logged-in user.

**DELETE /push-subscription/remove** `endpoint`

Deletes a subscription. Used when a visitor unsubscribes and when an admin removes a subscriber.

### Fetch subscribers

**GET /push-subscribers/fetch** `endpoint`

Returns the paginated subscriber list shown on the overview page, with country, operating system, browser, and subscription date.

### Send a notification

**POST /push-subscribers/send** `endpoint`

Sends a notification. Takes a single `notificationData` object. The free version ignores the audience fields and sends manual notifications to your 20 most recent subscribers whose endpoints are on an allowlisted push service. Pro sends to all subscribers matching the chosen audience, and can schedule delivery, which then runs in the background.

**notificationData fields**

**notificationTitle** `string`

The notification title.

**notificationMessage** `string`

The body text.

**notificationImage** `integer`

Attachment ID of a large image to display.

**notificationUrl** `string`

Where the notification opens when selected.

**notificationPersistent** `string`

`on` keeps the notification on screen until the visitor dismisses it.

**notificationVibration** `string`

`on` vibrates the device on arrival.

**notificationActionButtons** `array`

Pro. Up to two objects of `{ text, url }`, rendered as buttons on the notification.

**notificationAudience** `string`

Pro. `everyone`, `logged_in`, `logged_out`, or `role`. Defaults to `everyone`. `role` also requires `notificationRole`. On Pro, `everyone` is all subscribers before the device, operating system, and country filters. The free version ignores this field.

**notificationRole** `string`

Pro. WordPress role slug. Required when `notificationAudience` is `role`, and it must be a role that exists on the site.

**notificationDevice** `string`

Pro. `Smartphone`, `Tablet`, or `Desktop`. Omit it to include every device.

**notificationOs** `string`

Pro. `Android`, `iOS`, `Windows`, `Mac`, `Linux`, or `Chrome OS`. The server also accepts `Ubuntu` and `FreeBSD`. Omit it to include every operating system.

**notificationCountry** `string`

Pro. Free text, up to 100 characters. Omit it to include every country.

**notificationSchedule** `string`

Pro. `now` or `later`. Defaults to `now`.

**notificationScheduleAt** `string`

Pro. Date and time when `notificationSchedule` is `later`, interpreted in the site timezone. It has to be in the future.

```bash theme={null}
curl -X POST https://example.com/wp-json/progressify/v1/push-subscribers/send \
  -H "X-WP-Nonce: $NONCE" \
  -H "Content-Type: application/json" \
  --cookie "$COOKIE_JAR" \
  -d '{
        "notificationData": {
          "notificationTitle": "Spring sale is live",
          "notificationMessage": "20% off everything until Sunday.",
          "notificationUrl": "https://example.com/sale/"
        }
      }'
```

Delivery is chunked according to the **Batch Size** setting. With Pro, delivery runs in the background, and the sent and failed counts show under the subscriber list.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.