Skip to main content

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 their mediaId 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.
This assumes a shared intro/outro across all positions. If you want a unique video per position or per question, that’s usually easier to record and upload from the dashboard — see the note on adding a per-question video at the end of this page if you want to extend the script to do that too.

Before you start

  • Node.js 18+ (for native fetch) — confirm with node -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 two mediaIds 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, type Terminal, press Enter.
  • Windows: press the Start key, type Command Prompt (or PowerShell), press Enter.
Then move into the folder where you saved the script, e.g.:
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 a POSITIONS 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 answerFormat at 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 (answerFormat set 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.
Don’t hardcode the account/position default numbers (e.g. maxDurationSeconds: 120) into the script “just to be explicit.” Hireflix flags a question as having custom settings in the dashboard as soon as it receives an explicit answerFormat, even if the values happen to match the current defaults — and if a real default later changes in Hireflix, a script carrying stale hardcoded numbers would silently diverge from it. Only set answerFormat for questions that are genuinely meant to differ; leave it out (video: {}) everywhere else.
Save this as 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

Skip this if you already exported it in Step 1 and you’re still in the same terminal session.
4

Run the script

It validates POSITIONS first, then logs each position as it’s created:
If a title, tag, or name is too long, it stops before creating anything and lists every problem it found, instead of failing midway through the array:
validatePositions() only catches length problems it knows about (LIMITS) — it can’t catch everything the API might reject, like an expired or wrong-target mediaId (MediaNotFoundError). If createPosition itself fails partway through the loop, the script stops at that first failed position rather than skipping it and continuing — check the error message, fix the offending entry in POSITIONS, and re-run. Positions created before the failure already exist; re-running the script will create duplicates of those unless you remove them from the array first.
Verify what was created by opening admin.hireflix.com/jobs and searching for each position by name.

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 with reservePositionQAVideoContentUpload, upload it the same way as Step 1, and add the resulting mediaId to that question’s questionFormat:
See the QA question video tab in Adding video content to a position for the full reserve-and-upload mutation this relies on.

Key reminders

  • The intro and outro mediaIds are uploaded once and reused across every position in POSITIONS — don’t call upload_shared_media.js again unless you want to change the shared videos.
  • answerFormat resolves in this order: question-levelposition-level{} (Hireflix’s current default). Only set it where a question or position genuinely needs to differ — an explicit answerFormat marks 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, or numAllowedRetakes are, or what each setting means for candidates? See Tailoring the Interview.
  • validatePositions() runs before any position is created, checking name/tag/question-title lengths against LIMITS. Extend it if you add other fields to POSITIONS that carry their own length limits.
  • The script is otherwise fail-fast — a createPosition failure not caught by validation still stops the whole run. Re-running after a partial failure will recreate the positions that already succeeded, so trim POSITIONS down 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.