Skip to main content

Outbox Endpoint

The outbox lists an actor's published activities.

Reading (GET)

GET /users/{username}/outbox

Response

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "OrderedCollection",
"id": "https://example.com/users/alice/outbox",
"totalItems": 150,
"first": "https://example.com/users/alice/outbox?page=true"
}

Paginated Page

{
"type": "OrderedCollectionPage",
"orderedItems": [
{ "type": "Create", "object": { "type": "Note" } }
],
"next": "https://example.com/users/alice/outbox?page=2"
}

Writing (POST) - Client-to-Server

POST /users/{username}/outbox
Authorization: Bearer {token}

Used by clients to publish activities.

Implementation

app.get('/users/:username/outbox', async (req, res) => {
const activities = await getActivities(req.params.username);

res.json({
"@context": "https://www.w3.org/ns/activitystreams",
"type": "OrderedCollection",
"totalItems": activities.length,
"orderedItems": activities
});
});

See Also