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

# Create a schedule

> Create a schedule of a saved workflow (cron, or one-time with run_at).


## OpenAPI

```yaml openapi.json post /v1/schedules
openapi: 3.1.0
info:
  title: Ocean One API
  version: 2.3.1
servers:
  - url: https://api.plungeai.com
paths:
  /v1/schedules:
    post:
      operationId: post-v1-schedules
      tags:
        - Schedules
      summary: Create a schedule of a saved workflow (cron, or one-time with run_at)
      description: Runs a saved workflow or bot you own on a cron expression, or once at run_at with schedule "@once". parameters.deliver is a list of {channel, chat_id?, to?} (a bare channel string is widened) with channel one of inapp, email, slack, telegram, whatsapp, discord, teams. A heartbeat takes job_type "heartbeat" and its spec as target. The owner is always the key's user.
      security:
        - ozkBearer: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - schedule
              properties:
                name:
                  type: string
                schedule:
                  type: string
                  description: Cron expression, or "@once" together with run_at
                workflow_id:
                  type: string
                  description: The saved workflow or bot to run
                job_type:
                  type: string
                  enum:
                    - workflow
                    - heartbeat
                  description: Default workflow
                target:
                  description: A heartbeat’s spec (object or JSON string); for a workflow schedule the workflow id
                description:
                  type: string
                timezone:
                  type: string
                  description: IANA zone the cron is read in
                parameters:
                  type: object
                  description: deliver targets, per-run input, …
                run_at:
                  type: string
                  description: ISO-8601 time with a UTC offset, in the future; required when schedule is @once
                ends_at:
                  description: ISO-8601 time or ms epoch after which the schedule stops running
                format:
                  type: string
                  enum:
                    - json
                    - yaml
                    - markdown
                    - text
                  description: Response format override (Accept header and the request Content-Type mirror also work). Default json.
          text/yaml:
            schema:
              type: string
      responses:
        "201":
          description: The schedule Response format negotiates via the `format` field, an Accept header (application/json, text/yaml, text/markdown, text/plain), or the request Content-Type mirror; default JSON.
          content:
            application/json:
              schema:
                type: object
                properties:
                  schedule:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      description:
                        type:
                          - string
                          - "null"
                      job_type:
                        type: string
                        enum:
                          - workflow
                          - heartbeat
                          - agent
                          - query
                      schedule:
                        type: string
                        description: Cron expression, or @once for a one-time schedule
                      timezone:
                        type:
                          - string
                          - "null"
                        description: IANA zone the cron is read in; null = UTC
                      status:
                        type: string
                        enum:
                          - active
                          - paused
                      workflow_id:
                        type:
                          - string
                          - "null"
                      target:
                        type: string
                        description: The workflow id, or a heartbeat’s JSON spec
                      parameters:
                        type:
                          - object
                          - "null"
                        description: deliver targets, input, … as stored
                      next_run_at:
                        type:
                          - integer
                          - "null"
                        description: ms epoch
                      last_run_at:
                        type:
                          - integer
                          - "null"
                        description: ms epoch
                      ends_at:
                        type:
                          - integer
                          - "null"
                        description: ms epoch after which a due schedule is removed instead of run
                      created_at:
                        type: integer
                      updated_at:
                        type: integer
            text/yaml:
              schema:
                type: string
            text/markdown:
              schema:
                type: string
            text/plain:
              schema:
                type: string
        "400":
          description: invalid_json / invalid_yaml / invalid_body — unreadable body; invalid_format — format must be one of json, yaml, markdown, text; run_at_required — schedule is @once without run_at; run_at_past — run_at is not in the future; run_at must carry a UTC offset (invalid_request)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: unauthorized — missing, invalid or revoked ozk_ key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: "workflow_not_found — no saved workflow with that id for this key; not_found — no route for this method on this path: every other method answers it"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "422":
          description: invalid_params — a field is missing or malformed (the envelope names it); nothing was written
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "502":
          description: scheduler_error — the scheduler failed or did not answer; no detail is returned, retry
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    Error:
      type: object
      description: Standard error envelope. Every error response also carries an `X-Error-Code` response header equal to error.code, so a client branches on the header regardless of the negotiated body format (json | yaml | markdown | text). When the request created an execution, the `X-Execution-Id` response header is also set. Errors follow the negotiated format like success bodies.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            connect:
              type: object
              description: "On a 424 connection_required / credential_required: where the missing connection is made."
              properties:
                provider:
                  type: string
                method:
                  type: string
                  enum:
                    - oauth
                    - api_key
                    - wallet
                link:
                  type: string
                  example: POST /v1/connections/stripe/link
          required:
            - code
            - message
          additionalProperties: true
      required:
        - error
  securitySchemes:
    ozkBearer:
      type: http
      scheme: bearer
      description: "ozk_ platform API key (Authorization: Bearer ozk_…)"
```
