TriportRPC

Get mempool firehose connection info

GEThttps://api.triport.io/v1/polygon/firehose/mempool/connect-info

Issues a short-lived, signed WSS URL and token for subscribing to the Polygon pending-transaction (mempool) firehose.

Polygonbusiness tier (highest); RPS-per-tier with burst (×2 multiplier) — no daily cap

This endpoint does not stream data itself. It returns a PolyWsConnectInfo object — an already-signed wss:// URL plus a short-lived auth token — that you use to open the actual mempool firehose WebSocket. The token is included as the first frame you send on the new connection, and it expires at expires_at, so call this endpoint immediately before connecting and refresh whenever a connection drops or the token nears expiry.

The mempool firehose delivers Polygon pending transactions as they enter the node mempool, before they are mined into a block. A single connection sees a baseline throughput of roughly 32–37 tx/s. Use it for mempool monitoring, pre-confirmation transaction tracking, MEV/orderflow analysis, and front-running detection dashboards.

The firehose is the highest-tier Polygon product surface and requires the business tier. Callers on a lower tier receive 403 tier_insufficient. Once connected, the WebSocket enforces the same auth and rate-limit rules and signals violations through the documented close codes.

For the WebSocket protocol itself — frame format, subscription messages, and keep-alive — see the firehose channel reference at /ws/polygon-bor-firehose.

Parameters

This endpoint takes no path, query, or body parameters. Authentication is the only required input.

Authorizationheaderrequired
Bearer $TRIPORT_API_KEY. Alternatively X-API-Key: $TRIPORT_API_KEY, or the legacy ?api-key= query parameter.

Response

Response fields

FieldTypeDescription
urlstring (uri)Already-signed wss:// URL. Open a WebSocket connection directly to this value.
tokenstringShort-lived auth token. Send it as the first frame on the opened WebSocket.
expires_atstring (date-time)RFC 3339 timestamp after which url/token are no longer valid. Re-request before this time.
close_codesobjectReference map of WebSocket close codes this firehose uses to signal errors after the connection is open (see below).
close_codes.unauthorizedinteger4001 — token missing, invalid, or expired.
close_codes.forbiddeninteger4003 — tier insufficient for this firehose.
close_codes.rate_limitedinteger4029 — sustained message/connection rate exceeded.
close_codes.trial_expiredinteger4030 — free trial period ended.

Only url and expires_at are guaranteed present; token and close_codes are included on success.

Errors

CodeerrorWhen it happens
401unauthorized, trial_expired, subscription_expiredMissing/invalid credentials, or the trial/subscription period has ended.
403tier_insufficientThe API key's tier is below business. The response includes current_tier, required_tier, and upgrade_url; the X-Required-Tier header is also set.
429rate_limitedSustained RPS for this category exceeded. The response includes retry_after_sec, limit_rps, and current_tier; Retry-After and X-RateLimit-* headers accompany it.

All error bodies use the shared envelope (error, message, request_id). See errors.md for the full schema and per-code fields.

Examples

JavaScript (fetch)

const res = await fetch(
  "https://api.triport.io/v1/polygon/firehose/mempool/connect-info",
  { headers: { Authorization: `Bearer ${process.env.TRIPORT_API_KEY}` } }
);
if (!res.ok) throw new Error(`connect-info failed: ${res.status}`);
const info = await res.json();


const ws = new WebSocket(info.url);
ws.onopen = () => ws.send(info.token); // token as the first frame
ws.onmessage = (ev) => {
  const pendingTx = JSON.parse(ev.data);
  console.log("pending tx:", pendingTx.hash);
};
ws.onclose = (ev) => {
  if (ev.code === info.close_codes.unauthorized) {
    // token expired — re-request connect-info and reconnect
  }
};

TypeScript SDK (@triport/sdk)

import { Triport } from "@triport/sdk";


const client = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });


const info = await client.polygon.firehose.mempool.connectInfo();
const stream = await client.polygon.firehose.mempool.connect(info);


for await (const tx of stream) {
  console.log("pending tx:", tx.hash);
}

Python (triport-sdk)

import os
from triport import Triport


client = Triport(api_key=os.environ["TRIPORT_API_KEY"])


info = client.polygon.firehose.mempool.connect_info()
with client.polygon.firehose.mempool.connect(info) as stream:
    for tx in stream:
        print("pending tx:", tx["hash"])

Notes

  • Stateless, short-lived credentials. url and token expire at expires_at. Always fetch fresh connect-info right before opening a socket; do not cache it across reconnects.
  • Throughput. Expect ~32–37 tx/s on a single connection. Pending transactions are not yet mined and may never be — handle drops/replacements on the consumer side.
  • No daily cap. Rate limiting is RPS-per-tier with a burst multiplier; there is no daily quota.
  • Related: the logs firehose connect-info at /v1/polygon/firehose/logs/connect-info (pro tier), and the live WebSocket channel /ws/polygon-bor-firehose.