---
title: "/calendars/{calendarId}/events"
url: "https://developers.rest.rodeo/apis/calendar/versions/9fa518e1-4597-4801-ad08-2c360cda2316/operations/createEvent"
---

> Full API specification: https://developers.rest.rodeo/apis/calendar/versions/9fa518e1-4597-4801-ad08-2c360cda2316.md

# /calendars/{calendarId}/events

`POST` `/calendars/{calendarId}/events`

Operation ID: `createEvent`

Creates an event in the calendar. When `allDay` is true, `startTime` and `endTime` must be null; otherwise both are required.

## Path parameters

- `calendarId` (string, uuid, required) - The calendar id.

## Request body (required)

Content types: `application/json`

## Responses

- `201` - The created event
- `400` - Invalid JSON body or invalid event fields
- `401` - Missing or invalid bearer token
- `404` - No calendar with this id
- `405` - Method not allowed

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: Calendar API
  version: 1.0.0
servers:
  - url: https://api.rest.rodeo/calendar/api/v1
    description: Production
paths:
  /calendars/{calendarId}/events:
    post:
      operationId: createEvent
      summary: /calendars/{calendarId}/events
      description: Creates an event in the calendar. When `allDay` is true,
        `startTime` and `endTime` must be null; otherwise both are required.
      parameters:
        - $ref: "#/components/parameters/CalendarId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EventRequest"
            examples:
              timed:
                value:
                  title: Rodeo kickoff
                  description: Season opener
                  startDate: 2026-10-01
                  endDate: 2026-10-01
                  startTime: 18:00
                  endTime: 21:00
                  allDay: false
              allDay:
                value:
                  title: Rodeo finals
                  description: Championship day
                  startDate: 2026-10-15
                  endDate: 2026-10-16
                  startTime: null
                  endTime: null
                  allDay: true
      responses:
        "201":
          description: The created event
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Event"
              examples:
                event:
                  value:
                    id: 9f6f7c7a-88f3-4f42-a3f3-4b41d63b325a
                    calendarId: 3d8df2a2-0d68-4dc4-9d5e-6b1e94a7a51d
                    title: Rodeo kickoff
                    description: Season opener
                    startDate: 2026-10-01
                    endDate: 2026-10-01
                    startTime: 18:00
                    endTime: 21:00
                    allDay: false
        "400":
          description: Invalid JSON body or invalid event fields
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Missing or invalid bearer token
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: No calendar with this id
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "405":
          description: Method not allowed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
security:
  - bearerAuth: []
components:
  parameters:
    CalendarId:
      name: calendarId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: The calendar id.
  schemas:
    EventRequest:
      type: object
      required:
        - title
        - description
        - startDate
        - endDate
        - startTime
        - endTime
        - allDay
      additionalProperties: false
      properties:
        title:
          type: string
          description: The event title.
          maxLength: 256
          minLength: 1
        description:
          type: string
          description: The event description.
          maxLength: 2000
        startDate:
          type: string
          description: The date the event starts.
          pattern: ^\d{4}-\d{2}-\d{2}$
          example: 2026-10-01
        endDate:
          type: string
          description: The date the event ends. Must not be before `startDate`.
          pattern: ^\d{4}-\d{2}-\d{2}$
          example: 2026-10-01
        startTime:
          type: string
          nullable: true
          description: The time the event starts. Required null when `allDay` is true,
            required non-null otherwise.
          pattern: ^([01]\d|2[0-3]):[0-5]\d$
          example: 18:00
        endTime:
          type: string
          nullable: true
          description: The time the event ends. Required null when `allDay` is true,
            required non-null otherwise.
          pattern: ^([01]\d|2[0-3]):[0-5]\d$
          example: 21:00
        allDay:
          type: boolean
          description: Whether the event lasts all day.
    Event:
      type: object
      required:
        - id
        - calendarId
        - title
        - description
        - startDate
        - endDate
        - startTime
        - endTime
        - allDay
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
          description: The event id.
        calendarId:
          type: string
          format: uuid
          description: The id of the calendar this event belongs to.
        title:
          type: string
          description: The event title.
          maxLength: 256
        description:
          type: string
          description: The event description.
          maxLength: 2000
        startDate:
          type: string
          description: The date the event starts.
          pattern: ^\d{4}-\d{2}-\d{2}$
          example: 2026-10-01
        endDate:
          type: string
          description: The date the event ends. Must not be before `startDate`.
          pattern: ^\d{4}-\d{2}-\d{2}$
          example: 2026-10-01
        startTime:
          type: string
          nullable: true
          description: The time the event starts. Null when `allDay` is true.
          pattern: ^([01]\d|2[0-3]):[0-5]\d$
          example: 18:00
        endTime:
          type: string
          nullable: true
          description: The time the event ends. Null when `allDay` is true.
          pattern: ^([01]\d|2[0-3]):[0-5]\d$
          example: 21:00
        allDay:
          type: boolean
          description: Whether the event lasts all day. When true, `startTime` and
            `endTime` must be null; otherwise both are required.
    Error:
      type: object
      required:
        - error
      additionalProperties: false
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
