Batches & automations
Run CleanScript from n8n, Make or Zapier, and process many posts from code.
n8n, Make and Zapier
Each call is one HTTP step. Set it up like this in any tool:
- Method and URL:
POST https://api.cleanscript.ai/v1/transcript, or/v1/extractfor fields. - Header:
Authorizationwith the valueBearer <key>. Store it as a credential, not in the step. - Body (JSON):
{"url": "<the post link>", "include": ["text"]}for the transcript as one text field, or{"url": "<the post link>"}plusprompt,presetorschemafor fields. - Timeout: 100 seconds or more; we answer within 90. Short posts answer in seconds.
- Next steps: map
text(transcript) ordata(fields) from the response.
In n8n, use the HTTP Request node with a Header Auth credential and Send Body as JSON; set the timeout under Options. In Make, use HTTP, Make a request, with Parse response on. In Zapier, use Webhooks by Zapier, Custom Request.
If a step gives up or answers processing, run it again after 30 seconds: the same request is never charged twice within 6 hours, and a request that fails is never charged.
Many posts from code
New accounts can send 10 requests a minute; yours is rate_limit_per_minute in GET /v1/account. Run a few requests at a time; the SDKs wait and retry when you hit the limit (429), a temporary error (503) or a timeout (504, or 409 while the first try still runs), follow a long post until it finishes, and send an Idempotency-Key so a retry is never charged twice.
from concurrent.futures import ThreadPoolExecutor
from cleanscript_ai import CleanScript, CleanScriptError, transcript_text
client = CleanScript(max_retries=4)
def run(url):
try:
return url, transcript_text(client.transcript(url))
except CleanScriptError as error:
return url, error # error.code says why: video_unavailable, no_captions…
with ThreadPoolExecutor(max_workers=4) as pool:
for url, result in pool.map(run, urls):
print(url, result)Handle failures by code
- Retry later:
rate_limited,source_unavailable,processing_failed(the SDKs retry these for you; over HTTP, wait forRetry-After),processing(the same request again returns the result) andtimeout(retry once). - Skip and record:
video_unavailable,no_captions,video_too_long,processing_limit,language_unavailable,invalid_url,unsupported_platform. Retrying won't change the answer. - Stop the batch:
insufficient_credits(top up, then resume) andunauthorized(check the key).
Over HTTP, send an Idempotency-Key header unique to the request, such as transcript- plus the post ID, and reuse it when you retry that same request: within 6 hours a retry returns the first successful result; after a failure, it runs again.
Before a large batch
Check your balance with the free GET /v1/account, or in X-Credits-Remaining on any response. A 10-minute video costs 1 credit for its transcript, or 3 credits with fields; see Credits & limits for the rates.