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

# Create closure

> Create an office closure. Supply annualDate for an annual all-day closure, or both startAt and endAt for a one-time closure; do not combine them. Both chatGreeting and phoneGreeting are required. The interval overrides regular office hours and breaks. Custom greetings replace the corresponding closed greeting.



## OpenAPI

````yaml /openapi/openapi.yaml post /organizations/{orgId}/closures
openapi: 3.0.3
info:
  title: Annie API
  description: >
    ### Overview


    The Annie API is a (mostly) RESTful API. Typically, both POST bodies and
    responses are JSON-encoded.


    Note: The documenation is Work In Progress and is subject to change.


    ### Base URL


    The base URL for the Annie API is https://api.helloannie.com/.


    Examples in this document may abbreviate this to `/`.


    ### Versioning


    Routes are prefixed with a version number i.e. `v1`. The version will change
    when there is a non-backwards compatible or other significant change to the
    api.


    ### Authentication


    The Annie API supports two authentication methods API Keys and OAuth Access
    Tokens:


    #### API Keys


    API Keys are long-lived tokens that can be generated from the Developer
    Portal on your organization page. API keys are prefixed with `annie-sk-v2-`
    and can be used directly in the `Authorization` header.


    ```

    curl -H "Authorization: Bearer annie-sk-xxxxx"
    https://api.helloannie.com/...

    ```


    #### OAuth Tokens


    OAuth tokens are short-lived access tokens generated using the OAuth 2.0
    Client Credentials flow (Machine-to-Machine). OAuth clients provide scoped
    permissions and are ideal for server-to-server integrations.


    **Creating an OAuth Client**


    OAuth clients can be created in the Developer Portal on your organization
    page. When creating a client, you'll receive:


    - `client_id`: Your OAuth client identifier

    - `client_secret`: Your OAuth client secret (store this securely)


    **Generating an OAuth Token**


    To generate an OAuth access token, make a POST request to the Annie OAuth
    token endpoint:


    **Endpoint:** `https://annie-external-api.us.auth0.com/oauth/token`


    **Example Request:**


    ```bash

    curl -X POST https://annie-external-api.us.auth0.com/oauth/token \
      -H "Content-Type: application/json" \
      -d '{
        "grant_type": "client_credentials",
        "client_id": "your-client-id",
        "client_secret": "your-client-secret",
        "audience": "https://api.helloannie.com"
      }'
    ```


    The `access_token` from the response should be used in the `Authorization`
    header when making requests to the Annie API:


    ```

    curl -H "Authorization: Bearer eyJhbGciOiJSUzI..."
    https://api.helloannie.com/v1/...

    ```


    ### API Response Structure


    The Annie API returns status codes consistent with standard HTTP
    conventions. Success and Error responses follow the below structure:


    ```

    {
      "success": boolean
      "data": {}
      "message": string // optional
    }

    ```


    ### Rate Limiting


    The Annie API enforces rate limits to ensure stability and fair usage. The
    default rate limit is **60 requests per minute** per organization. This
    limit is applied per endpoint pattern (e.g. `GET /v1/bots/:id`).


    When the rate limit is exceeded, the API responds with HTTP `429 Too Many
    Requests`.


    Response headers include:


    - `X-RateLimit-Limit`: The maximum number of requests allowed in the current
    window.

    - `X-RateLimit-Remaining`: The number of requests remaining in the current
    window.

    - `X-RateLimit-Reset`: The time at which the current rate limit window
    resets (in UTC epoch seconds).


    If you exceed the limit, the response will contain a `Retry-After` header
    indicating how many seconds to wait before retrying.


    ### Pagination


    The Annie API does not currently support pagination. All results are
    returned at once.
  version: v1
servers:
  - url: https://api.helloannie.com/v1
