Production Checklist
Before moving from a script to production, go through this checklist item by item. Each item links to the details.
Security
Section titled “Security”- API keys live only in server-side environment variables or a secrets manager, and never appear in frontend code, apps, code repositories, or logs. See Authentication.
- Production and testing use different keys, and keys for short-lived purposes have an expiry date.
- Your team knows what to do if a key leaks: roll it in the console and choose “Immediately”, or disable it. See Manage API Keys.
- You have a key rotation process: when rolling a key, give the old key a grace period, and let it expire only after the new key is deployed.
Asynchronous tasks and reliability
Section titled “Asynchronous tasks and reliability”- You persist the
task_idright after submitting, and record the submission time and parameters in your own system. - You poll about every 15 seconds, with a scheduled loop that checks unfinished tasks in batches instead of blocking per task. See Task Lifecycle.
- A business timeout doesn’t mean failure: after a timeout you keep the
task_idand can still fetch the result later. - You decide success or failure from
statusonly, and never treat a non-emptyerror_codeas failure. - When a submit request times out, disconnects, or returns
-1, you check List Tasks first instead of blindly resubmitting. See Error Handling. - If you use
wait_seconds, your HTTP client timeout is longer thanwait_seconds, and you handle a non-final task coming back.
Requests and error handling
Section titled “Requests and error handling”- You decide whether a request succeeded from
retin the response body, not the HTTP status code — while also handling non-200 statuses and network errors. - You parse
msg(a JSON string) into a displayable message, falling back to the raw text if parsing fails. - Request bodies contain only fields defined by the endpoint, in snake_case (
task_id,wait_seconds). - Your response parsing ignores unknown fields, so new fields added later don’t break it.
-
-1,1024, and1025are retried with backoff;1001,1003,1022,1023,1029,1030, and1031aren’t retried automatically but raise an alert or a message. - An unknown
error_codeis treated as “task failed, not charged”, and itserror_messageis logged.
Rate limits and cost
Section titled “Rate limits and cost”- Bulk submissions are throttled on the client to stay under the per-minute limit, with backoff on
1024/1025. See Rate Limits & Quotas. - The platform list is fetched from the API, not hardcoded, and platforms in
maintenanceare skipped. - You pick the tier by use case: P2 for batch and scheduled work, P1 for time-sensitive work. See Platforms, Priority & Country.
- You get an alert when your balance drops below a threshold (the console Usage page shows balance and expiry), so tasks don’t stall on
1023. See Billing & Credits.
Result parsing
Section titled “Result parsing”- You check that
raw_resultexists before reading it, and fill in defaults for omitted zero-value fields. -
elapsedMsis parsed from a string into a number. -
citedis handled as three states, with a missing field not treated asfalse. See Working with Results. - When you use thinking mode, you check
raw_result.thinkingto see whether it was actually on, rather than trusting thethinkingyou submitted. See Thinking mode. -
urlis checked to be anhttp(s)link before use. - Images you need long-term are copied to your own storage (
imageUrlexpires). - Platform citation markers in the answer text are cleaned up as needed before showing it to users.
Observability
Section titled “Observability”- For each request you log the endpoint,
ret, latency,task_id, and theipalfish-trace-idresponse header (if present), to help with troubleshooting. - You monitor the task failure rate and the distribution of
error_codevalues per platform; if a platform keeps returningcrawl_failed, consider switching temporarily. - You regularly reconcile against the console Request Logs and Usage pages.
Related pages
Section titled “Related pages”API OverviewConventions shared by every request and response.
FAQCommon questions during integration.
