---
title: "Create a new task"
method: POST
path: "/tasks"
tags: ["Tasks"]
---

# Create a new task

`POST /tasks`

Use when submitting a file or job for async processing (e.g. export or import). Returns task ID to poll for status and result.

## Request body

- CreateTaskRequest
  - `entity_type` 'EVENTS' | 'PRICES' | 'CUSTOMERS' | 'FEATURES', required
  - `file_name` string
  - `file_type` 'CSV' | 'JSON', required
  - `file_url` string, required
  - `metadata` object
  - `task_type` 'IMPORT' | 'EXPORT', required

## Response `202`

Accepted

- TaskResponse
  - `completed_at` string, date-time
  - `created_at` string, date-time
  - `created_by` string
  - `entity_type` 'EVENTS' | 'PRICES' | 'CUSTOMERS' | 'FEATURES'
  - `environment_id` string
  - `error_summary` string
  - `failed_at` string, date-time
  - `failed_records` integer
  - `file_name` string
  - `file_type` 'CSV' | 'JSON'
  - `file_url` string
  - `id` string
  - `metadata` object
  - `processed_records` integer
  - `scheduled_task_id` string
  - `started_at` string, date-time
  - `status` 'published' | 'deleted' | 'archived'
  - `successful_records` integer
  - `task_status` 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED'
  - `task_type` 'IMPORT' | 'EXPORT'
  - `tenant_id` string
  - `total_records` integer
  - `updated_at` string, date-time
  - `updated_by` string
  - `workflow_id` string

## Other responses

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

## Changes

- **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`
- **2026-04-06** `95af41a12111` — 4 warning, 8 info
  - removed the optional property `error` from the response with the `400` status
  - removed the optional property `error` from the response with the `500` status
  - removed the optional property `success` from the response with the `400` status
  - removed the optional property `success` from the response with the `500` status
  - …8 more

[Change history](https://skmtc.dev/flexprice/apis/flexprice-api/changes/tasks/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/8ec2edea6b20/schema)
