> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roostedhr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Event

> Creates a new event.

## Location

Provide the event location via the `location` object. To link an existing saved location, pass `location_id`. To create an inline location, provide `name`, `address`, `city`, and `zip` — set `saved` to `"1"` to save it for reuse.

## Custom fields

Send custom fields as an array of `{ field_id, value }` objects, where `field_id` is the custom field's ID.

## Areas

Assign areas to the event by passing an array of area IDs in the `areas` field. Invalid IDs return a `400` error.

<Note>
  The `client_id` field is optional. When provided, it links the event to an existing client record.
</Note>


## OpenAPI

````yaml api-reference/v01.12.00/openapi-v01.12.00.json POST /events
openapi: 3.0.0
info:
  title: Roosted
  version: 0.1.12
  contact:
    name: Support
    url: https://support.roostedhr.com/support/home
    email: support@roostedhr.com
  description: |-
    Enterprise API

    Sandbox keys and Production keys are requested from support
servers:
  - url: https://api.roostedhr.com/api/1_12
  - url: https://sandbox.roostedhr.com/api/1_12
security:
  - X-API-KEY: []
tags:
  - name: Announcements
  - name: Areas
  - name: Clients
  - name: Company
  - name: Configuration
  - name: Events
  - name: Locations
  - name: Payroll Groups
  - name: Rate Cards
  - name: Shifts
  - name: Skillsets
  - name: Time Tracking
  - name: Wage Rules
  - name: Workers
paths:
  /events:
    parameters: []
    post:
      tags:
        - Events
      summary: Create Event
      description: Creates a new event.
      operationId: post-event
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                date:
                  type: string
                  format: date
                location:
                  type: object
                  minProperties: 1
                  properties:
                    location_id:
                      type: string
                      description: >-
                        ID of an existing saved location. If provided, other
                        location fields are optional and will override the saved
                        values.
                      pattern: ^[A-Za-z0-9]+
                    name:
                      type: string
                      maxLength: 150
                    address:
                      type: string
                      maxLength: 150
                    city:
                      type: string
                      maxLength: 75
                    zip:
                      type: string
                      maxLength: 10
                    saved:
                      type: string
                      description: Set to `"1"` to save this location for future use.
                      pattern: ^[01]
                      maxLength: 1
                client_id:
                  type: string
                  pattern: ^[A-Za-z0-9]+
                admin_comments:
                  type: string
                  maxLength: 65535
                comments:
                  type: string
                  maxLength: 65535
                custom_fields:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Custom field ID
                      value:
                        type: string
                        maxLength: 65535
                    required:
                      - id
                      - value
                areas:
                  type: array
                  description: Area IDs to assign to the event. Invalid IDs return 400.
                  items:
                    type: string
              required:
                - name
                - date
                - location
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: number
                description: Created event ID
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Name is required:
                  value:
                    code: EVT-200
                    error: Name is required
                Admin comments exceeds maximum length:
                  value:
                    code: EVT-200
                    error: Admin comments exceeds maximum length
                Comments exceeds maximum length:
                  value:
                    code: EVT-200
                    error: Comments exceeds maximum length
                Invalid custom field:
                  value:
                    code: EVT-200
                    error: Invalid custom field
                Custom field value exceeds maximum length:
                  value:
                    code: EVT-200
                    error: Custom field value exceeds maximum length
                Date is required:
                  value:
                    code: EVT-300
                    error: Date is required
                Location is required:
                  value:
                    code: EVT-400
                    error: Location is required
                Invalid date format:
                  value:
                    code: EVT-500
                    error: Invalid date format
                Invalid client_id:
                  value:
                    code: EVT-600
                    error: Invalid client_id
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Invalid API key:
                  value:
                    code: ATH-100
                    error: Invalid or missing API key
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Insufficient permissions:
                  value:
                    code: EVT-800
                    error: Insufficient permissions to manage events
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Event not found:
                  value:
                    code: EVT-700
                    error: Event not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Unexpected error:
                  value:
                    code: EVT-1000
                    error: An unexpected error occurred
components:
  securitySchemes:
    X-API-KEY:
      name: X-API-KEY
      type: apiKey
      in: header

````