Skip to main content
POST
/
:projectId
/
api
/
v7
/
events
Create Event
curl --request POST \
  --url https://api.sublay.io/api/v6/:projectId/api/v7/events \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "startTime": "<string>",
  "type": "<string>",
  "description": "<string>",
  "endTime": "<string>",
  "timezone": "<string>",
  "url": "<string>",
  "venueName": "<string>",
  "address": "<string>",
  "location": {},
  "spaceId": "<string>",
  "visibility": "<string>",
  "capacity": 123,
  "allowMaybe": true,
  "guestListVisible": true,
  "hostIds": [
    "<string>"
  ],
  "metadata": {},
  "userId": "<string>",
  "cover.options": "<string>",
  "gallery": [
    null
  ],
  "gallery.options": "<string>"
}
'
Creates an event. The authenticated user becomes the creator (userId) and is automatically added to hostIds. Supports inline cover and gallery image upload via multipart/form-data. The required location fields depend on type: online needs a url; physical needs an address or location; hybrid needs both a url and an address/location. Requires authentication. Space-scoped events (spaceId) require the spaces bundle and active membership of the space. Image upload requires the files-images bundle.

Body Parameters

title
string
required
Event title. 1–300 characters.
startTime
string
required
ISO datetime when the event starts. RSVPs close at this moment.
type
string
required
"online", "physical", or "hybrid". Controls which location fields are required.
description
string
Optional description.
endTime
string
Optional ISO datetime when the event ends.
timezone
string
Optional IANA timezone string, e.g. "America/New_York".
url
string
Join/stream URL. Required for online and hybrid events.
venueName
string
Optional venue name.
address
string
Street address. Required (alone or with location) for physical and hybrid events.
location
{ latitude: number; longitude: number }
Geographic coordinates. Stored as a GeoJSON point and used for proximity search. On multipart requests, send as a JSON string.
spaceId
string
Optional UUID of a space to scope the event to. Requires the spaces bundle and active membership. Mandatory when visibility is "members".
visibility
string
"public", "members", or "invite". Defaults to "public". "members" requires a spaceId.
capacity
number
Maximum number of going RSVPs. Positive integer. Omit for unlimited.
allowMaybe
boolean
Whether a "maybe" RSVP is allowed. Defaults to true.
guestListVisible
boolean
Whether non-hosts can view the named guest list. Defaults to true.
hostIds
string[]
Additional host user IDs. The creator is always added automatically. On multipart requests, send as a JSON string.
metadata
object
Arbitrary key-value data. Up to 1 MB.
userId
string
Service/master key only. Create the event on behalf of this user (who becomes the creator and first host).
cover
file
Optional single cover image. Multipart file field. Requires cover.options when provided.
cover.options
string
JSON-stringified image-processing options for the cover (the same discriminated union used by Upload Image).
Optional gallery images (up to 10). Multipart file field. Requires gallery.options when provided.
JSON-stringified image-processing options applied to every gallery image.

Response

Returns 201 with the created Event object, including inline rsvpCounts and (with images) the files association.

Error Responses

{ "error": "Online events require a `url`.", "code": "event/invalid-body" }
{ "error": "Event cover/gallery images require the files-images bundle. Enable it for this project.", "code": "event/files-images-bundle-required" }
{ "error": "Space-scoped events require the spaces bundle. Enable it for this project.", "code": "event/spaces-bundle-required" }
{ "error": "Space not found", "code": "event/space-not-found" }
{ "error": "You must be an active member of this space to create an event in it.", "code": "event/not-space-member" }
{ "code": "event/file-too-large", "message": "Image \"cover.jpg\" exceeds 50MB limit." }
{ "code": "event/invalid-image", "message": "File \"cover.jpg\" is not a valid image: ..." }
See also: useCreateEvent · node-sdk · js-sdk