Skip to main content
Snapchain nodes serve a HTTP API on port 3381 by default.

Using the API

The API can be called from any programming language or browser by making a normal HTTP request. View the API responses in a browser Simply open the URL in a browser
Call the API using curl
Call the API via Javascript, using the axios library

Response encoding

Responses from the API are encoded as application/json, and can be parsed as normal JSON objects.
  1. Hashes, ETH addresses, keys etc… are all encoded as hex strings starting with 0x
  2. Signatures and other binary fields are encoded in base64
  3. Constants are encoded as their string types. For example, the hashScheme is encoded as HASH_SCHEME_BLAKE3 which is equivalent to the HASH_SCHEME_BLAKE3 = 1 from the protobuf schema.

Timestamps

Messages contain timestamps which are seconds since the Farcaster Epoch, which began on Jan 1, 2021 00:00:00 UTC.

Paging

Most endpoints support paging to get a large number of responses. Pagination Query Parameters The returned nextPageToken is empty if there are no more pages to return. Pagination query parameters can be combined with other query parameters supported by the endpoint. For example, /v1/casts?fid=2&pageSize=3. Example Fetch all casts by FID 2, fetching upto 3 casts per Page
Javascript Example

Timestamp Filtering

Some endpoints support filtering by timestamp, allowing you to retrieve results within a specific time range: Example:

Handling Errors

If there’s an API error, the HTTP status code is set to 400 or 500 as appropriate. The response is a JSON object with detail, errCode and metadata fields set to identify and debug the errors. Example

Limitations

The HTTP API currently does not support any of the Sync APIs that are available in the gRPC version. When nodes sync with each other, they will use the gRPC APIs instead of the HTTP APIs.