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://rivet.example.com/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
namespacestringNoName of the namespace to operate in.

Request Body

Content type: application/json.

FieldTypeRequiredDescription
namestringYesName of the actor as registered in your RivetKit registry.
keystring | nullNoKey identifying this actor within its name. Multi-part keys are joined with /, see Actor Keys. Omit for a keyless actor.
inputstring | nullNoBase64url-encoded CBOR input passed to the actor’s createState and onCreate hooks.
poolstring | nullNoName of the node pool to run the actor in. Defaults to default.

Responses

200

The created actor.

FieldTypeDescription
actorobject
actor.actor_idstringUnique ID of the actor.
actor.namestringActor name as registered in your RivetKit registry.
actor.keystringActor key. Multi-part keys are joined with /, see Actor Keys.
actor.namespacestringName of the namespace the actor belongs to.
actor.poolstringName of the node pool the actor runs in.
actor.create_tsintegerWhen the actor was created, in Unix milliseconds.
actor.start_tsinteger | nullWhen the actor first started. Not recorded by this version, so always null.
actor.pending_allocation_tsinteger | nullWhen the actor started waiting for a node. Not recorded by this version, so always null.
actor.connectable_tsinteger | nullWhen the actor last became connectable. Not recorded by this version, so always null.
actor.sleep_tsinteger | nullWhen the actor went to sleep. Not recorded by this version, so always null.
actor.reschedule_tsinteger | nullWhen the actor will next try to allocate. Not recorded by this version, so always null.
actor.destroy_tsinteger | nullWhen the actor was destroyed, in Unix milliseconds. Only set in listings that include destroyed actors; otherwise null.
createdbooleantrue if this request created the actor, false if it already existed.
{
  "actor": {
    "actor_id": "d97pbq1nyqxw1w5qdwz0iirbqiblh2",
    "name": "my-actor",
    "key": "my-key",
    "namespace": "my-namespace",
    "pool": "default",
    "create_ts": 1700000000000,
    "start_ts": null,
    "pending_allocation_ts": null,
    "connectable_ts": null,
    "sleep_ts": null,
    "reschedule_ts": null,
    "destroy_ts": null
  },
  "created": false
}

400

actor.invalid_name: name is empty or longer than 64 bytes. actor.invalid_key: key is longer than 1024 bytes. actor.invalid_key_encoding: key is not in canonical slash-separated form. actor.key_owned_elsewhere: another datacenter owns the key. envoy.invalid_pool_name: pool is not a valid pool name. envoy.invalid_namespace_name: the namespace value is not a DNS label of 1 to 63 lowercase letters, digits and hyphens.

FieldTypeDescription
groupstringError group, for example actor.
codestringError code within the group, for example not_found.
messagestringHuman-readable error message.
metadataanyExtra details. Only present on some errors raised while authenticating or authorizing the request.
{
  "group": "actor",
  "code": "invalid_name",
  "message": "Actor name must be 1 to 64 bytes."
}

401

auth.invalid_token: the request carries no token, or the token is not valid. auth.token_expired: the token has expired.

FieldTypeDescription
groupstringError group, for example actor.
codestringError code within the group, for example not_found.
messagestringHuman-readable error message.
metadataanyExtra details. Only present on some errors raised while authenticating or authorizing the request.
{
  "group": "auth",
  "code": "invalid_token",
  "message": "Authentication token is invalid."
}

403

auth.insufficient_permissions: the token’s grants do not cover this request.

FieldTypeDescription
groupstringError group, for example actor.
codestringError code within the group, for example not_found.
messagestringHuman-readable error message.
metadataanyExtra details. Only present on some errors raised while authenticating or authorizing the request.
{
  "group": "auth",
  "code": "insufficient_permissions",
  "message": "Insufficient permissions to access this resource."
}

404

namespace.not_found: the namespace does not exist.

FieldTypeDescription
groupstringError group, for example actor.
codestringError code within the group, for example not_found.
messagestringHuman-readable error message.
metadataanyExtra details. Only present on some errors raised while authenticating or authorizing the request.
{
  "group": "namespace",
  "code": "not_found",
  "message": "The namespace does not exist."
}

409

actor.duplicate_key: a live actor with this name and key already exists.

FieldTypeDescription
groupstringError group, for example actor.
codestringError code within the group, for example not_found.
messagestringHuman-readable error message.
metadataanyExtra details. Only present on some errors raised while authenticating or authorizing the request.
{
  "group": "actor",
  "code": "duplicate_key",
  "message": "Actor key already in use."
}

415

The request is missing the Content-Type: application/json header. Returned as plain text.

Content type: text/plain.

422

The JSON body does not match the request schema, for example a missing required field, a wrong type or an unknown field where unknown fields are rejected. Returned as plain text.

Content type: text/plain.

500

core.internal_error: an unexpected failure, including input that is not valid base64 and a create that did not finish within 30 seconds.

FieldTypeDescription
groupstringError group, for example actor.
codestringError code within the group, for example not_found.
messagestringHuman-readable error message.
metadataanyExtra details. Only present on some errors raised while authenticating or authorizing the request.
{
  "group": "core",
  "code": "internal_error",
  "message": "An internal error occurred"
}

503

auth.verification_unavailable: token verification keys are temporarily unavailable. Retry the request.

FieldTypeDescription
groupstringError group, for example actor.
codestringError code within the group, for example not_found.
messagestringHuman-readable error message.
metadataanyExtra details. Only present on some errors raised while authenticating or authorizing the request.
{
  "group": "auth",
  "code": "verification_unavailable",
  "message": "The server could not verify the authentication token because verification keys are temporarily unavailable. Retry the request."
}