---
title: "Create scheduled task"
method: POST
path: "/tasks/scheduled"
tags: ["Scheduled Tasks"]
---

# Create scheduled task

`POST /tasks/scheduled`

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

## Request body

- CreateScheduledTaskRequest
  - `connection_id` string, required
  - `enabled` boolean
  - `entity_type` 'events' | 'invoice' | 'credit_topups' | 'credit_usage' | 'usage_analytics', required
  - `interval` '15MIN' | '30MIN' | 'custom' | 'hourly' | 'daily', required
  - `job_config` TypesS3JobConfig, required
    - `bucket` string — S3 bucket name
    - `compression` 'none' | 'gzip'
    - `encryption` 'AES256' | 'aws:kms' | 'aws:kms:dsse'
    - `endpoint_url` string — Custom S3-compatible endpoint URL; must be https on a publicly routable host
    - `export_metadata_fields` TypesExportMetadataField[] — Optional user-selected metadata columns
      - `column_name` string — CSV column header to be shown in the exported file
      - `entity_type` 'customer' | 'wallet', required
      - `field_key` string, required — metadata key to look up
    - `key_prefix` string — Optional prefix for S3 keys (e.g., "flexprice-exports/")
    - `region` string — AWS region (e.g., "us-west-2")
    - `use_path_style` boolean — Use path-style addressing (required for MinIO)

## Response `201`

Created

- ScheduledTaskResponse
  - `connection_id` string
  - `created_at` string, date-time
  - `enabled` boolean
  - `entity_type` 'events' | 'invoice' | 'credit_topups' | 'credit_usage' | 'usage_analytics'
  - `environment_id` string
  - `id` string
  - `interval` '15MIN' | '30MIN' | 'custom' | 'hourly' | 'daily'
  - `job_config` TypesS3JobConfig
    - `bucket` string — S3 bucket name
    - `compression` 'none' | 'gzip'
    - `encryption` 'AES256' | 'aws:kms' | 'aws:kms:dsse'
    - `endpoint_url` string — Custom S3-compatible endpoint URL; must be https on a publicly routable host
    - `export_metadata_fields` TypesExportMetadataField[] — Optional user-selected metadata columns
      - `column_name` string — CSV column header to be shown in the exported file
      - `entity_type` 'customer' | 'wallet', required
      - `field_key` string, required — metadata key to look up
    - `key_prefix` string — Optional prefix for S3 keys (e.g., "flexprice-exports/")
    - `region` string — AWS region (e.g., "us-west-2")
    - `use_path_style` boolean — Use path-style addressing (required for MinIO)
  - `status` string
  - `tenant_id` string
  - `updated_at` string, date-time

## Other responses

- `400` — Invalid request
- `500` — Server error

## Changes

- **2026-07-15** `f8ecf435d25d` — 2 warning
  - added the new `not_implemented` enum value to the `code` response property for the response status `400`
  - added the new `not_implemented` enum value to the `code` response property for the response status `500`
- **2026-07-09** `7d57386313c7` — 8 breaking, 10 warning, 26 info
  - request property `entity_type` was restricted to a list of enum values
  - request property `interval` was restricted to a list of enum values
  - the `entity_type` request property type/format changed from ``/`` to `string`/``
  - the `interval` request property type/format changed from ``/`` to `string`/``
  - …40 more
- **2026-07-09** `4b1a811c4179` — 18 breaking, 16 warning, 10 info
  - removed the enum value `15MIN` of the request property `interval`
  - removed the enum value `30MIN` of the request property `interval`
  - removed the enum value `credit_topups` of the request property `entity_type`
  - removed the enum value `credit_usage` of the request property `entity_type`
  - …40 more
- **2026-05-18** `8ec2edea6b20` — 4 warning
  - removed the optional property `details` from the response with the `400` status
  - removed the optional property `details` from the response with the `500` status
  - added the new `too_many_requests` enum value to the `code` response property for the response status `400`
  - added the new `too_many_requests` enum value to the `code` response property for the response status `500`
- …earlier changes not shown

[Full history](https://skmtc.dev/flexprice/apis/flexprice-api/changes/tasks/scheduled/post.md)

---

[API](https://skmtc.dev/flexprice/apis/flexprice-api.md) · [All operations](https://skmtc.dev/flexprice/apis/flexprice-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/flexprice/flexprice-api/revisions/9cd0dab91f5c/schema)
