Upload a file

Upload a script or dictionary file and bind it to a workflow.

Use an uploaded file as a workflow’s script instead of inline text. Uploads use a presigned-URL flow (create → PUT bytes → confirm) and require the uploads:write scope.

Categories: script (.txt, .docx) or dictionary (.csv). Audio uploads use a separate endpoint not available via API key.

1import httpx
2from onepin import OnepinClient
3
4client = OnepinClient()
5
6# 1. create the upload record and get a presigned URL
7created = client.uploads.create(filename="script.txt", category="script").data
8upload_id, upload_url = created.upload.id, created.upload_url
9
10# 2. PUT the bytes straight to storage (not via the SDK)
11with open("script.txt", "rb") as f:
12 httpx.put(upload_url, content=f.read()).raise_for_status()
13
14# 3. confirm and bind it to a workflow
15client.uploads.confirm(upload_id, context_type="workflow", context_id=workflow_id)
  • Script — pointing a script node at an upload