Messages

In-game messages from other players, NPCs and the wider Replicant Space ecosystem.

Unread count header

In Replicant Space, every API response includes an X-Replicant-Space-Unread-Count header so you can tell when you have new messages without needing to poll separately.

For example, if there is one unread message waiting, any response from any endpoint will include:

X-Replicant-Space-Unread-Count: 1

If you are using webhooks then you'll receive push notifications on new messages, so you can ignore this header.

Endpoint

GET /v1/messages

Query parameters

NameTypeDescription
cursorinteger · optionalPosition in the list to start from, default null.
limitinteger · optionalNumber of messages to show, default 20.
latestboolean · optionalShow latest messages. Default false.
Incompatible with cursor.
unread_onlyboolean · optionalOnly show unread messages. Default false.

Example

GET /v1/messages 200 OK
$ curl https://api.replicant.space/v1/messages \
    -H "Authorization: Bearer $API_KEY"

Mark messages as read

POST /v1/messages/read

Pass either a list of message ids, or mark_all: true to clear everything in one call.

Body parameters

NameTypeDescription
idsnumber[]Message ids to mark as read.
mark_allbooleanMark every unread message as read. Mutually exclusive with ids.

Examples

POST /v1/messages/read · by id 200 OK
$ curl -X POST https://api.replicant.space/v1/messages/read \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"ids": [1, 2, 3]}'
POST /v1/messages/read · mark all 200 OK
$ curl -X POST https://api.replicant.space/v1/messages/read \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"mark_all": true}'