Enrichment Control (Pause & Resume)
A submitted enrichment job can be paused mid-run and resumed later. Pause/resume is controlled via a separate endpoint and uses the same job_id returned by Submit.
Overview
Base URL
| Environment | URL |
|---|---|
| Production | https://<host>/api/v1/enrichment-control/ |
| Staging | https://test.ecoreservice.com/backend/api/v1/enrichment-control/ |
Authentication
Bearer API token in the Authorization header — same as Submit. The job must belong to the authenticated user.
Authorization: Bearer <your_token>
Control Endpoint
Endpoint: /api/v1/enrichment-control/
Method: POST
Description: Pause an in-progress job, or resume a paused job.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
csv_file_id | UUID string | Yes | The job_id returned by Submit |
action | string | Yes | pause or resume |
Example cURL Request (Pause)
curl --location --request POST 'https://test.ecoreservice.com/backend/api/v1/enrichment-control/' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"csv_file_id": "9f3e7a2b-7c1d-4f12-8c9a-1b2c3d4e5f60",
"action": "pause"
}'
Example cURL Request (Resume)
curl --location --request POST 'https://test.ecoreservice.com/backend/api/v1/enrichment-control/' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"csv_file_id": "9f3e7a2b-7c1d-4f12-8c9a-1b2c3d4e5f60",
"action": "resume"
}'
Pause Behavior
- Pause is only valid while the job is in Enrichment Started state (
status: in-progresson the Status endpoint). - When paused, the pipeline writes a checkpoint with
rows_processed,input_rows_processed,is_phone, andis_email. - Already-processed rows are persisted; remaining rows are deferred until resume.
- Status flips to
paused. Results-so-far are fetchable via the Results endpoint.
Resume Behavior
- Resume is only valid while the job is in Paused state.
- The endpoint estimates cost for the remaining rows (using the same per-row rates as the original submission) and deducts that amount from the wallet.
- The original deduction is not refunded, and no double-charge occurs — the system pays only for unprocessed rows.
- If the checkpoint is missing or invalid (e.g., a crash during pause), resume is rejected with a
400to prevent a double-charge — contact support to recover the job. - If the checkpoint shows all rows already processed, the resume runs a fast-exit path that finalizes stats, applies post-enrichment verification, and marks the job complete without re-processing rows.
Successful Response
{
"status": "ok",
"job_id": "9f3e7a2b-7c1d-4f12-8c9a-1b2c3d4e5f60",
"action": "pause",
"message": "Job paused successfully"
}
Error Responses
| HTTP | When | Body |
|---|---|---|
| 400 | Invalid action, job not in correct state for pause/resume, or missing/invalid checkpoint on resume | { "error": "..." } |
| 401 | Missing or invalid Bearer token | { "message": "Invalid or expired token" } |
| 402 | Insufficient wallet balance to resume the remaining rows | { "error": "You require N credits, but only M are available." } |
| 404 | job_id not found for the caller | Standard DRF error envelope |
| 500 | Unexpected server-side failure | Standard DRF/Django error envelope |
Try It Out
Explore the Control endpoint in the API Playground (password: EluuEz0J).