security: []
paths:
  /organizations/{orgId}/closures:
    post:
      tags:
        - Closures
      summary: Create closure
      description: >-
        Create an office closure. Supply annualDate for an annual all-day
        closure, or both startAt and endAt for a one-time closure; do not
        combine them. Both chatGreeting and phoneGreeting are required. The
        interval overrides regular office hours and breaks. Custom greetings
        replace the corresponding closed greeting.
      operationId: postV1OrganizationsByOrgIdClosures
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            format: uuid
            description: Organization ID.
            type: string
      requestBody:
        description: >-
          Supply either annualDate for an annual all-day closure, or both
          startAt and endAt for a one-time closure. Do not combine them.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OfficeClosureCreateRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/OfficeClosureCreateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/OfficeClosureCreateRequest'
      responses:
        '200':
          description: Response for status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfficeClosureDetailResponse'
        '400':
          description: The request was invalid or malformed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '403':
          description: You do not have permission to perform this action
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: The requested resource was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
components:
  schemas:
    OfficeClosureCreateRequest:
      additionalProperties: false
      type: object
      required:
        - description
        - chatGreeting
        - phoneGreeting
      properties:
        description:
          minLength: 1
          maxLength: 255
          pattern: \S
          description: Closure name or reason shared with callers and visitors.
          type: string
        startAt:
          format: date-time
          pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:00Z$
          description: >-
            When the closure begins, inclusive. UTC timestamp in
            YYYY-MM-DDTHH:mm:00Z format; no fractional seconds.
          example: '2026-12-24T18:30:00.000Z'
          type: string
        endAt:
          format: date-time
          pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:00Z$
          description: >-
            When the closure ends, exclusive. Must be after startAt. UTC
            timestamp in YYYY-MM-DDTHH:mm:00Z format; no fractional seconds.
          example: '2026-12-24T18:30:00.000Z'
          type: string
        annualDate:
          additionalProperties: false
          description: >-
            Repeat on this calendar date each year for the entire day in the
            organization's timezone.
          type: object
          required:
            - month
            - day
          properties:
            month:
              minimum: 1
              maximum: 12
              description: Calendar month, from 1 (January) to 12 (December).
              type: integer
            day:
              minimum: 1
              maximum: 31
              description: >-
                Day of the month. Must form a valid date; February 29 applies
                only in leap years.
              type: integer
        chatGreeting:
          minLength: 1
          maxLength: 500
          pattern: \S
          description: Nonblank chat greeting during the closure, up to 500 characters.
          type: string
        phoneGreeting:
          minLength: 1
          maxLength: 500
          pattern: \S
          description: Nonblank phone greeting during the closure, up to 500 characters.
          type: string
    OfficeClosureDetailResponse:
      additionalProperties: false
      type: object
      required:
        - success
        - data
      properties:
        success:
          enum:
            - true
          type: boolean
        data:
          anyOf:
            - additionalProperties: false
              type: object
              required:
                - id
                - description
                - chatGreeting
                - phoneGreeting
                - startAt
                - endAt
              properties:
                id:
                  format: uuid
                  description: Closure ID.
                  type: string
                description:
                  description: Closure name or reason.
                  type: string
                chatGreeting:
                  description: Custom chat greeting, or null if not configured.
                  type: string
                  nullable: true
                phoneGreeting:
                  description: Custom phone greeting, or null if not configured.
                  type: string
                  nullable: true
                startAt:
                  format: date-time
                  pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:00Z$
                  description: >-
                    When the closure begins, inclusive. UTC timestamp in
                    YYYY-MM-DDTHH:mm:00Z format; no fractional seconds.
                  example: '2026-12-24T18:30:00.000Z'
                  type: string
                endAt:
                  format: date-time
                  pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:00Z$
                  description: >-
                    When the closure ends, exclusive. Must be after startAt. UTC
                    timestamp in YYYY-MM-DDTHH:mm:00Z format; no fractional
                    seconds.
                  example: '2026-12-24T18:30:00.000Z'
                  type: string
            - additionalProperties: false
              type: object
              required:
                - id
                - description
                - chatGreeting
                - phoneGreeting
                - annualDate
              properties:
                id:
                  format: uuid
                  description: Closure ID.
                  type: string
                description:
                  description: Closure name or reason.
                  type: string
                chatGreeting:
                  description: Custom chat greeting, or null if not configured.
                  type: string
                  nullable: true
                phoneGreeting:
                  description: Custom phone greeting, or null if not configured.
                  type: string
                  nullable: true
                annualDate:
                  additionalProperties: false
                  description: >-
                    Repeat on this calendar date each year for the entire day in
                    the organization's timezone.
                  type: object
                  required:
                    - month
                    - day
                  properties:
                    month:
                      minimum: 1
                      maximum: 12
                      description: Calendar month, from 1 (January) to 12 (December).
                      type: integer
                    day:
                      minimum: 1
                      maximum: 31
                      description: >-
                        Day of the month. Must form a valid date; February 29
                        applies only in leap years.
                      type: integer
    BadRequestResponse:
      additionalProperties: false
      type: object
      required:
        - success
        - data
        - message
      properties:
        success:
          enum:
            - false
          type: boolean
        data:
          additionalProperties: false
          type: object
          properties: {}
        message:
          type: string
    ForbiddenResponse:
      additionalProperties: false
      type: object
      required:
        - success
        - data
        - message
      properties:
        success:
          enum:
            - false
          type: boolean
        data:
          additionalProperties: false
          type: object
          properties: {}
        message:
          type: string
    NotFoundResponse:
      additionalProperties: false
      type: object
      required:
        - success
        - data
        - message
      properties:
        success:
          enum:
            - false
          type: boolean
        data:
          additionalProperties: false
          type: object
          properties: {}
        message:
          type: string

````