{
  "info": {
    "name": "USA Job Alerts API",
    "_postman_id": "8f2c4d16-0a3b-4e57-9c81-6d5a2b7e4f30",
    "description": "# USA Job Alerts API\n\nLaravel 10 backend for the iOS job alerts app.\n\n## How to use this collection\n\n1. Run **0. Unauthenticated probe** · a 401 means the deployment is healthy.\n2. Run **1. Register device** · it saves `apiToken` into the collection variables automatically.\n3. Everything else authenticates on its own from there. Requests 3 to 8 run top to bottom as a sequence: create an alert, then update, toggle, mark seen and delete it.\n\n## Authentication\n\nThere are no user accounts. An alert belongs to a device install.\n\nRegistration issues a random 64-character token; every other route carries it as `Authorization: Bearer <token>`. The server stores only the SHA-256 hash, so a database dump cannot be used to impersonate a device. The plaintext is returned once, at registration, and is not retrievable afterwards.\n\nLookup is by token hash alone, never by device id plus token · that would let a caller mix one device's id with another's token.\n\n## Conventions\n\n- All request and response bodies are JSON, camelCase.\n- `POST` is used instead of `PATCH` for partial actions, because some hosting stacks reject PATCH before it reaches PHP.\n- An alert is addressed by **(deviceId, alertId)**. The alertId is in the path; the device always comes from the bearer token, never from the body. The row's own `id` is returned but is not used to address anything.\n- A body `deviceId` is optional and is only CHECKED against the token. A mismatch is **403**.\n- An alertId you do not own returns **404**, never 403.\n- Validation failures return **422** with a Laravel `errors` object.\n- The `api` group is rate limited to 60 requests per minute per IP; device registration to 20 per minute.\n\n## Base URL\n\n`https://usajobalert.gremacorp.com/public`\n\nThe `/public` segment means the web server's document root is the project root rather than `public/`. See the note in the `baseUrl` variable.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{apiToken}}",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Fail loudly rather than sending a request that cannot possibly work.",
          "const needsToken = !['0. Unauthenticated probe (expect 401)',",
          "                     '1. Register device'].includes(pm.info.requestName);",
          "",
          "if (needsToken && !pm.collectionVariables.get('apiToken')) {",
          "    console.log('No apiToken yet. Run \"1. Register device\" first.');",
          "}"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Applies to every request in the collection.",
          "pm.test('responds with JSON, not an HTML error page', function () {",
          "    if (pm.response.code === 204) return;   // 204 has no body",
          "    pm.expect(pm.response.headers.get('Content-Type') || '')",
          "      .to.include('json');",
          "});"
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://usajobalert.gremacorp.com/public",
      "type": "string",
      "description": "No trailing slash. The `/public` segment is only needed because the document root points at the project root. Pointing it at `public/` instead would make this `https://usajobalert.gremacorp.com` and would stop .env, storage/ and vendor/ being reachable over the web."
    },
    {
      "key": "deviceId",
      "value": "POSTMAN-TEST-DEVICE-001",
      "type": "string",
      "description": "The app sends identifierForVendor here. Any unique string works for testing."
    },
    {
      "key": "apiToken",
      "value": "",
      "type": "string",
      "description": "Filled in automatically by 1. Register device. Do not commit a real one."
    },
    {
      "key": "alertId",
      "value": "",
      "type": "string",
      "description": "Filled in automatically by 4. Create alert."
    },
    {
      "key": "alertId",
      "value": "",
      "type": "string",
      "description": "The app's own id for the alert. Half of the (deviceId, alertId) identity. Generated automatically when empty."
    }
  ],
  "item": [
    {
      "name": "Diagnostics",
      "description": "Run this before anything else to confirm the deployment is alive.",
      "item": [
        {
          "name": "0. Unauthenticated probe (expect 401)",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('401 Unauthorized · routing and auth are live', function () {",
                  "    pm.response.to.have.status(401);",
                  "});",
                  "",
                  "pm.test('response is JSON, not an HTML error page', function () {",
                  "    pm.response.to.be.json;",
                  "});",
                  "",
                  "if (pm.response.code === 404) {",
                  "    console.log('404: routes are not loading, or baseUrl is wrong.');",
                  "} else if (pm.response.code === 200) {",
                  "    console.log('200: auth middleware is NOT applied. Security bug.');",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/alerts",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "alerts"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Deployment smoke test. Run this FIRST, before anything else.\n\nA 401 with the JSON body below is the healthy answer · it proves routing, the middleware stack and device auth are all live.\n\nAnything else tells you what is broken:\n  404 HTML  · routes are not loading, or the base URL is wrong\n  500       · check storage/logs/laravel.log on the server\n  200       · the auth middleware is not applied, which is a security bug"
          },
          "response": [
            {
              "name": "401 Unauthorized",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/api/alerts",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Deployment smoke test. Run this FIRST, before anything else.\n\nA 401 with the JSON body below is the healthy answer · it proves routing, the middleware stack and device auth are all live.\n\nAnything else tells you what is broken:\n  404 HTML  · routes are not loading, or the base URL is wrong\n  500       · check storage/logs/laravel.log on the server\n  200       · the auth middleware is not applied, which is a security bug"
              },
              "status": "Unauthorized",
              "code": 401,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"message\": \"Device token missing. Register the device first.\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Device",
      "description": "Registration and FCM token upkeep.",
      "item": [
        {
          "name": "1. Register device",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const ok = pm.response.code === 201;",
                  "",
                  "pm.test('201 Created', function () {",
                  "    pm.response.to.have.status(201);",
                  "});",
                  "",
                  "if (ok) {",
                  "    const d = pm.response.json().data;",
                  "    pm.collectionVariables.set('apiToken', d.apiToken);",
                  "    pm.collectionVariables.set('deviceId', d.deviceId);",
                  "    console.log('Saved apiToken for device ' + d.deviceId);",
                  "",
                  "    pm.test('apiToken returned', function () {",
                  "        pm.expect(d.apiToken).to.be.a('string').and.have.lengthOf(64);",
                  "    });",
                  "} else {",
                  "    console.log('Register failed, apiToken not saved. Body: ' + pm.response.text());",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"fcmToken\": \"REPLACE_WITH_FCM_REGISTRATION_TOKEN\",\n  \"platform\": \"ios\",\n  \"appVersion\": \"1.0.0\",\n  \"timezone\": \"America/New_York\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/devices/register",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "devices",
                "register"
              ]
            },
            "description": "Issues this install its bearer token. The ONLY unauthenticated route.\n\nRe-registering the same `deviceId` returns a NEW token and invalidates the old one, which is correct on a reinstall.\n\n`apiToken` is returned once and never again · only its SHA-256 hash is stored server side. The app keeps it in the Keychain.\n\nRate limited to 20 requests per minute per IP, because it is public and creates rows.\n\nThe test script saves `apiToken` into the collection variable, so every other request in this collection authenticates automatically once you have run this one.",
            "auth": {
              "type": "noauth"
            }
          },
          "response": [
            {
              "name": "201 Created",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"fcmToken\": \"REPLACE_WITH_FCM_REGISTRATION_TOKEN\",\n  \"platform\": \"ios\",\n  \"appVersion\": \"1.0.0\",\n  \"timezone\": \"America/New_York\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/devices/register",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "devices",
                    "register"
                  ]
                },
                "description": "Issues this install its bearer token. The ONLY unauthenticated route.\n\nRe-registering the same `deviceId` returns a NEW token and invalidates the old one, which is correct on a reinstall.\n\n`apiToken` is returned once and never again · only its SHA-256 hash is stored server side. The app keeps it in the Keychain.\n\nRate limited to 20 requests per minute per IP, because it is public and creates rows.\n\nThe test script saves `apiToken` into the collection variable, so every other request in this collection authenticates automatically once you have run this one."
              },
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"data\": {\n    \"deviceId\": \"POSTMAN-TEST-DEVICE-001\",\n    \"apiToken\": \"3f9a1c...64 hex characters, shown once...e7b2\",\n    \"pushEnabled\": true\n  }\n}"
            },
            {
              "name": "422 Validation failed",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"fcmToken\": \"REPLACE_WITH_FCM_REGISTRATION_TOKEN\",\n  \"platform\": \"ios\",\n  \"appVersion\": \"1.0.0\",\n  \"timezone\": \"America/New_York\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/devices/register",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "devices",
                    "register"
                  ]
                },
                "description": "Issues this install its bearer token. The ONLY unauthenticated route.\n\nRe-registering the same `deviceId` returns a NEW token and invalidates the old one, which is correct on a reinstall.\n\n`apiToken` is returned once and never again · only its SHA-256 hash is stored server side. The app keeps it in the Keychain.\n\nRate limited to 20 requests per minute per IP, because it is public and creates rows.\n\nThe test script saves `apiToken` into the collection variable, so every other request in this collection authenticates automatically once you have run this one."
              },
              "status": "Unprocessable Content",
              "code": 422,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"message\": \"The device id field is required.\",\n  \"errors\": {\n    \"deviceId\": [\n      \"The device id field is required.\"\n    ]\n  }\n}"
            }
          ]
        },
        {
          "name": "2. Update FCM token",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', function () { pm.response.to.have.status(200); });"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"fcmToken\": \"REPLACE_WITH_NEW_FCM_REGISTRATION_TOKEN\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/devices/token",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "devices",
                "token"
              ]
            },
            "description": "Updates the FCM registration token for an already-registered device.\n\nSeparate from register so a Firebase token refresh does not rotate the API token and force the app to re-store it.\n\nA fresh token also clears `push_disabled_at`, so a device FCM previously rejected starts receiving pushes again."
          },
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"fcmToken\": \"REPLACE_WITH_NEW_FCM_REGISTRATION_TOKEN\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/devices/token",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "devices",
                    "token"
                  ]
                },
                "description": "Updates the FCM registration token for an already-registered device.\n\nSeparate from register so a Firebase token refresh does not rotate the API token and force the app to re-store it.\n\nA fresh token also clears `push_disabled_at`, so a device FCM previously rejected starts receiving pushes again."
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"data\": {\n    \"pushEnabled\": true\n  }\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Alerts",
      "description": "CRUD for the authenticated device's saved job alerts. Run in order.",
      "item": [
        {
          "name": "3. List alerts",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', function () { pm.response.to.have.status(200); });",
                  "",
                  "if (pm.response.code === 200) {",
                  "    const rows = pm.response.json().data;",
                  "    pm.test('data is an array', function () {",
                  "        pm.expect(rows).to.be.an('array');",
                  "    });",
                  "    if (rows.length && !pm.collectionVariables.get('alertId')) {",
                  "        pm.collectionVariables.set('alertId', rows[0].alertId);",
                  "    }",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/alerts",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "alerts"
              ]
            },
            "description": "Every alert belonging to the authenticated device, newest first.\n\n`newJobIDs` holds only the unread USAJOBS ids · the full known-id list can run to hundreds per alert and the app has no use for it now that diffing happens server side."
          },
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/api/alerts",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts"
                  ]
                },
                "description": "Every alert belonging to the authenticated device, newest first.\n\n`newJobIDs` holds only the unread USAJOBS ids · the full known-id list can run to hundreds per alert and the app has no use for it now that diffing happens server side."
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"data\": [\n    {\n      \"id\": \"12\",\n      \"deviceId\": \"POSTMAN-TEST-DEVICE-001\",\n      \"alertId\": \"0b6f5f4e-9a7c-4d33-9a1e-2f7c8e5a1b90\",\n      \"name\": \"Remote IT jobs\",\n      \"keyword\": \"software engineer\",\n      \"hiringPath\": \"public\",\n      \"scheduleCode\": \"1\",\n      \"remoteOnly\": true,\n      \"categoryCode\": \"2210\",\n      \"categoryName\": \"Information Technology Management\",\n      \"isEnabled\": true,\n      \"lastCheckedDate\": \"2026-08-01T14:05:00+00:00\",\n      \"lastNotifiedDate\": \"2026-08-01T14:05:00+00:00\",\n      \"newJobCount\": 2,\n      \"newJobIDs\": [\n        \"812345600\",\n        \"812345601\"\n      ],\n      \"createdAt\": \"2026-07-28T09:12:44+00:00\"\n    }\n  ]\n}"
            },
            {
              "name": "401 No token",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/api/alerts",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts"
                  ]
                },
                "description": "Every alert belonging to the authenticated device, newest first.\n\n`newJobIDs` holds only the unread USAJOBS ids · the full known-id list can run to hundreds per alert and the app has no use for it now that diffing happens server side."
              },
              "status": "Unauthorized",
              "code": 401,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"message\": \"Device token missing. Register the device first.\"\n}"
            }
          ]
        },
        {
          "name": "4. Create alert",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (!pm.collectionVariables.get('alertId')) {",
                  "    pm.collectionVariables.set('alertId', pm.variables.replaceIn('{{$guid}}'));",
                  "}"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created or 200 updated', function () {",
                  "    pm.expect(pm.response.code).to.be.oneOf([200, 201]);",
                  "});",
                  "",
                  "if ([200, 201].includes(pm.response.code)) {",
                  "    const a = pm.response.json().data;",
                  "    pm.collectionVariables.set('alertId', a.alertId);",
                  "    console.log('Saved alertId ' + a.alertId + ' (row id ' + a.id + ')');",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"alertId\": \"{{alertId}}\",\n  \"name\": \"Remote IT jobs\",\n  \"keyword\": \"software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/alerts",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "alerts"
              ]
            },
            "description": "Creates an alert, or updates the existing one with the same `alertId`.\n\n`alertId` is the app's own id for the alert · any string up to 64 characters. Matching on it means a request that succeeded but whose response was lost can be retried safely without producing a duplicate · you get 201 the first time and 200 on a retry.\n\n`deviceId` is optional and is only ever CHECKED against the bearer token, never used to look a device up. Sending someone else's deviceId returns 403, not their alerts.\n\nAT LEAST ONE criterion is required: `keyword`, `categoryCode`, `hiringPath`, `scheduleCode`, or `remoteOnly` set to true. An alert with no criteria would match the entire job board and notify constantly. The error deliberately lands on `name` so it shows on the form.\n\nMaximum 25 alerts per device.\n\nThe pre-request script generates a fresh `alertId` only when the variable is empty, so re-sending this request exercises the retry path rather than creating a second alert. Clear the `alertId` collection variable to make a genuinely new alert."
          },
          "response": [
            {
              "name": "201 Created",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"alertId\": \"{{alertId}}\",\n  \"name\": \"Remote IT jobs\",\n  \"keyword\": \"software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/alerts",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts"
                  ]
                },
                "description": "Creates an alert, or updates the existing one with the same `alertId`.\n\n`alertId` is the app's own id for the alert · any string up to 64 characters. Matching on it means a request that succeeded but whose response was lost can be retried safely without producing a duplicate · you get 201 the first time and 200 on a retry.\n\n`deviceId` is optional and is only ever CHECKED against the bearer token, never used to look a device up. Sending someone else's deviceId returns 403, not their alerts.\n\nAT LEAST ONE criterion is required: `keyword`, `categoryCode`, `hiringPath`, `scheduleCode`, or `remoteOnly` set to true. An alert with no criteria would match the entire job board and notify constantly. The error deliberately lands on `name` so it shows on the form.\n\nMaximum 25 alerts per device.\n\nThe pre-request script generates a fresh `alertId` only when the variable is empty, so re-sending this request exercises the retry path rather than creating a second alert. Clear the `alertId` collection variable to make a genuinely new alert."
              },
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"data\": {\n    \"id\": \"12\",\n    \"deviceId\": \"POSTMAN-TEST-DEVICE-001\",\n    \"alertId\": \"0b6f5f4e-9a7c-4d33-9a1e-2f7c8e5a1b90\",\n    \"name\": \"Remote IT jobs\",\n    \"keyword\": \"software engineer\",\n    \"hiringPath\": \"public\",\n    \"scheduleCode\": \"1\",\n    \"remoteOnly\": true,\n    \"categoryCode\": \"2210\",\n    \"categoryName\": \"Information Technology Management\",\n    \"isEnabled\": true,\n    \"lastCheckedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"lastNotifiedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"newJobCount\": 2,\n    \"newJobIDs\": [\n      \"812345600\",\n      \"812345601\"\n    ],\n    \"createdAt\": \"2026-07-28T09:12:44+00:00\"\n  }\n}"
            },
            {
              "name": "422 No criteria",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"alertId\": \"{{alertId}}\",\n  \"name\": \"Remote IT jobs\",\n  \"keyword\": \"software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/alerts",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts"
                  ]
                },
                "description": "Creates an alert, or updates the existing one with the same `alertId`.\n\n`alertId` is the app's own id for the alert · any string up to 64 characters. Matching on it means a request that succeeded but whose response was lost can be retried safely without producing a duplicate · you get 201 the first time and 200 on a retry.\n\n`deviceId` is optional and is only ever CHECKED against the bearer token, never used to look a device up. Sending someone else's deviceId returns 403, not their alerts.\n\nAT LEAST ONE criterion is required: `keyword`, `categoryCode`, `hiringPath`, `scheduleCode`, or `remoteOnly` set to true. An alert with no criteria would match the entire job board and notify constantly. The error deliberately lands on `name` so it shows on the form.\n\nMaximum 25 alerts per device.\n\nThe pre-request script generates a fresh `alertId` only when the variable is empty, so re-sending this request exercises the retry path rather than creating a second alert. Clear the `alertId` collection variable to make a genuinely new alert."
              },
              "status": "Unprocessable Content",
              "code": 422,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"message\": \"Add at least a keyword, category, hiring path or schedule \\u00b7 an alert with no criteria would match every job.\",\n  \"errors\": {\n    \"name\": [\n      \"Add at least a keyword, category, hiring path or schedule \\u00b7 an alert with no criteria would match every job.\"\n    ]\n  }\n}"
            },
            {
              "name": "422 Alert limit reached",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"alertId\": \"{{alertId}}\",\n  \"name\": \"Remote IT jobs\",\n  \"keyword\": \"software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/alerts",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts"
                  ]
                },
                "description": "Creates an alert, or updates the existing one with the same `alertId`.\n\n`alertId` is the app's own id for the alert · any string up to 64 characters. Matching on it means a request that succeeded but whose response was lost can be retried safely without producing a duplicate · you get 201 the first time and 200 on a retry.\n\n`deviceId` is optional and is only ever CHECKED against the bearer token, never used to look a device up. Sending someone else's deviceId returns 403, not their alerts.\n\nAT LEAST ONE criterion is required: `keyword`, `categoryCode`, `hiringPath`, `scheduleCode`, or `remoteOnly` set to true. An alert with no criteria would match the entire job board and notify constantly. The error deliberately lands on `name` so it shows on the form.\n\nMaximum 25 alerts per device.\n\nThe pre-request script generates a fresh `alertId` only when the variable is empty, so re-sending this request exercises the retry path rather than creating a second alert. Clear the `alertId` collection variable to make a genuinely new alert."
              },
              "status": "Unprocessable Content",
              "code": 422,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"message\": \"You have reached the maximum number of alerts.\"\n}"
            },
            {
              "name": "403 deviceId does not match the token",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"alertId\": \"{{alertId}}\",\n  \"name\": \"Remote IT jobs\",\n  \"keyword\": \"software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/alerts",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts"
                  ]
                },
                "description": "Creates an alert, or updates the existing one with the same `alertId`.\n\n`alertId` is the app's own id for the alert · any string up to 64 characters. Matching on it means a request that succeeded but whose response was lost can be retried safely without producing a duplicate · you get 201 the first time and 200 on a retry.\n\n`deviceId` is optional and is only ever CHECKED against the bearer token, never used to look a device up. Sending someone else's deviceId returns 403, not their alerts.\n\nAT LEAST ONE criterion is required: `keyword`, `categoryCode`, `hiringPath`, `scheduleCode`, or `remoteOnly` set to true. An alert with no criteria would match the entire job board and notify constantly. The error deliberately lands on `name` so it shows on the form.\n\nMaximum 25 alerts per device.\n\nThe pre-request script generates a fresh `alertId` only when the variable is empty, so re-sending this request exercises the retry path rather than creating a second alert. Clear the `alertId` collection variable to make a genuinely new alert."
              },
              "status": "Forbidden",
              "code": 403,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"message\": \"deviceId does not match the authenticated device.\"\n}"
            }
          ]
        },
        {
          "name": "5. Update alert",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', function () { pm.response.to.have.status(200); });"
                ]
              }
            }
          ],
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"name\": \"Remote IT jobs (updated)\",\n  \"keyword\": \"senior software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/alerts/{{alertId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "alerts",
                "{{alertId}}"
              ]
            },
            "description": "Replaces the alert. Send the whole object · any field you omit is written back as null (or false for `remoteOnly`, true for `isEnabled`), it is not left untouched.\n\nThe same at-least-one-criterion rule applies.\n\nThe alert is addressed by `{{alertId}}` in the path, and the device half comes from the bearer token · so an alertId belonging to another device returns 404, not 403. A device has no business learning whether an alert it does not own exists.\n\nAn `alertId` in the body is ignored · the path wins, otherwise an update could silently move the alert to a different id."
          },
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "PUT",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"name\": \"Remote IT jobs (updated)\",\n  \"keyword\": \"senior software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/alerts/{{alertId}}",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts",
                    "{{alertId}}"
                  ]
                },
                "description": "Replaces the alert. Send the whole object · any field you omit is written back as null (or false for `remoteOnly`, true for `isEnabled`), it is not left untouched.\n\nThe same at-least-one-criterion rule applies.\n\nThe alert is addressed by `{{alertId}}` in the path, and the device half comes from the bearer token · so an alertId belonging to another device returns 404, not 403. A device has no business learning whether an alert it does not own exists.\n\nAn `alertId` in the body is ignored · the path wins, otherwise an update could silently move the alert to a different id."
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"data\": {\n    \"id\": \"12\",\n    \"deviceId\": \"POSTMAN-TEST-DEVICE-001\",\n    \"alertId\": \"0b6f5f4e-9a7c-4d33-9a1e-2f7c8e5a1b90\",\n    \"name\": \"Remote IT jobs\",\n    \"keyword\": \"software engineer\",\n    \"hiringPath\": \"public\",\n    \"scheduleCode\": \"1\",\n    \"remoteOnly\": true,\n    \"categoryCode\": \"2210\",\n    \"categoryName\": \"Information Technology Management\",\n    \"isEnabled\": true,\n    \"lastCheckedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"lastNotifiedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"newJobCount\": 2,\n    \"newJobIDs\": [\n      \"812345600\",\n      \"812345601\"\n    ],\n    \"createdAt\": \"2026-07-28T09:12:44+00:00\"\n  }\n}"
            },
            {
              "name": "404 Not yours / not found",
              "originalRequest": {
                "method": "PUT",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"name\": \"Remote IT jobs (updated)\",\n  \"keyword\": \"senior software engineer\",\n  \"hiringPath\": \"public\",\n  \"scheduleCode\": \"1\",\n  \"remoteOnly\": true,\n  \"categoryCode\": \"2210\",\n  \"categoryName\": \"Information Technology Management\",\n  \"isEnabled\": true\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/alerts/{{alertId}}",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts",
                    "{{alertId}}"
                  ]
                },
                "description": "Replaces the alert. Send the whole object · any field you omit is written back as null (or false for `remoteOnly`, true for `isEnabled`), it is not left untouched.\n\nThe same at-least-one-criterion rule applies.\n\nThe alert is addressed by `{{alertId}}` in the path, and the device half comes from the bearer token · so an alertId belonging to another device returns 404, not 403. A device has no business learning whether an alert it does not own exists.\n\nAn `alertId` in the body is ignored · the path wins, otherwise an update could silently move the alert to a different id."
              },
              "status": "Not Found",
              "code": 404,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"message\": \"No alert with that alertId for this device.\"\n}"
            }
          ]
        },
        {
          "name": "6. Enable / disable alert",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', function () { pm.response.to.have.status(200); });"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"isEnabled\": false\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/alerts/{{alertId}}/enabled",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "alerts",
                "{{alertId}}",
                "enabled"
              ]
            },
            "description": "The toggle in the alerts list. Flips the alert on or off without the app having to hold every field.\n\nAddressed by `{{alertId}}`, scoped to the authenticated device.\n\nPOST rather than PATCH throughout this API · some hosting stacks reject PATCH before it reaches PHP."
          },
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"deviceId\": \"{{deviceId}}\",\n  \"isEnabled\": false\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{baseUrl}}/api/alerts/{{alertId}}/enabled",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts",
                    "{{alertId}}",
                    "enabled"
                  ]
                },
                "description": "The toggle in the alerts list. Flips the alert on or off without the app having to hold every field.\n\nAddressed by `{{alertId}}`, scoped to the authenticated device.\n\nPOST rather than PATCH throughout this API · some hosting stacks reject PATCH before it reaches PHP."
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"data\": {\n    \"id\": \"12\",\n    \"deviceId\": \"POSTMAN-TEST-DEVICE-001\",\n    \"alertId\": \"0b6f5f4e-9a7c-4d33-9a1e-2f7c8e5a1b90\",\n    \"name\": \"Remote IT jobs\",\n    \"keyword\": \"software engineer\",\n    \"hiringPath\": \"public\",\n    \"scheduleCode\": \"1\",\n    \"remoteOnly\": true,\n    \"categoryCode\": \"2210\",\n    \"categoryName\": \"Information Technology Management\",\n    \"isEnabled\": false,\n    \"lastCheckedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"lastNotifiedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"newJobCount\": 2,\n    \"newJobIDs\": [\n      \"812345600\",\n      \"812345601\"\n    ],\n    \"createdAt\": \"2026-07-28T09:12:44+00:00\"\n  }\n}"
            }
          ]
        },
        {
          "name": "7. Mark alert seen",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', function () { pm.response.to.have.status(200); });",
                  "",
                  "if (pm.response.code === 200) {",
                  "    pm.test('badge cleared', function () {",
                  "        pm.expect(pm.response.json().data.newJobCount).to.eql(0);",
                  "    });",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/alerts/{{alertId}}/seen",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "alerts",
                "{{alertId}}",
                "seen"
              ]
            },
            "description": "Clears the unread badge · call this when the results screen is opened.\n\nAddressed by `{{alertId}}`, scoped to the authenticated device.\n\nOnly the `is_new` flag is cleared. The seen rows themselves stay, because deleting them would make every one of those jobs look new again on the next run.\n\nNo request body."
          },
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/api/alerts/{{alertId}}/seen",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts",
                    "{{alertId}}",
                    "seen"
                  ]
                },
                "description": "Clears the unread badge · call this when the results screen is opened.\n\nAddressed by `{{alertId}}`, scoped to the authenticated device.\n\nOnly the `is_new` flag is cleared. The seen rows themselves stay, because deleting them would make every one of those jobs look new again on the next run.\n\nNo request body."
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"data\": {\n    \"id\": \"12\",\n    \"deviceId\": \"POSTMAN-TEST-DEVICE-001\",\n    \"alertId\": \"0b6f5f4e-9a7c-4d33-9a1e-2f7c8e5a1b90\",\n    \"name\": \"Remote IT jobs\",\n    \"keyword\": \"software engineer\",\n    \"hiringPath\": \"public\",\n    \"scheduleCode\": \"1\",\n    \"remoteOnly\": true,\n    \"categoryCode\": \"2210\",\n    \"categoryName\": \"Information Technology Management\",\n    \"isEnabled\": true,\n    \"lastCheckedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"lastNotifiedDate\": \"2026-08-01T14:05:00+00:00\",\n    \"newJobCount\": 0,\n    \"newJobIDs\": [],\n    \"createdAt\": \"2026-07-28T09:12:44+00:00\"\n  }\n}"
            }
          ]
        },
        {
          "name": "8. Delete alert",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('204 No Content', function () { pm.response.to.have.status(204); });",
                  "",
                  "if (pm.response.code === 204) {",
                  "    pm.collectionVariables.set('alertId', '');",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/alerts/{{alertId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "alerts",
                "{{alertId}}"
              ]
            },
            "description": "Deletes the alert and its seen-job rows. Returns 204 with an empty body.\n\nIdentified by (device, alertId): `{{alertId}}` from the path, the device from the bearer token. The row's own `id` is never used.\n\nUnknown alertId, or one belonging to another device, returns 404."
          },
          "response": [
            {
              "name": "204 No Content",
              "originalRequest": {
                "method": "DELETE",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/api/alerts/{{alertId}}",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "api",
                    "alerts",
                    "{{alertId}}"
                  ]
                },
                "description": "Deletes the alert and its seen-job rows. Returns 204 with an empty body.\n\nIdentified by (device, alertId): `{{alertId}}` from the path, the device from the bearer token. The row's own `id` is never used.\n\nUnknown alertId, or one belonging to another device, returns 404."
              },
              "status": "No Content",
              "code": 204,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": ""
            }
          ]
        }
      ]
    }
  ]
}
