Skip to main content
Call Actors

Call Action

Invoke an action defined on an actor and return its result. This is the HTTP equivalent of calling a method on an actor handle in the RivetKit client.

Arguments are passed as a JSON array in args and spread into the action’s parameters. The action’s return value comes back in output. Actions that return undefined respond with { "output": null }.

POST https://api.rivet.dev/gateway/{actor}/action/{action}

Examples

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

NameTypeRequiredDescription
actorstringYesActor ID, actor ID with an inline token ({actor_id}@{token}), or actor name combined with the rvt-* query parameters.
actionstringYesName of the action as defined in the actor’s actions map.

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.

Request Body

Content type: application/json (optional).

FieldTypeRequiredDescription
argsanyYesPositional arguments passed to the action, in order.

Responses

200

Action executed successfully

FieldTypeDescription
outputanyValue returned by the action. null if the action returned undefined.
{
  "output": 1
}

400

Invalid action

500

Internal error