Reindex Files
Retry the files a job failed to index, as a new job, from the job id alone.
The new job reuses the original job's source, options and collection. It retries only the files that failed or never finished, and leaves files that indexed alone. It runs on the current pipeline and is billed like any other indexing job. When the original job failed before it reached any file, the whole job runs again, still skipping any file that already indexed.
When to use it
- A job finished as
failed,timed_outorcompleted_with_errors, and the cause is fixed (a file was corrected at its source, a permission was granted, or a temporary error passed). - Retry within 90 days of the original job. After that its run history is gone and the request returns
410 job_too_old.
To retry a job started by a sync, re-run the sync.
Response
200 returns the new job's job_id and reindex_of, the id of the job it retries. Track the new job with GET /v2/jobs/{job_id}. Calling this again for the same job within 24 hours returns the same new job, so repeating the request is safe.
Errors
Errors from the retry checks return code and message. A 403 or 429 returns error (HTTP_ERROR) and message instead, with no code.
| Status | code | Meaning |
|---|---|---|
| 403 | The API key lacks the index permission. | |
| 404 | job_not_found | No such job in this organization and environment. |
| 409 | job_running | The job is still running, or a retry of it is already starting. Wait, then try again. |
| 409 | job_not_failed | The job completed or was cancelled, so there is nothing to retry. |
| 409 | nothing_to_retry | The job has no failed files left. |
| 409 | use_sync_reconcile | The job came from a sync. Re-run the sync. |
| 409 | dropbox_token_required | Dropbox tokens expire. Start a new Dropbox indexing job with a fresh token. |
| 409 | overwrite_job | The job replaced existing files, which cannot be safely redone. Start a new job with overwrite_existing. |
| 409 | credentials_failed | The job failed because its storage credentials were refused. Start a new job with working credentials. |
| 410 | job_too_old | The job is older than 90 days. |
| 410 | collection_gone | The collection the job indexed into was deleted. |
| 410 | upload_missing | A file uploaded for the original job is gone. Upload it again in a new job. |
| 429 | Too many indexing jobs are running. Retry when one finishes. | |
| 503 | temporarily_unavailable | Retry shortly. |
Path parameters
Headers
Response
Successful Response
The id of the failed job this job retries.
The custom_metadata Captain accepted for this job, echoed back as validated. Null when none was supplied.
pendingErrors
import json
import requests
BASE_URL = "https://api.filesearch.dev"
API_KEY = "your_api_key"
JOB_ID = "job_abc123"
headers = {
"Authorization": f"Bearer {API_KEY}",
}
response = requests.post(
f"{BASE_URL}/v2/jobs/{JOB_ID}/reindex",
headers=headers,
timeout=30.0,
)
print(json.dumps(response.json(), indent=2)){
"job_id": "job_def456",
"reindex_of": "job_abc123",
"custom_metadata": null,
"status": "pending"
}