Raw HTTP Request
Forward a raw HTTP request to an actor's onRequest handler. The method, headers, body, and the path after /request/ are passed through unchanged.
Use this when an actor exposes its own HTTP routes, streams responses (for example Server-Sent Events), or needs to accept non-JSON payloads. The response is whatever the actor’s onRequest handler returns.
ANY https://api.rivet.dev/gateway/{actor}/request/{path}
Accepts GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS.
Examples
curl -X POST "https://api.rivet.dev/gateway/counter/request/increment?rvt-namespace=$RIVET_NAMESPACE&rvt-method=getOrCreate&rvt-key=my-counter&rvt-pool=default" \
-H "x-rivet-token: $RIVET_TOKEN"
import { createClient } from "rivetkit/client";
import type { registry } from "./index";
const client = createClient<typeof registry>(process.env.RIVET_ENDPOINT);
const counter = client.counter.getOrCreate(["my-counter"]);
// .fetch() sends the request to the actor's onRequest handler. It accepts
// the same arguments as the global fetch and returns a standard Response.
const response = await counter.fetch("/increment", { method: "POST" });
const data = await response.json();
console.log(data); // { count: 1 }
Authentication
Send a token in the x-rivet-token header, inline in the path as {actor_id}@{token}, or in the rvt-token query parameter. Use a public token (pk_) from browsers and a secret token (sk_) from trusted backends. See Authentication.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
actor | string | Yes | Actor ID, actor ID with an inline token ({actor_id}@{token}), or actor name combined with the rvt-* query parameters. |
path | string | Yes | Path forwarded to the actor. The actor sees a request whose URL path is /{path}. |
Actor Selector
{actor} accepts an actor ID, an actor ID with an inline routing token ({actor_id}@{token}), or an actor name combined with the rvt-* query parameters below. See Actor Routing for the full rules.
Responses
200
The response returned by the actor’s onRequest handler.