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

# 创建计划

> 创建一个新的计划以在指定时间执行API调用。支持使用cron表达式的一次性执行和重复计划。你还可以使用自然语言文本自动生成cron表达式。



## OpenAPI

````yaml zh/openapi/schedules.json POST /v1/schedules
openapi: 3.0.3
info:
  title: 调度 API
  version: 1.0.0
servers:
  - url: https://api.olostep.com
security: []
paths:
  /v1/schedules:
    post:
      summary: 创建调度
      description: >-
        创建一个新的调度以在指定时间执行 API 调用。支持一次性执行和使用 cron 表达式的重复调度。你也可以使用自然语言文本自动生成 cron
        表达式。对于 POST 请求，你可以使用简短的 Olostep 端点（例如，'v1/scrapes'），它们将被自动加上前缀，或者提供完整的
        URL。有效负载可以包含你想发送的任何 JSON 结构。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  enum:
                    - GET
                    - POST
                  description: 调度的 API 调用的 HTTP 方法。必须是 GET 或 POST。
                endpoint:
                  type: string
                  description: >-
                    调度执行时要调用的端点 URL。对于带有 Olostep 端点的 POST
                    请求，你可以使用简短形式（例如，'v1/scrapes', 'v1/batches', 'v1/crawls',
                    'v1/maps', 'v1/answers'），它们将被自动加上 'https://api.olostep.com/'
                    前缀。对于其他端点，请提供完整的 URL。
                payload:
                  type: object
                  description: >-
                    随 API 调用发送的有效负载。可以包含你需要的任何 JSON 结构。对于 GET 请求，这通常是空的。对于 POST
                    请求，这应该包含你想发送到端点的数据。
                  default: {}
                cron_expression:
                  type: string
                  description: >-
                    用于重复调度的 6 个字段格式的 cron 表达式（分钟 小时 天 月 星期几 年）。重复调度必需。与
                    execute_at 和 text 互斥。
                execute_at:
                  type: string
                  format: date-time
                  description: >-
                    用于一次性调度执行的 ISO 8601 日期时间字符串。必须是有效的未来日期时间。一次性调度必需。与
                    cron_expression 互斥。
                expression_timezone:
                  type: string
                  description: >-
                    调度的 IANA 时区标识符（例如，'UTC', 'America/New_York',
                    'Europe/London'）。重复调度必需，一次性调度可选。使用自然语言文本时，默认为 'UTC'。
                text:
                  type: string
                  description: >-
                    用于自动生成 cron 表达式的自然语言文本。系统会将你的文本转换为有效的 cron 表达式。示例：'every 3
                    minutes', 'every day at 10am', 'every Monday at 9am'。与
                    cron_expression 和 execute_at 互斥。使用时，expression_timezone 默认为
                    'UTC'。
              required:
                - method
                - endpoint
      responses:
        '200':
          description: 调度创建成功。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 唯一的调度标识符
                  type:
                    type: string
                    enum:
                      - recurring
                      - onetime
                    description: 调度类型：'recurring' 表示基于 cron 的调度，'onetime' 表示单次执行调度
                  method:
                    type: string
                    enum:
                      - GET
                      - POST
                    description: 调度调用的 HTTP 方法
                  endpoint:
                    type: string
                    description: 将被调用的端点 URL
                  cron_expression:
                    type: string
                    description: Cron 表达式（仅在重复调度中存在）
                  execute_at:
                    type: string
                    format: date-time
                    description: 执行日期时间（仅在一次性调度中存在）
                  expression_timezone:
                    type: string
                    description: 调度的时区
                  created:
                    type: string
                    format: date-time
                    description: 调度创建时的 ISO 8601 日期时间
        '400':
          description: >-
            由于参数不正确或缺失导致的错误请求。常见错误：无效的方法、缺少端点、无效的 cron_expression、无效的 execute_at
            日期时间、无效的时区或无效的 schedule_id 格式。
        '401':
          description: API 密钥无效。请检查密钥或在遇到问题时联系 info@olostep.com。
        '500':
          description: 创建计划时发生内部服务器错误。
      security:
        - Authorization: []
components:
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: Bearer认证头格式为Bearer <token>，其中<token>是你的认证令牌。

````