Skip to main content

Overview

useCreateEvent returns a callable that creates an event. The logged-in user becomes the event’s owner (userId) and is auto-added to hostIds. For an event in a space, the request is refused when the user isn’t an active member of the space, banned in it included (403 event/not-space-member), when they are banned in a space above it or the space’s postingPermission is "team" and they aren’t one of its admins or moderators (403 space/posting-not-allowed), or when a user in hostIds isn’t an active member of the space (409 event/host-not-member). Pass coverFile, images and/or files to upload them inline — the hook sends multipart/form-data automatically (requires the files-images bundle).

Usage Example

Parameters

string
required
Event title. 1–300 characters.
string | Date
required
When the event starts: an ISO 8601 datetime in UTC (ending in Z), or a Date (sent as its ISO string).
"online" | "physical" | "hybrid"
required
online requires url; physical requires address or location; hybrid requires both.
string
Optional description.
string | Date
When the event ends: an ISO 8601 datetime in UTC, or a Date.
string
Optional IANA timezone.
string
Join/stream URL.
string
Venue name.
string
Street address.
{ latitude: number; longitude: number }
Coordinates for proximity search.
string
Scope to a space. Required when visibility is "members".
"public" | "members" | "invite"
Defaults to "public".
number
Max going RSVPs. Omit for unlimited.
boolean
Allow "maybe" RSVPs. Defaults to true.
boolean
Expose the named guest list to everyone who can see the event. When false, only hosts who are active members of the event’s space and not banned in it or a space above it and the space’s admins and moderators see it. Defaults to true.
string[]
Additional host user IDs (the logged-in user is auto-added). For an event in a space, each must be an active member of it.
Record<string, any>
Arbitrary key-value data. Up to 1 MB.
{ file: UploadFileInput; options: UploadImageOptions }
The cover image and its processing options (mode is required). Sends multipart. The cover is returned in the event’s files, and coverImageId points at it. Requires the files-images bundle.
{ files: UploadFileInput[]; options: UploadImageOptions }
Images in the event’s files, processed into sizes per options (mode is required). Each file is a File or Blob, or a React Native file { uri, name, type? }. A request takes at most 20 files in all. Sends multipart. Requires the files-images bundle.
{ files: UploadFileInput[]; options?: { pathParts?: string[] } }
Files in the event’s files, stored as uploaded. Each file’s type comes from its MIME type; an image sent here isn’t processed, so it has no image data. Sends multipart. Requires the files-images bundle.

Returns

Returns a Promise<Event> — the created Event with inline rsvpCounts. With the files-images bundle installed it carries files ([] for none; the cover first) and the host’s avatar and banner files; without it there is no files key.

See Also