When to use this
Use this when you need to spin up many positions at once — for example, migrating job templates from another ATS, or setting up a batch of roles for a hiring event — without recording a unique video for every position or question. The pattern: upload one intro video and one outro video, reuse theirmediaId across every position the script creates, and drive the rest (name, tags, questions, per-position or per-question overrides) from a plain JavaScript array you edit at the top of the script.
Before you start
- Node.js 18+ (for native
fetch) — confirm withnode -v. - Your Hireflix API Key, exported as
HIREFLIX_API_KEY. - Two local video files to use as the shared intro and outro (
.mp4,.mov, or.webm, max 150 MB each). - Read Creating a Position first if any of
createPosition,mediaId, or the reserve-upload flow is unfamiliar — this page builds directly on it.
Step 1: Upload the shared intro & outro videos
This script reserves an upload for an intro video and an outro video, PUTs both files to their presigned URLs, and prints the twomediaIds you’ll paste into the script in Step 2.
Save this as upload_shared_media.js.
upload_shared_media.js
1
Create the script file
Never run a script before? Open a plain-text editor — not Word or Google Docs, since those add hidden formatting that breaks the file. A free option that works on Mac and Windows is VS Code; Notepad (Windows) or TextEdit (Mac, switch to Format → Make Plain Text first) also work.Copy the full script above, paste it into a new file, and save it as
upload_shared_media.js in a folder you’ll remember, e.g. your Desktop.2
Open a terminal
- Mac: press
Cmd + Space, typeTerminal, press Enter. - Windows: press the Start key, type
Command Prompt(orPowerShell), press Enter.
3
Set your API key
4
Run the script
Pass the path to your intro video, then your outro video:It prints something like:Keep these two IDs — you’ll paste them into the next script.
Step 2: Bulk-create the positions
This script defines aPOSITIONS array — one entry per position, each with its own questions — and loops over it, calling createPosition once per entry. Every position reuses the same intro/outro mediaId from Step 1.
Before creating anything, it runs validatePositions() to check every position name, tag, and question title against Hireflix’s length limits (see LIMITS in the script). This catches mistakes like an over-length question title up front — otherwise you’d only find out after the 1st, 5th, or 20th position was already created, and now have a mix of created and not-yet-created positions to sort out.
The example array below shows the full range of what’s possible:
- The first position sends no
answerFormatat all for either question —video: {}is passed, so both questions inherit whatever default timing/retakes are currently configured in Hireflix, and the dashboard shows them as using the defaults, not custom settings. - The second position overrides the answer format for all of its questions (
answerFormatset at the position level). - One question in the second position goes further and sets its own
answerFormat, overriding the position-level value — showing the full override chain in one place.
bulk_create_positions.js.
bulk_create_positions.js
1
Paste your mediaIds
Open
bulk_create_positions.js and replace INTRO_MEDIA_ID and OUTRO_MEDIA_ID with the two values printed in Step 1.2
Customize the POSITIONS array
Edit the
POSITIONS array to match the roles you actually want to create — add or remove positions, change tags, add questions, and only set answerFormat at the position or question level where you actually need something other than Hireflix’s current defaults.3
Set your API key
4
Run the script
POSITIONS first, then logs each position as it’s created:Adding a per-question video
The script above only reuses the shared intro/outro — it doesn’t attach a video to individual questions. If you want that too, reserve a video per question withreservePositionQAVideoContentUpload, upload it the same way as Step 1, and add the resulting mediaId to that question’s questionFormat:
Key reminders
- The intro and outro
mediaIds are uploaded once and reused across every position inPOSITIONS— don’t callupload_shared_media.jsagain unless you want to change the shared videos. answerFormatresolves in this order: question-level → position-level →{}(Hireflix’s current default). Only set it where a question or position genuinely needs to differ — an explicitanswerFormatmarks that question as “custom” in the dashboard even when the values match the defaults, and hardcoded numbers in the script can silently drift from the real defaults if those ever change in Hireflix.- Unsure what the current default
maxDurationSeconds,timeToThinkSeconds, ornumAllowedRetakesare, or what each setting means for candidates? See Tailoring the Interview. validatePositions()runs before any position is created, checking name/tag/question-title lengths againstLIMITS. Extend it if you add other fields toPOSITIONSthat carry their own length limits.- The script is otherwise fail-fast — a
createPositionfailure not caught by validation still stops the whole run. Re-running after a partial failure will recreate the positions that already succeeded, so trimPOSITIONSdown to the ones that failed before re-running.
Learn next?
Now that you’ve bulk-created positions, let’s learn how to fetch positions — handy for confirming what the script created, or looking up IDs for later updates.

