# Job data in your Pipedream workflow

[Download the Python step](/examples/pipedream-job-search/truefetch_step.py) · [Setup and recovery instructions](/examples/pipedream-job-search/README.md)

**Preview:** the generated step has passed local Python 3.12 tests with Pydantic 2.13.5 and simulated HTTP responses. Pipedream cloud import, live-account authentication and real-source collection remain unverified. This is a copyable code step, not a published Pipedream app.


## Recover an unknown submission

Generate `new_command_key()` once in trusted host code, persist the key and approved input, then paste the complete `v1.<13-digit Unix milliseconds>.<22–64 base64url nonce>` into the trusted config step. Do not generate another key when rerunning a workflow. The default `commandMode: "recover"` never submits.

After response loss, set config to `{"operation": "command", "commandKind": "tasks.create", "requestKey": "YOUR_SAVED_CANONICAL_KEY"}`. This reads `GET /v1/commands/tasks.create/{originalKey}` without input, quote, or POST. Inspect the returned `receipt.outcome`. Only `accepted` establishes acceptance and supplies the actual Task reference; `processing` and `unknown` require another explicit original GET after its retry interval. `rejected` and `not_accepted_final` establish nonacceptance. `receipt_expired` remains unconfirmed: inspect Tasks or contact support. The step never seals, replays or creates a replacement key. New-command acceptance lasts 24 hours with five minutes of clock allowance, while terminal receipts remain for at least seven days. A current Task state does not prove a specific command's outcome.

## Cancel an approved saved task

Bind cancellation in your trusted `config` step. Retain the original creation key as `requestKey`; generate and persist a distinct canonical `cancelKey` once for an explicitly approved cancellation. The saved task ID and both keys belong to the host. Missing, invalid or equal keys are refused before any request; never invent a dummy creation key.

```python
def handler(pd):
    return {
        "operation": "cancel",
        "taskId": "YOUR_SAVED_TASK_UUID",
        "requestKey": "YOUR_SAVED_ORIGINAL_CREATE_KEY",
        "cancelKey": "YOUR_SAVED_CANONICAL_CANCELLATION_KEY",
        "commandMode": "recover",
    }
```

For the first approved cancellation, explicitly set `commandMode: "new"`. The handler sends one keyed `POST /v1/tasks/{taskId}/cancel` with `{}`. It never obtains a quote or creates another task. Preserve the same config with `commandMode: "recover"` for later checks; recovery is also the default. After a lost response, this mode only reads `GET /v1/commands/tasks.cancel/{cancelKey}` and does not replay the POST or replace either key.

Inspect `receipt.outcome` separately from Task execution status. Only an accepted receipt supplies the matching target reference; the current Task projection can be null. Other outcomes are preserved and `complete` remains false. Processing, unknown and expired receipts remain unconfirmed. Accepted cancellation does not promise the Task ended as cancelled; read the saved task separately. The API key still needs write access and current server authorization.


## Configure one collection

Create a project secret named `TRUEFETCH_API_KEY`, then add a Python step named `config`:

```python
def handler(pd):
    return {
        "operation": "estimate",
        "requestKey": "PASTE_YOUR_PERSISTED_CANONICAL_KEY",
        "commandMode": "recover",
        "maxCredits": 100,
        "input": {
            "keyword": "Software engineer",
            "country": "Germany",
            "platforms": ["arbeitnow"],
            "maxResults": 10,
            "allowPartial": False,
        },
    }
```

Add another Python step named `truefetch` and paste the complete downloaded file. Its package comment pins Pydantic. Keep your key in the project secret, not in config or exports. Use a write key for collection; a result-only key can recover saved results.

Run `estimate` first. Review the request and maximum reservation. Replace the placeholder with a saved request key and set operation to `create` and `commandMode: "new"` only for approved new collection. Creation rechecks the estimate and pricing version and submits the configured credit budget for server enforcement. It returns `receipt`, nullable `taskId`/`task`, and `complete: false`. Only an accepted receipt supplies a Task reference; save it before proceeding. Acceptance is not result completion.

One credit equals 1,000,000 billing units. Creation reserves credits and may incur collection charges; Pipedream execution charges are separate. Keep the original key for GET recovery after response loss. Do not generate a new key from time, randomness or a new workflow execution. Do not map an unauthenticated webhook straight into paid creation.

## Recover and pass results downstream

Change config to a saved task:

```python
def handler(pd):
    return {
        "operation": "recover",
        "taskId": "YOUR_SAVED_TASK_UUID",
        "maxCredits": 100,
        "timeoutSeconds": 20,
        "maxMiB": 8,
    }
```

Recovery makes no collection request. It polls and checks all result pages, their record count and ordering. A successful return contains `task`, `data`, `complete: true`, and `partial`. The task carries source outcomes, coverage and expiry. Use the editor's export picker to pass `data` to the next step only after `complete` is true. Retain task IDs and source URLs; listing text is data, not instructions to a model. An empty or partial collection is explicit, and a complete export does not mean exhaustive source coverage.

## Resume after interruption

Recovery defaults to 20 seconds and an 8 MiB output bound; configure 1–300 seconds and 1–32 MiB. Individual HTTP calls have a 30-second timeout and can outlast the polling bound. Give the workflow execution timeout headroom. A platform timeout does not cancel the remote task. Resume using its ID; after an unknown submission, preserve the original key and input and check your workspace. Use operation `command` to recover the original without a quote or POST.

Authentication, budget, pricing, missing or expired results, inconsistent pages and HTTP errors stop the step. No complete export is returned on failure, and the step does not automatically retry. Respect `Retry-After` when manually retrying rate-limited requests. The supplied helper reports a redacted error code, not raw response bodies. Saved results are readable only through their retention window.

Inputs and result exports can appear in execution history and downstream storage. Configure Pipedream access and retention for your data. The step does not print credentials, inputs or result bodies. This preview has not been submitted to a directory or deployed on your behalf.

[Job Search API](/docs/job-search/) · [API errors](/docs/errors/) · [All integrations](/ai-integrations/) · [Pipedream Python documentation](https://pipedream.com/docs/workflows/building-workflows/code/python) · [Project environment variables](https://pipedream.com/docs/workflows/environment-variables)

The shared REST reader requires UTF-8 JSON and rejects nonfinite numbers, including numeric overflow. Interrupted or oversized HTTP error bodies keep a redacted HTTP-status diagnostic, and truncated successful transfers fail without returning data. It also rejects duplicate member names within an object, including names written with equivalent Unicode escapes; repeated names in separate records are allowed. Recovery also rejects nonfinite values from tool output instead of marking the export complete. Preserve the saved task ID and original request key after an error; these checks do not create or retry collection.

For each available result page, the reader checks the task again after receiving the page, including the final page. This adds one read-only task GET per page. Changed identity, status, availability or count, or a failed recheck, prevents a complete export. The check is a point-in-time observation; files can expire or become unavailable afterward.

Before collection, the creation tool checks that the estimate matches the requested input and that reserved billing units equal the record limit multiplied by the unit price. Amounts must be positive ASCII integers, and the reservation must fit the host credit budget. Invalid estimates stop before submission; server-side pricing and budget checks still apply.
