Reindex Files

POSThttps://api.filesearch.dev/v2/jobs/:job_id/reindex

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_out or completed_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.

StatuscodeMeaning
403The API key lacks the index permission.
404job_not_foundNo such job in this organization and environment.
409job_runningThe job is still running, or a retry of it is already starting. Wait, then try again.
409job_not_failedThe job completed or was cancelled, so there is nothing to retry.
409nothing_to_retryThe job has no failed files left.
409use_sync_reconcileThe job came from a sync. Re-run the sync.
409dropbox_token_requiredDropbox tokens expire. Start a new Dropbox indexing job with a fresh token.
409overwrite_jobThe job replaced existing files, which cannot be safely redone. Start a new job with overwrite_existing.
409credentials_failedThe job failed because its storage credentials were refused. Start a new job with working credentials.
410job_too_oldThe job is older than 90 days.
410collection_goneThe collection the job indexed into was deleted.
410upload_missingA file uploaded for the original job is gone. Upload it again in a new job.
429Too many indexing jobs are running. Retry when one finishes.
503temporarily_unavailableRetry shortly.

Path parameters

job_idstringRequired

Headers

authorizationstring or nullOptional

Response

Successful Response

job_idstring
reindex_ofstring

The id of the failed job this job retries.

custom_metadataobject or nullOptional

The custom_metadata Captain accepted for this job, echoed back as validated. Null when none was supplied.

statusstringOptionalDefaults to pending

Errors

POST/v2/jobs/:job_id/reindex
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))
200Successful
{
  "job_id": "job_def456",
  "reindex_of": "job_abc123",
  "custom_metadata": null,
  "status": "pending"
}
Was this page helpful?