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

# Function Schedules Add



## OpenAPI

````yaml https://api.notte.cc/openapi.json post /functions/{function_id}/schedules
openapi: 3.1.0
info:
  title: Notte API
  description: >-
    Notte API is a REST API that allows you to interact with Notte. It is used
    to create cloud browser sessions, scrape webpages, and run web ai agents to
    act on your behalf on the internet.
  version: 1.10.3
  x-logo:
    url: https://www.notte.cc/images/logo/logo-white.png
servers: []
security: []
tags:
  - name: agents
    description: Web AI agents (start, stop, status, replay, etc.)
  - name: sessions
    description: Session management (start, stop, status, etc.)
  - name: debug
    description: Session debugging tools (replay,logs, recording, etc.)
  - name: page
    description: Page operations withing a session (observe, step, scrape, etc.)
  - name: storage
    description: File storage interface (upload, download, list, etc.)
  - name: network
    description: Network requests/responses withing a session (intercept, etc.)
  - name: vaults
    description: >-
      Vault & Credentials management (create/delete vaults, create/delete
      credentials, etc.)
  - name: personas
    description: Persona management (create, delete, list emails, list sms, etc.)
  - name: scrape
    description: >-
      Webpage scraping (scrape, screenshot, etc.) with automatic session
      management.
  - name: health
    description: Health check endpoint.
  - name: usage
    description: Usage logs (usage, logs, etc.)
  - name: audit
    description: Audit trail of account and workspace changes.
  - name: functions
    description: Functions management (create, delete, list, etc.)
paths:
  /functions/{function_id}/schedules:
    post:
      tags:
        - functions
      summary: Function Schedules Add
      operationId: function_schedules_add
      parameters:
        - name: function_id
          in: path
          required: true
          schema:
            type: string
            title: Function Id
        - name: x-notte-request-origin
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Notte-Request-Origin
        - name: x-notte-sdk-version
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Notte-Sdk-Version
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FunctionScheduleCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunctionSchedule'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
      x-codeSamples:
        - lang: Python
          source: |-
            import os

            import requests

            # Each schedule runs the function with its own variables.
            function_id = "<function_id>"
            response = requests.post(
                f"{os.environ.get('NOTTE_API_URL', 'https://api.notte.cc')}/functions/{function_id}/schedules",
                headers={"Authorization": f"Bearer {os.environ['NOTTE_API_KEY']}"},
                json={"cron": "0 17 ? * MON-FRI *", "variables": {"url": "https://shop.notte.cc/"}},
                timeout=30,
            )
            response.raise_for_status()
            print(response.json()["schedule_id"])
          label: python
        - lang: TypeScript
          source: >-
            const functionId = "<function_id>";

            // Each schedule runs the function with its own variables.

            const response = await
            fetch(`https://api.notte.cc/functions/${functionId}/schedules`, {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.NOTTE_API_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                cron: "0 17 ? * MON-FRI *",
                variables: { url: "https://shop.notte.cc/" },
              }),
              signal: AbortSignal.timeout(30_000),
            });

            if (!response.ok) throw new Error(await response.text());

            console.log(await response.json());
          label: node
        - lang: Curl
          source: >-
            curl -X POST "https://api.notte.cc/functions/$function_id/schedules"
            \

            -H "Authorization: Bearer $NOTTE_API_KEY" \

            -H "Content-Type: application/json" \

            -d '{

            "cron": "0 17 ? * MON-FRI *",

            "variables": {"url": "https://shop.notte.cc/"}

            }'
          label: curl
components:
  schemas:
    FunctionScheduleCreateRequest:
      properties:
        cron:
          type: string
          title: Cron
          description: >-
            AWS EventBridge schedule expression. Six space-separated fields,
            minutes first: `minutes hours day-of-month month day-of-week year`.
            This is neither five-field Unix crontab nor the seconds-first
            six-field dialect used by Quartz and cron-parser. Exactly one of
            day-of-month and day-of-week must be `?`, the other must be a real
            value. Schedules fire in UTC. Example: `0 12 ? * * *` runs daily at
            noon UTC. `rate(...)` expressions such as `rate(1 hour)` are
            accepted too.
        variables:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Variables
          description: >-
            Values passed to the function on every scheduled run. Must supply
            every function variable that has no default, and no names the
            function does not declare.
      type: object
      required:
        - cron
        - variables
      title: FunctionScheduleCreateRequest
    FunctionSchedule:
      properties:
        schedule_id:
          type: string
          title: Schedule Id
        cron:
          type: string
          title: Cron
        variables:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Variables
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
      type: object
      required:
        - schedule_id
        - cron
      title: FunctionSchedule
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.