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

# Create or update the project's scan schedule

> Every field is optional and unset fields keep their value, so `{ "enabled": true }` resumes a paused schedule. A project's first schedule copies its platforms and countries; later changes to the project's platforms or countries don't move it. Enabling checks the plan's cadences, multi-country support and the monthly credit pool.



## OpenAPI

````yaml /api-reference/openapi.json patch /projects/{id}/schedule
openapi: 3.1.0
info:
  title: OpenLens API
  version: 1.4.0
  description: >-
    Public REST API for OpenLens. Onboard clients, run scans across the major AI
    platforms, read visibility metrics, and download client-ready reports. Beta
    — endpoints may evolve before GA.
  contact:
    name: OpenLens support
    email: contact@aibread.com
servers:
  - url: https://openlens.com/api
security:
  - bearerAuth: []
tags:
  - name: Onboarding
  - name: Runs
  - name: Metrics
  - name: Citations
  - name: Deliverables
  - name: Resources
  - name: Account
paths:
  /projects/{id}/schedule:
    patch:
      tags:
        - Resources
      summary: Create or update the project's scan schedule
      description: >-
        Every field is optional and unset fields keep their value, so `{
        "enabled": true }` resumes a paused schedule. A project's first schedule
        copies its platforms and countries; later changes to the project's
        platforms or countries don't move it. Enabling checks the plan's
        cadences, multi-country support and the monthly credit pool.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                frequency:
                  type: string
                  enum:
                    - daily
                    - weekly
                    - monthly
                hour:
                  type: integer
                  minimum: 0
                  maximum: 23
                  deprecated: true
                  description: >-
                    Legacy: a UTC hour. Moves the schedule to the next
                    occurrence of that hour and repeats it in UTC. Ignored when
                    `startsAt` is set; prefer `startsAt` + `timezone`.
                startsAt:
                  type: string
                  format: date-time
                  description: >-
                    The first run, as ISO 8601 with its UTC offset (e.g.
                    `2026-11-02T09:00:00-05:00`). Within the next year.
                timezone:
                  type: string
                  description: >-
                    IANA time zone the schedule repeats in (e.g.
                    `America/New_York`), so runs keep their wall-clock time
                    across daylight saving changes. Send it with `startsAt`:
                    changing an existing schedule's zone without a start time is
                    a 400. Defaults to the current zone, or UTC for a new
                    schedule.
                scope:
                  type: object
                  description: What the schedule runs. Each field is optional.
                  properties:
                    promptIds:
                      type:
                        - array
                        - 'null'
                      items:
                        type: string
                        format: uuid
                      minItems: 1
                      description: >-
                        Prompts the schedule runs, or null for every active
                        prompt, including ones added later.
                    platforms:
                      type: array
                      items:
                        type: string
                        enum:
                          - chatgpt
                          - chatgpt_app
                          - claude
                          - gemini
                          - gemini_app
                          - grok_app
                          - grok_api
                          - perplexity
                          - perplexity_app
                          - google_app
                          - deepseek
                        description: >-
                          LLM platform identifier. Newer scraper-backed ids end
                          in `_app`; `chatgpt`, `perplexity`, and `gemini` are
                          legacy and not returned by current runs.
                      minItems: 1
                    countryCodes:
                      type: array
                      items:
                        type: string
                      minItems: 1
                      description: >-
                        ISO 3166-1 alpha-2 country codes. More than one needs a
                        plan with multi-country reporting.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  configured:
                    type: boolean
                    description: False until a schedule is saved for the project.
                  enabled:
                    type: boolean
                  frequency:
                    type: string
                    enum:
                      - daily
                      - weekly
                      - monthly
                  hour:
                    type: integer
                    minimum: 0
                    maximum: 23
                    deprecated: true
                    description: >-
                      UTC hour of `startsAt` (9 until configured). Prefer
                      `startsAt` + `timezone`.
                  startsAt:
                    type:
                      - string
                      - 'null'
                    format: date-time
                    description: >-
                      The first run; later runs repeat from it in `timezone`.
                      Null until configured.
                  timezone:
                    type:
                      - string
                      - 'null'
                    description: >-
                      IANA time zone the schedule repeats in. Null until
                      configured.
                  nextScheduledRunAt:
                    type:
                      - string
                      - 'null'
                    format: date-time
                    description: >-
                      The next run while the schedule is on; null while it is
                      off.
                  upcomingRunAt:
                    type:
                      - string
                      - 'null'
                    format: date-time
                    description: >-
                      When the schedule would run next, on or off: its next run,
                      or the next occurrence of its start. Null until
                      configured.
                  pauseReason:
                    type:
                      - string
                      - 'null'
                  allowedCadences:
                    type: array
                    items:
                      type: string
                      enum:
                        - daily
                        - weekly
                        - monthly
                  plan:
                    type: string
                  multiCountryEnabled:
                    type: boolean
                    description: Whether the plan can schedule more than one country.
                  scope:
                    type: object
                    properties:
                      promptIds:
                        type:
                          - array
                          - 'null'
                        items:
                          type: string
                          format: uuid
                        minItems: 1
                        description: >-
                          Prompts the schedule runs, or null for every active
                          prompt, including ones added later.
                      platforms:
                        type: array
                        items:
                          type: string
                          enum:
                            - chatgpt
                            - chatgpt_app
                            - claude
                            - gemini
                            - gemini_app
                            - grok_app
                            - grok_api
                            - perplexity
                            - perplexity_app
                            - google_app
                            - deepseek
                          description: >-
                            LLM platform identifier. Newer scraper-backed ids
                            end in `_app`; `chatgpt`, `perplexity`, and `gemini`
                            are legacy and not returned by current runs.
                        minItems: 1
                      countryCodes:
                        type: array
                        items:
                          type: string
                        minItems: 1
                        description: >-
                          ISO 3166-1 alpha-2 country codes. More than one needs
                          a plan with multi-country reporting.
                    required:
                      - promptIds
                      - platforms
                      - countryCodes
                  estimate:
                    type: object
                    description: Inputs for the schedule's monthly credit estimate.
                    properties:
                      activePrompts:
                        type: integer
                        description: Active prompts the scope covers today.
                      platforms:
                        type: array
                        items:
                          type: string
                          enum:
                            - chatgpt
                            - chatgpt_app
                            - claude
                            - gemini
                            - gemini_app
                            - grok_app
                            - grok_api
                            - perplexity
                            - perplexity_app
                            - google_app
                            - deepseek
                          description: >-
                            LLM platform identifier. Newer scraper-backed ids
                            end in `_app`; `chatgpt`, `perplexity`, and `gemini`
                            are legacy and not returned by current runs.
                      countries:
                        type: integer
                      pool:
                        type: number
                        description: The organization's monthly credit pool.
                    required:
                      - activePrompts
                      - platforms
                      - countries
                      - pool
                required:
                  - configured
                  - enabled
                  - frequency
                  - hour
                  - startsAt
                  - timezone
                  - nextScheduledRunAt
                  - upcomingRunAt
                  - pauseReason
                  - allowedCadences
                  - plan
                  - multiCountryEnabled
                  - scope
                  - estimate
        '400':
          description: >-
            Invalid schedule: a malformed field, an unknown time zone, a start
            more than a year out, an empty scope, prompts that aren't active in
            the project, or platforms outside your plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, malformed, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: >-
            Enabling the schedule needs an upgrade: a cadence outside the plan
            (code `PLAN_CADENCE_NOT_ALLOWED`), several countries without
            multi-country support, or more monthly credits than the pool has
            left (code `PROMPT_ALLOWANCE_RESERVATION`). Also returned when the
            tier's included API calls are used up (code `USAGE_LIMIT`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found or not owned by your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Rate limit, project cap, or daily quota hit. Body includes a `code`
            field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error. Retry; if persistent, contact support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            A requested platform is unavailable, or an inherited scope has no
            available platforms (code PLATFORM_UNAVAILABLE; platforms lists
            affected ids). Update the requested scope before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformUnavailableError'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable machine code for programmatic handling, when applicable.
      required:
        - error
    PlatformUnavailableError:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          const: PLATFORM_UNAVAILABLE
        platforms:
          type: array
          items:
            $ref: '#/components/schemas/PlatformId'
      required:
        - error
        - code
        - platforms
    PlatformId:
      type: string
      enum:
        - chatgpt
        - chatgpt_app
        - claude
        - gemini
        - gemini_app
        - grok_app
        - grok_api
        - perplexity
        - perplexity_app
        - google_app
        - deepseek
      description: >-
        LLM platform identifier. Newer scraper-backed ids end in `_app`;
        `chatgpt`, `perplexity`, and `gemini` are legacy and not returned by
        current runs.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Clerk API key. Create one from your account settings under API Keys.

````

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