Mark notifications read - Spacefast Docs

Mark notifications read

Stamps readAt on the signed-in user’s unread notifications and returns how many rows changed. Send either ids or all, never both and never neither. Notifications that were already read are left alone and are not counted.

POST /v1/notifications/read

Authorization

Authorization Bearer token · header required

Authorization: Bearer <token>

With an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).

Request body

required application/json

ids string[]

Up to 100 notification IDs to mark read. Send this or all, never both.

all boolean

Set to mark every unread notification read. Send this or ids, never both.

Responses

200 Response for status 200

{
  "$schema": "http://example.com",
  "data": {
    "updated": 9007199254740991
  }
}

Error Responses

{
  "$schema": "http://example.com",
  "type": "string",
  "title": "string",
  "status": -9007199254740991,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": ["string"],
  "next": ["string"],
  "requestId": "string"
}

Try it

Server

Base URL: https://api.spacefast.com

Curl Example

curl -X POST "https://api.spacefast.com/v1/notifications/read" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{\n  "ids": [\n    "string"\n  ],\n  "all": true\n}'

JavaScript Example

const response = await fetch("https://api.spacefast.com/v1/notifications/read", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\n  \"ids\": [\n    \"string\"\n  ],\n  \"all\": true\n}"
});

Python Example

import requests

response = requests.post(
    "https://api.spacefast.com/v1/notifications/read",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\n  \"ids\": [\n    \"string\"\n  ],\n  \"all\": true\n}",
)