Skip to main content
Manage Actors

Create Actor

Create a new actor. Fails if an actor with the same name and key already exists.

Prefer Get or Create Actor for idempotent access by key. Use this endpoint when you need a fresh actor every time, for example with a random key.

POST https://api.rivet.dev/actors

Examples

Authentication

Send your namespace token as a bearer token in the Authorization header. Every control plane request also requires the namespace query parameter. See Authentication.

Query Parameters

NameTypeRequiredDescription
namespacestringYesName of the namespace to operate in.

Request Body

Content type: application/json.

FieldTypeRequiredDescription
crash_policy"restart" | "sleep" | "destroy"YesWhat happens when the actor crashes. RivetKit defaults to sleep.
datacenterstring | nullNoDatacenter to create the actor in. Defaults to the datacenter serving the request.
inputstring | nullNoBase64url-encoded CBOR input passed to the actor’s createState and onCreate hooks.
keystring | nullNoKey identifying this actor within its name. Multi-part keys are joined with /, see Actor Keys. Omit for a keyless actor.
namestringYesName of the actor as registered in your RivetKit registry.
runner_name_selectorstringYesPool that runs the actor. RivetKit registers the default pool unless configured otherwise.

Responses

200

FieldTypeDescription
actorobject
actor.actor_idstringUnique ID of the actor.
actor.connectable_tsinteger | nullDenotes when the actor was last connectable. Null if actor is not running.
actor.crash_policy"restart" | "sleep" | "destroy"What happens when the actor crashes.
actor.create_tsintegerDenotes when the actor was first created.
actor.datacenterstringDatacenter the actor is scheduled in.
actor.destroy_tsinteger | nullDenotes when the actor was destroyed.
actor.errorobject | nullError details if the actor failed to start.
actor.keystring | nullActor key. Multi-part keys are joined with /, see Actor Keys.
actor.namestringActor name as registered in your RivetKit registry.
actor.namespace_idstringID of the namespace the actor belongs to.
actor.pending_allocation_tsinteger | nullDenotes when the actor started waiting for an allocation.
actor.reschedule_tsinteger | nullDenotes when the actor will try to allocate again. If this is set, the actor will not attempt to allocate until the given timestamp.
actor.runner_name_selectorstringPool the actor runs on.
actor.sleep_tsinteger | nullDenotes when the actor entered a sleeping state.
actor.start_tsinteger | nullDenotes when the actor was first made connectable. Null if never.
{
  "actor": {
    "actor_id": "00000000-0000-0000-0000-000000000000",
    "connectable_ts": null,
    "crash_policy": "restart",
    "create_ts": 1700000000000,
    "datacenter": "us-east",
    "destroy_ts": null,
    "error": null,
    "key": null,
    "name": "my-actor",
    "namespace_id": "00000000-0000-0000-0000-000000000000",
    "pending_allocation_ts": null,
    "reschedule_ts": null,
    "runner_name_selector": "default",
    "sleep_ts": null,
    "start_ts": null
  }
}