---
title: "Cancel a file import"
method: POST
path: "/file_imports/{id}/cancel"
---

# Cancel a file import

`POST /file_imports/{id}/cancel`

Sets `cancellation_requested_at` so the running job exits cleanly to `cancelled` on its next heartbeat. Idempotent — re-cancelling just bumps the timestamp.

## Path parameters

- `id` string, required

## Response `202`

Cancel accepted

- FileImport — A file import (CSV/NACHA upload or bulk API submission) and its ingestion lifecycle. Aggregate fields (record_count, total_credits, total_debits, net_amount, date_range_start, date_range_end, currency) are merged in only on the stream-scoped index GET /data_streams/{key}/file_imports, and are trustworthy once status is `completed`.
  - `id` integer
  - `status` 'pending' | 'processing' | 'replicating' | 'completed' | 'failed' | 'cancelled'
  - `source` string, nullable — Origin of the import (e.g. `csv`, `nacha`, `bulk_api`)
  - `filename` string, nullable
  - `total_items` integer
  - `processed_items` integer
  - `successful_items` integer
  - `failed_items` integer
  - `skipped_items` integer — Records skipped due to `on_conflict: skip` matching an existing `external_id`
  - `expected_records_count` integer, nullable
  - `progress` integer — processed_items / total_items as a percentage (0-100)
  - `parsing` boolean — True until rows start landing; file totals are unknown while parsing
  - `decimal_places` integer — Number of decimal places (2 for USD)
  - `stuck` boolean — Currently processing with no heartbeat for >5 minutes
  - `on_conflict` string, nullable
  - `error_message` string, nullable
  - `error_details` object, nullable
  - `data_stream_ids` integer[]
  - `created_at` string, date-time
  - `started_at` string, date-time, nullable
  - `records_written_at` string, date-time, nullable
  - `completed_at` string, date-time, nullable
  - `last_progress_at` string, date-time, nullable
  - `cancellation_requested_at` string, date-time, nullable
  - `url` string — e.g. /v1/file_imports/123
  - `records_url` string — e.g. /v1/file_imports/123/records
  - `record_count` integer — Aggregate; stream-scoped index only
  - `total_credits` integer — Aggregate, in cents; stream-scoped index only
  - `total_debits` integer — Aggregate, in cents; stream-scoped index only
  - `net_amount` integer — Aggregate: credits minus debits, in cents; stream-scoped index only
  - `date_range_start` string, date, nullable — Aggregate; stream-scoped index only
  - `date_range_end` string, date, nullable — Aggregate; stream-scoped index only
  - `currency` string, nullable — Aggregate; stream-scoped index only

## Other responses

- `401` — Unauthorized
- `404` — File import not found
- `409` — File import is not in a cancellable status

---

[API](https://skmtc.net/endclose/apis/end-close-api.md) · [All operations](https://skmtc.net/endclose/apis/end-close-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/endclose/end-close-api/revisions/613ceff68dc7/schema)
