Mark notifications read

.md

Some of them, or all of them.

Scopesnotifications:write
POST/v1/me/notifications/read

One call for both, because "mark all read" is what somebody does after glancing at a badge and it should not cost a round trip per row.

Request

curl -X POST https://api.proppertrading.com/v1/me/notifications/read \
  -H "Authorization: Bearer ptat_9f2c1a44_3b8e7d2f5c9a1b4e6d8f0a2c4e6b8d1f" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 8e0f1a23-4b5c-4d6e-7f80-91a2b3c4d5e6" \
  -d '{"ids": ["9f2c1a44-3b8e-4d2f-5c9a-1b4e6d8f0a2c"]}'
FieldTypeDescription
idsarrayUp to 200 notification ids
allbooleanMark everything unread as read. Ignores ids

Send one or the other. Neither is nothing_to_mark, rather than a call that quietly does nothing.

Response

{
    "data": { "object": "notifications_read", "marked": 1, "unread": 0 },
    "meta": { "request_id": "req_01kz4bkr1aj1gv63d8fv3133ey" }
}

unread is the count afterwards, so a badge can be set from the same response.

Errors

StatusCodeMeaning
400missing_idempotency_keyEvery POST needs one
400nothing_to_markNeither ids nor all was sent
403insufficient_scopeThis device does not hold notifications:write
422validation_failedAn id is not a uuid, or there are more than 200