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

# Create scheduled task

> Use when setting up recurring data exports or other scheduled jobs. Ideal for report generation or syncing data on a schedule.



## OpenAPI

````yaml /api-reference/openapi.json post /tasks/scheduled
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /tasks/scheduled:
    post:
      tags:
        - Scheduled Tasks
      summary: Create scheduled task
      description: >-
        Use when setting up recurring data exports or other scheduled jobs.
        Ideal for report generation or syncing data on a schedule.
      operationId: createScheduledTask
      requestBody:
        description: Scheduled Task
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduledTaskRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledTaskResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreateScheduledTaskRequest:
      required:
        - connection_id
        - entity_type
        - interval
        - job_config
      type: object
      properties:
        connection_id:
          type: string
        enabled:
          type: boolean
        entity_type:
          $ref: '#/components/schemas/types.ScheduledTaskEntityType'
        interval:
          $ref: '#/components/schemas/types.ScheduledTaskInterval'
        job_config:
          $ref: '#/components/schemas/types.S3JobConfig'
    ScheduledTaskResponse:
      type: object
      properties:
        connection_id:
          type: string
        created_at:
          type: string
          format: date-time
        enabled:
          type: boolean
        entity_type:
          $ref: '#/components/schemas/types.ScheduledTaskEntityType'
        environment_id:
          type: string
        id:
          type: string
        interval:
          $ref: '#/components/schemas/types.ScheduledTaskInterval'
        job_config:
          $ref: '#/components/schemas/types.S3JobConfig'
        status:
          type: string
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
    errors.ErrorResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - not_found
            - already_exists
            - version_conflict
            - validation_error
            - invalid_operation
            - permission_denied
            - http_client_error
            - database_error
            - system_error
            - internal_error
            - service_unavailable
        details:
          type: object
          additionalProperties:
            type: object
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.ScheduledTaskEntityType:
      type: string
      enum:
        - events
        - invoice
        - credit_topups
        - credit_usage
      x-enum-varnames:
        - ScheduledTaskEntityTypeEvents
        - ScheduledTaskEntityTypeInvoice
        - ScheduledTaskEntityTypeCreditTopups
        - ScheduledTaskEntityTypeCreditUsage
      x-speakeasy-name-override: ScheduledTaskEntityType
    types.ScheduledTaskInterval:
      type: string
      enum:
        - 15MIN
        - 30MIN
        - custom
        - hourly
        - daily
      x-enum-comments:
        ScheduledTaskIntervalCustom: 10 minutes for testing
      x-enum-varnames:
        - ScheduledTaskIntervalEvery15Minutes
        - ScheduledTaskIntervalEvery30Minutes
        - ScheduledTaskIntervalCustom
        - ScheduledTaskIntervalHourly
        - ScheduledTaskIntervalDaily
      x-speakeasy-name-override: ScheduledTaskInterval
    types.S3JobConfig:
      type: object
      properties:
        bucket:
          type: string
          description: S3 bucket name
        compression:
          $ref: '#/components/schemas/types.S3CompressionType'
        encryption:
          $ref: '#/components/schemas/types.S3EncryptionType'
        endpoint_url:
          type: string
          description: Custom S3 endpoint URL (e.g., "http://minio:9000" for MinIO)
        key_prefix:
          type: string
          description: Optional prefix for S3 keys (e.g., "flexprice-exports/")
        region:
          type: string
          description: AWS region (e.g., "us-west-2")
        use_path_style:
          type: boolean
          description: >-
            Use path-style addressing instead of virtual-hosted-style (required
            for MinIO)
      x-speakeasy-name-override: S3JobConfig
    types.S3CompressionType:
      type: string
      enum:
        - none
        - gzip
      x-enum-varnames:
        - S3CompressionTypeNone
        - S3CompressionTypeGzip
      x-speakeasy-name-override: S3CompressionType
    types.S3EncryptionType:
      type: string
      enum:
        - AES256
        - aws:kms
        - aws:kms:dsse
      x-enum-varnames:
        - S3EncryptionTypeAES256
        - S3EncryptionTypeAwsKms
        - S3EncryptionTypeAwsKmsDsse
      x-speakeasy-name-override: S3EncryptionType
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````