/Feed

Overview

The /feed endpoint retrieves a feed of events from authors that a specified user follows. It returns an array of events along with the profiles of the authors involved.

Endpoint Details

  • URL: /feed

  • Method: GET

  • Auth Required: No

  • Permissions Required: None

Request Parameters

ParameterDescriptionRequired

pubkey

The public key of the user whose feed is being requested.

Yes

limit

The maximum number of events to return. Defaults to 20 if not provided.

No

kinds

Comma-separated list of event kinds to filter by. Defaults to all kinds if not provided.

No

until

Unix timestamp in seconds. If provided, fetch only events that were created before this time.

No

Response Schema

The response is a JSON object with the following structure:

{
  "pubkey": "requesting_user_pubkey",
  "events": [
    {
      "id": "event_id",
      "pubkey": "author_pubkey",
      "created_at": 1234567890,
      "kind": 1,
      "tags": [],
      "content": "Event content",
      "sig": "event_signature"
    }
  ],
  "profiles": {
    "author_pubkey": {
      "id": "profile_event_id",
      "pubkey": "author_pubkey",
      "created_at": 1234567890,
      "kind": 0,
      "tags": [],
      "content": "Profile content",
      "sig": "profile_signature"
    }
  }
}
  • pubkey: The public key of the user requesting the feed.

  • events: An array of events from authors the user follows, sorted by creation time in descending order.

  • profiles: A map of author profiles for all events in the feed, keyed by pubkey.

Example Call

curl -X GET "https://huddlers-ovduv.ondigitalocean.app/feed?pubkey=82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2&limit=5&kinds=1,6"

Notes

  • Events are sorted by creation time, with the most recent events first.

  • To fetch the preceding batch of events in a feed, you can apply the until query parameter. Set its value to the created_at timestamp of the last event in the preceding batch.

Error Responses

  • 400 Bad Request: If any of the parameters are invalid.

  • 404 Not Found: If the user's follow list cannot be found.

  • 500 Internal Server Error: If there's an issue processing the request.

Last updated